@panneau/medias 4.0.50 → 4.0.55

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 (3) hide show
  1. package/dist/index.d.ts +23 -37
  2. package/dist/index.js +878 -437
  3. package/package.json +17 -17
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import { use, createContext, useState, useCallback, useMemo, useEffect } from 'react';
2
+ import { use, createContext, useState, useCallback, useEffect } from 'react';
3
3
  import { FormattedMessage } from 'react-intl';
4
4
  import { useFieldComponent, usePanneauResource } from '@panneau/core/contexts';
5
5
  import { useForm, useQuery } from '@panneau/core/hooks';
@@ -600,7 +600,6 @@ var defaultFields = [{
600
600
  }]
601
601
  }];
602
602
 
603
- /* eslint-disable react/jsx-props-no-spreading */
604
603
  function MediaForm({
605
604
  value: initialValue = null,
606
605
  fields: initialFields = defaultFields,
@@ -987,7 +986,6 @@ var defaultFilters = [{
987
986
  // },
988
987
  ];
989
988
 
990
- /* eslint-disable react/jsx-props-no-spreading, react/no-array-index-key */
991
989
  const DEFAULT_LAYOUTS = [{
992
990
  id: 'table',
993
991
  label: /*#__PURE__*/jsx(Icon, {
@@ -1000,75 +998,169 @@ const DEFAULT_LAYOUTS = [{
1000
998
  })
1001
999
  }];
1002
1000
  const DEFAULT_UPPY_CONFIG = {};
1003
- function MediasBrowser({
1004
- items: initialItems = null,
1005
- extraItems = null,
1006
- types = null,
1007
- permissions = null,
1008
- baseUrl = null,
1009
- filters = defaultFilters,
1010
- columns = defaultColumns,
1011
- fields = defaultFields,
1012
- query: initialQuery = null,
1013
- layout: initialLayout = 'table',
1014
- layouts = DEFAULT_LAYOUTS,
1015
- theme = null,
1016
- onMediaUploaded = null,
1017
- onItemsChange = null,
1018
- onLayoutChange = null,
1019
- onMediaFormOpen = null,
1020
- onMediaFormClose = null,
1021
- selectable = false,
1022
- selectedItems = null,
1023
- onSelectionChange = null,
1024
- multipleSelection = false,
1025
- uppyConfig = DEFAULT_UPPY_CONFIG,
1026
- withDelete = false,
1027
- withTrash = false,
1028
- withReplace = false,
1029
- withStickySelection = false,
1030
- withoutUpload = false,
1031
- className = null,
1032
- formChildren = null
1033
- }) {
1001
+ function MediasBrowser(t0) {
1002
+ const $ = c(162);
1003
+ const {
1004
+ items: t1,
1005
+ extraItems: t2,
1006
+ types: t3,
1007
+ permissions: t4,
1008
+ baseUrl: t5,
1009
+ filters: t6,
1010
+ columns: t7,
1011
+ fields: t8,
1012
+ query: t9,
1013
+ layout: t10,
1014
+ layouts: t11,
1015
+ theme: t12,
1016
+ onMediaUploaded: t13,
1017
+ onItemsChange: t14,
1018
+ onLayoutChange: t15,
1019
+ onMediaFormOpen: t16,
1020
+ onMediaFormClose: t17,
1021
+ selectable: t18,
1022
+ selectedItems: t19,
1023
+ onSelectionChange: t20,
1024
+ multipleSelection: t21,
1025
+ uppyConfig: t22,
1026
+ withDelete: t23,
1027
+ withTrash: t24,
1028
+ withReplace: t25,
1029
+ withStickySelection: t26,
1030
+ withoutUpload: t27,
1031
+ className: t28,
1032
+ filtersClassName: t29,
1033
+ formChildren: t30
1034
+ } = t0;
1035
+ const initialItems = t1 === undefined ? null : t1;
1036
+ const extraItems = t2 === undefined ? null : t2;
1037
+ const types = t3 === undefined ? null : t3;
1038
+ const permissions = t4 === undefined ? null : t4;
1039
+ const baseUrl = t5 === undefined ? null : t5;
1040
+ const filters = t6 === undefined ? defaultFilters : t6;
1041
+ const columns = t7 === undefined ? defaultColumns : t7;
1042
+ const fields = t8 === undefined ? defaultFields : t8;
1043
+ const initialQuery = t9 === undefined ? null : t9;
1044
+ const initialLayout = t10 === undefined ? "table" : t10;
1045
+ const layouts = t11 === undefined ? DEFAULT_LAYOUTS : t11;
1046
+ const theme = t12 === undefined ? null : t12;
1047
+ const onMediaUploaded = t13 === undefined ? null : t13;
1048
+ const onItemsChange = t14 === undefined ? null : t14;
1049
+ const onLayoutChange = t15 === undefined ? null : t15;
1050
+ const onMediaFormOpen = t16 === undefined ? null : t16;
1051
+ const onMediaFormClose = t17 === undefined ? null : t17;
1052
+ const selectable = t18 === undefined ? false : t18;
1053
+ const selectedItems = t19 === undefined ? null : t19;
1054
+ const onSelectionChange = t20 === undefined ? null : t20;
1055
+ const multipleSelection = t21 === undefined ? false : t21;
1056
+ const uppyConfig = t22 === undefined ? DEFAULT_UPPY_CONFIG : t22;
1057
+ const withDelete = t23 === undefined ? false : t23;
1058
+ const withTrash = t24 === undefined ? false : t24;
1059
+ const withReplace = t25 === undefined ? false : t25;
1060
+ const withStickySelection = t26 === undefined ? false : t26;
1061
+ const withoutUpload = t27 === undefined ? false : t27;
1062
+ const className = t28 === undefined ? null : t28;
1063
+ const filtersClassName = t29 === undefined ? null : t29;
1064
+ const formChildren = t30 === undefined ? null : t30;
1034
1065
  const [baseItems] = useState(initialItems || null);
1035
- const baseQuery = useMemo(() => ({
1036
- count: 12,
1037
- ...initialQuery,
1038
- ...(types !== null ? {
1066
+ let t31;
1067
+ if ($[0] !== types) {
1068
+ t31 = types !== null ? {
1039
1069
  types
1040
- } : null)
1041
- }), [initialQuery, types]);
1070
+ } : null;
1071
+ $[0] = types;
1072
+ $[1] = t31;
1073
+ } else {
1074
+ t31 = $[1];
1075
+ }
1076
+ let t32;
1077
+ if ($[2] !== initialQuery || $[3] !== t31) {
1078
+ t32 = {
1079
+ count: 12,
1080
+ ...initialQuery,
1081
+ ...t31
1082
+ };
1083
+ $[2] = initialQuery;
1084
+ $[3] = t31;
1085
+ $[4] = t32;
1086
+ } else {
1087
+ t32 = $[4];
1088
+ }
1089
+ const baseQuery = t32;
1042
1090
  const {
1043
1091
  query: fullQuery,
1044
1092
  onPageChange,
1045
1093
  onQueryChange,
1046
1094
  onQueryReset
1047
1095
  } = useQuery(baseQuery);
1048
- const page = useMemo(() => (fullQuery || {}).page ?? null, [fullQuery]);
1049
- const count = useMemo(() => (fullQuery || {}).count ?? null, [fullQuery]);
1050
-
1051
- // Stabilize the filter query reference: only create a new object when filter values actually change.
1052
- // We use JSON.stringify as a stable primitive key so that useMemo only recomputes when values differ.
1053
- const queryJSON = useMemo(() => {
1054
- const {
1055
- page: _p,
1056
- count: _c,
1057
- ...params
1058
- } = fullQuery || {};
1059
- return Object.keys(params).length > 0 ? JSON.stringify(params) : null;
1060
- }, [fullQuery]);
1061
- const query = useMemo(() => queryJSON !== null ? JSON.parse(queryJSON) : null, [queryJSON]);
1096
+ let t33;
1097
+ if ($[5] !== fullQuery) {
1098
+ t33 = fullQuery || {};
1099
+ $[5] = fullQuery;
1100
+ $[6] = t33;
1101
+ } else {
1102
+ t33 = $[6];
1103
+ }
1104
+ let query;
1105
+ let t34;
1106
+ let t35;
1107
+ if ($[7] !== t33) {
1108
+ ({
1109
+ page: t34,
1110
+ count: t35,
1111
+ ...query
1112
+ } = t33);
1113
+ $[7] = t33;
1114
+ $[8] = query;
1115
+ $[9] = t34;
1116
+ $[10] = t35;
1117
+ } else {
1118
+ query = $[8];
1119
+ t34 = $[9];
1120
+ t35 = $[10];
1121
+ }
1122
+ const page = t34 === undefined ? null : t34;
1123
+ const count = t35 === undefined ? null : t35;
1124
+ let t36;
1125
+ if ($[11] !== permissions) {
1126
+ t36 = permissions || {};
1127
+ $[11] = permissions;
1128
+ $[12] = t36;
1129
+ } else {
1130
+ t36 = $[12];
1131
+ }
1062
1132
  const {
1063
- create: canCreate = true,
1064
- edit: canEdit = true,
1065
- delete: canDelete = true
1066
- } = permissions || {};
1133
+ create: t37,
1134
+ edit: t38,
1135
+ delete: t39
1136
+ } = t36;
1137
+ const canCreate = t37 === undefined ? true : t37;
1138
+ const canEdit = t38 === undefined ? true : t38;
1139
+ const canDelete = t39 === undefined ? true : t39;
1067
1140
  const canUpload = canCreate && !withoutUpload;
1068
- const {
1069
- trashed = null,
1070
- ...queryWithoutTypes
1071
- } = query || {};
1141
+ let t40;
1142
+ if ($[13] !== query) {
1143
+ t40 = query || {};
1144
+ $[13] = query;
1145
+ $[14] = t40;
1146
+ } else {
1147
+ t40 = $[14];
1148
+ }
1149
+ let queryWithoutTypes;
1150
+ let t41;
1151
+ if ($[15] !== t40) {
1152
+ ({
1153
+ trashed: t41,
1154
+ ...queryWithoutTypes
1155
+ } = t40);
1156
+ $[15] = t40;
1157
+ $[16] = queryWithoutTypes;
1158
+ $[17] = t41;
1159
+ } else {
1160
+ queryWithoutTypes = $[16];
1161
+ t41 = $[17];
1162
+ }
1163
+ const trashed = t41 === undefined ? null : t41;
1072
1164
  const {
1073
1165
  mediaTrash,
1074
1166
  trashing
@@ -1081,251 +1173,489 @@ function MediasBrowser({
1081
1173
  mediaRestore
1082
1174
  } = useMediaRestore();
1083
1175
  const [showTrashed, setShowTrashed] = useState(false);
1176
+ let t42;
1177
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
1178
+ t42 = {
1179
+ staleTime: 0
1180
+ };
1181
+ $[18] = t42;
1182
+ } else {
1183
+ t42 = $[18];
1184
+ }
1185
+ let t43;
1186
+ if ($[19] !== baseItems || $[20] !== showTrashed) {
1187
+ t43 = {
1188
+ items: baseItems,
1189
+ trashed: showTrashed,
1190
+ queryConfig: t42
1191
+ };
1192
+ $[19] = baseItems;
1193
+ $[20] = showTrashed;
1194
+ $[21] = t43;
1195
+ } else {
1196
+ t43 = $[21];
1197
+ }
1084
1198
  const {
1085
1199
  items,
1086
1200
  allItems,
1087
- loading = false,
1088
- loaded = false,
1089
- updateItem = null,
1090
- pagination: {
1091
- lastPage = null,
1092
- total = null
1093
- } = {},
1094
- pages = null,
1201
+ loading: t44,
1202
+ loaded: t45,
1203
+ updateItem: t46,
1204
+ pagination: t47,
1205
+ pages: t48,
1095
1206
  reload
1096
- } = useMedias(query, page, count, {
1097
- items: baseItems,
1098
- trashed: showTrashed,
1099
- queryConfig: {
1100
- staleTime: 0
1101
- }
1102
- });
1103
- const onClickTrash = useCallback(() => {
1104
- setShowTrashed(!showTrashed);
1105
- }, [showTrashed, setShowTrashed]);
1106
- useEffect(() => {
1107
- if (onItemsChange !== null) {
1108
- onItemsChange(items);
1109
- }
1110
- }, [items, onItemsChange]);
1111
- const [layout, setLayout] = useState(initialLayout || 'table');
1112
- const hasLayouts = useMemo(() => layouts !== null && layouts.length > 1, [layouts]);
1113
- const onClickLayout = useCallback(newLayout => {
1114
- setLayout(newLayout);
1115
- if (onLayoutChange !== null) {
1116
- onLayoutChange(newLayout);
1117
- }
1118
- }, [setLayout]);
1207
+ } = useMedias(query, page, count, t43);
1208
+ const loading = t44 === undefined ? false : t44;
1209
+ const loaded = t45 === undefined ? false : t45;
1210
+ const updateItem = t46 === undefined ? null : t46;
1211
+ let t49;
1212
+ if ($[22] !== t47) {
1213
+ t49 = t47 === undefined ? {} : t47;
1214
+ $[22] = t47;
1215
+ $[23] = t49;
1216
+ } else {
1217
+ t49 = $[23];
1218
+ }
1219
+ const {
1220
+ lastPage: t50,
1221
+ total: t51
1222
+ } = t49;
1223
+ const lastPage = t50 === undefined ? null : t50;
1224
+ const total = t51 === undefined ? null : t51;
1225
+ const pages = t48 === undefined ? null : t48;
1226
+ let t52;
1227
+ if ($[24] !== showTrashed) {
1228
+ t52 = () => {
1229
+ setShowTrashed(!showTrashed);
1230
+ };
1231
+ $[24] = showTrashed;
1232
+ $[25] = t52;
1233
+ } else {
1234
+ t52 = $[25];
1235
+ }
1236
+ const onClickTrash = t52;
1237
+ let t53;
1238
+ let t54;
1239
+ if ($[26] !== items || $[27] !== onItemsChange) {
1240
+ t53 = () => {
1241
+ if (onItemsChange !== null) {
1242
+ onItemsChange(items);
1243
+ }
1244
+ };
1245
+ t54 = [items, onItemsChange];
1246
+ $[26] = items;
1247
+ $[27] = onItemsChange;
1248
+ $[28] = t53;
1249
+ $[29] = t54;
1250
+ } else {
1251
+ t53 = $[28];
1252
+ t54 = $[29];
1253
+ }
1254
+ useEffect(t53, t54);
1255
+ const [layout, setLayout] = useState(initialLayout || "table");
1256
+ const hasLayouts = layouts !== null && layouts.length > 1;
1257
+ let t55;
1258
+ if ($[30] !== onLayoutChange) {
1259
+ t55 = newLayout => {
1260
+ setLayout(newLayout);
1261
+ if (onLayoutChange !== null) {
1262
+ onLayoutChange(newLayout);
1263
+ }
1264
+ };
1265
+ $[30] = onLayoutChange;
1266
+ $[31] = t55;
1267
+ } else {
1268
+ t55 = $[31];
1269
+ }
1270
+ const onClickLayout = t55;
1119
1271
  const {
1120
1272
  currentMedia,
1121
1273
  setCurrentMedia
1122
1274
  } = useCurrentMedia();
1123
- useEffect(() => {
1124
- if (currentMedia !== null && onMediaFormOpen !== null) {
1125
- onMediaFormOpen();
1126
- }
1127
- if (currentMedia === null && onMediaFormClose !== null) {
1128
- onMediaFormClose();
1129
- }
1130
- }, [currentMedia]);
1131
- const onOpenMedia = useCallback(media => {
1132
- setCurrentMedia(media);
1133
- }, [setCurrentMedia]);
1134
- const onCloseMedia = useCallback(() => {
1135
- setCurrentMedia(null);
1136
- }, [setCurrentMedia]);
1137
- const onSaveMedia = useCallback(item => {
1138
- setCurrentMedia(null);
1139
- updateItem(item);
1140
- }, [setCurrentMedia, updateItem]);
1141
- const onReplaceMedia = useCallback(item_0 => {
1142
- setCurrentMedia(item_0);
1143
- reload();
1144
- }, [setCurrentMedia]);
1145
- const onDeleteMedia = useCallback(() => {
1146
- if (reload !== null) {
1275
+ let t56;
1276
+ let t57;
1277
+ if ($[32] !== currentMedia || $[33] !== onMediaFormClose || $[34] !== onMediaFormOpen) {
1278
+ t56 = () => {
1279
+ if (currentMedia !== null && onMediaFormOpen !== null) {
1280
+ onMediaFormOpen();
1281
+ }
1282
+ if (currentMedia === null && onMediaFormClose !== null) {
1283
+ onMediaFormClose();
1284
+ }
1285
+ };
1286
+ t57 = [currentMedia, onMediaFormOpen, onMediaFormClose];
1287
+ $[32] = currentMedia;
1288
+ $[33] = onMediaFormClose;
1289
+ $[34] = onMediaFormOpen;
1290
+ $[35] = t56;
1291
+ $[36] = t57;
1292
+ } else {
1293
+ t56 = $[35];
1294
+ t57 = $[36];
1295
+ }
1296
+ useEffect(t56, t57);
1297
+ let t58;
1298
+ if ($[37] !== setCurrentMedia) {
1299
+ t58 = media => {
1300
+ setCurrentMedia(media);
1301
+ };
1302
+ $[37] = setCurrentMedia;
1303
+ $[38] = t58;
1304
+ } else {
1305
+ t58 = $[38];
1306
+ }
1307
+ const onOpenMedia = t58;
1308
+ let t59;
1309
+ if ($[39] !== setCurrentMedia) {
1310
+ t59 = () => {
1311
+ setCurrentMedia(null);
1312
+ };
1313
+ $[39] = setCurrentMedia;
1314
+ $[40] = t59;
1315
+ } else {
1316
+ t59 = $[40];
1317
+ }
1318
+ const onCloseMedia = t59;
1319
+ let t60;
1320
+ if ($[41] !== setCurrentMedia || $[42] !== updateItem) {
1321
+ t60 = item => {
1322
+ setCurrentMedia(null);
1323
+ updateItem(item);
1324
+ };
1325
+ $[41] = setCurrentMedia;
1326
+ $[42] = updateItem;
1327
+ $[43] = t60;
1328
+ } else {
1329
+ t60 = $[43];
1330
+ }
1331
+ const onSaveMedia = t60;
1332
+ let t61;
1333
+ if ($[44] !== reload || $[45] !== setCurrentMedia) {
1334
+ t61 = item_0 => {
1335
+ setCurrentMedia(item_0);
1147
1336
  reload();
1148
- }
1149
- }, [reload]);
1150
- const onTrashMedia = useCallback(id => !showTrashed && withTrash ? mediaTrash(id).then(() => {
1151
- if (!multipleSelection) {
1152
- const selectedId = selectedItems?.[0]?.id || null;
1153
- if (selectedId !== null && selectedId === id && onSelectionChange !== null) {
1154
- onSelectionChange(null);
1337
+ };
1338
+ $[44] = reload;
1339
+ $[45] = setCurrentMedia;
1340
+ $[46] = t61;
1341
+ } else {
1342
+ t61 = $[46];
1343
+ }
1344
+ const onReplaceMedia = t61;
1345
+ let t62;
1346
+ if ($[47] !== reload) {
1347
+ t62 = () => {
1348
+ if (reload !== null) {
1349
+ reload();
1155
1350
  }
1156
- }
1157
- // Todo remove from mult selection
1158
- }).then(() => reload()) : mediaDelete(id).then(() => {
1159
- if (!multipleSelection) {
1160
- const selectedId_0 = selectedItems?.[0]?.id || null;
1161
- if (selectedId_0 !== null && selectedId_0 === id && onSelectionChange !== null) {
1162
- onSelectionChange(null);
1351
+ };
1352
+ $[47] = reload;
1353
+ $[48] = t62;
1354
+ } else {
1355
+ t62 = $[48];
1356
+ }
1357
+ const onDeleteMedia = t62;
1358
+ let t63;
1359
+ if ($[49] !== mediaDelete || $[50] !== mediaTrash || $[51] !== onSelectionChange || $[52] !== reload || $[53] !== selectedItems || $[54] !== showTrashed || $[55] !== withTrash) {
1360
+ t63 = id => (!showTrashed && withTrash ? mediaTrash(id) : mediaDelete(id)).then(() => {
1361
+ const newSelectedItems = (selectedItems || []).filter(t64 => {
1362
+ const {
1363
+ id: t65
1364
+ } = t64;
1365
+ const itemId = t65 === undefined ? null : t65;
1366
+ return itemId !== id;
1367
+ });
1368
+ if (onSelectionChange !== null) {
1369
+ onSelectionChange(newSelectedItems.length > 0 ? newSelectedItems : null);
1163
1370
  }
1164
- }
1165
- // Todo remove from selection
1166
- }).then(() => reload()), [showTrashed, withTrash, mediaTrash, mediaDelete, reload, selectedItems, multipleSelection, onSelectionChange]);
1371
+ }).then(() => reload());
1372
+ $[49] = mediaDelete;
1373
+ $[50] = mediaTrash;
1374
+ $[51] = onSelectionChange;
1375
+ $[52] = reload;
1376
+ $[53] = selectedItems;
1377
+ $[54] = showTrashed;
1378
+ $[55] = withTrash;
1379
+ $[56] = t63;
1380
+ } else {
1381
+ t63 = $[56];
1382
+ }
1383
+ const onTrashMedia = t63;
1167
1384
  const [uploadedMedias, setUploadedMedias] = useState(null);
1168
1385
  const [uploadProcessing, setUploadProcessing] = useState(false);
1169
- const onUploadedMediaChanged = useCallback(newMedias => {
1170
- const uploadedNewMedias = (Array.isArray(newMedias) ? [...newMedias, ...(uploadedMedias || [])] : [newMedias, ...(uploadedMedias || [])]).filter(it => it !== null);
1171
- setUploadedMedias(uploadedNewMedias);
1172
- if (onSelectionChange !== null) {
1173
- const firstMedia = Array.isArray(newMedias) ? newMedias[0] ?? null : newMedias ?? null;
1174
- onSelectionChange(multipleSelection && Array.isArray(newMedias) ? newMedias : [firstMedia]);
1175
- onQueryReset();
1176
- reload().then(() => {
1386
+ let t64;
1387
+ if ($[57] !== multipleSelection || $[58] !== onQueryReset || $[59] !== onSelectionChange || $[60] !== reload || $[61] !== uploadedMedias) {
1388
+ t64 = newMedias => {
1389
+ const uploadedNewMedias = (Array.isArray(newMedias) ? [...newMedias, ...(uploadedMedias || [])] : [newMedias, ...(uploadedMedias || [])]).filter(_temp);
1390
+ setUploadedMedias(uploadedNewMedias);
1391
+ if (onSelectionChange !== null) {
1392
+ const firstMedia = Array.isArray(newMedias) ? newMedias[0] ?? null : newMedias ?? null;
1393
+ onSelectionChange(multipleSelection && Array.isArray(newMedias) ? newMedias : [firstMedia]);
1394
+ onQueryReset();
1395
+ reload();
1177
1396
  setUploadedMedias(null);
1178
- });
1179
- }
1180
- }, [onSelectionChange, setUploadedMedias, uploadedMedias, onQueryReset, reload, multipleSelection]);
1181
- const onUploadComplete = useCallback((medias = null) => {
1182
- if (showTrashed) {
1183
- setShowTrashed(false);
1184
- }
1185
- if (medias === null) return;
1186
- const rawMedias = (Array.isArray(medias) ? medias : [medias]).filter(it_0 => it_0 !== null);
1187
- if (onMediaUploaded !== null) {
1188
- setUploadProcessing(true);
1189
- Promise.resolve(onMediaUploaded(rawMedias)).then(newMedias_0 => {
1190
- onUploadedMediaChanged(newMedias_0 || null);
1191
- setUploadProcessing(false);
1192
- }).catch(() => {
1193
- setUploadProcessing(false);
1194
- });
1195
- } else {
1196
- onUploadedMediaChanged(rawMedias);
1197
- }
1198
- }, [onMediaUploaded, setUploadedMedias, setUploadProcessing, onUploadedMediaChanged]);
1199
- const onClickPage = useCallback((e, pageNumber = null) => {
1200
- e.preventDefault();
1201
- e.stopPropagation();
1202
- onPageChange(pageNumber);
1203
- }, [onPageChange]);
1204
- const pagination = /*#__PURE__*/jsx(Pagination, {
1205
- page: page,
1206
- lastPage: lastPage,
1207
- total: total,
1208
- url: baseUrl,
1209
- query: query,
1210
- onClickPage: onClickPage,
1211
- loading: loading && pages !== null,
1212
- selectable: selectable,
1213
- selectedItems: selectedItems,
1214
- onSelectionChange: onSelectionChange,
1215
- multipleSelection: multipleSelection,
1216
- withPreviousNext: true,
1217
- alwaysShowButtons: true
1218
- });
1397
+ }
1398
+ };
1399
+ $[57] = multipleSelection;
1400
+ $[58] = onQueryReset;
1401
+ $[59] = onSelectionChange;
1402
+ $[60] = reload;
1403
+ $[61] = uploadedMedias;
1404
+ $[62] = t64;
1405
+ } else {
1406
+ t64 = $[62];
1407
+ }
1408
+ const onUploadedMediaChanged = t64;
1409
+ let t65;
1410
+ if ($[63] !== onMediaUploaded || $[64] !== onUploadedMediaChanged || $[65] !== showTrashed) {
1411
+ t65 = t66 => {
1412
+ const medias = t66 === undefined ? null : t66;
1413
+ if (showTrashed) {
1414
+ setShowTrashed(false);
1415
+ }
1416
+ if (medias === null) {
1417
+ return;
1418
+ }
1419
+ const rawMedias = (Array.isArray(medias) ? medias : [medias]).filter(_temp2);
1420
+ if (onMediaUploaded !== null) {
1421
+ setUploadProcessing(true);
1422
+ Promise.resolve(onMediaUploaded(rawMedias)).then(newMedias_0 => {
1423
+ onUploadedMediaChanged(newMedias_0 || null);
1424
+ setUploadProcessing(false);
1425
+ }).catch(() => {
1426
+ setUploadProcessing(false);
1427
+ });
1428
+ } else {
1429
+ onUploadedMediaChanged(rawMedias);
1430
+ }
1431
+ };
1432
+ $[63] = onMediaUploaded;
1433
+ $[64] = onUploadedMediaChanged;
1434
+ $[65] = showTrashed;
1435
+ $[66] = t65;
1436
+ } else {
1437
+ t65 = $[66];
1438
+ }
1439
+ const onUploadComplete = t65;
1440
+ let t66;
1441
+ if ($[67] !== onPageChange) {
1442
+ t66 = (e, t67) => {
1443
+ const pageNumber = t67 === undefined ? null : t67;
1444
+ e.preventDefault();
1445
+ e.stopPropagation();
1446
+ onPageChange(pageNumber);
1447
+ };
1448
+ $[67] = onPageChange;
1449
+ $[68] = t66;
1450
+ } else {
1451
+ t66 = $[68];
1452
+ }
1453
+ const onClickPage = t66;
1454
+ const t67 = loading && pages !== null;
1455
+ let t68;
1456
+ if ($[69] !== baseUrl || $[70] !== lastPage || $[71] !== multipleSelection || $[72] !== onClickPage || $[73] !== onSelectionChange || $[74] !== page || $[75] !== query || $[76] !== selectable || $[77] !== selectedItems || $[78] !== t67 || $[79] !== total) {
1457
+ t68 = /*#__PURE__*/jsx(Pagination, {
1458
+ page: page,
1459
+ lastPage: lastPage,
1460
+ total: total,
1461
+ url: baseUrl,
1462
+ query: query,
1463
+ onClickPage: onClickPage,
1464
+ loading: t67,
1465
+ selectable: selectable,
1466
+ selectedItems: selectedItems,
1467
+ onSelectionChange: onSelectionChange,
1468
+ multipleSelection: multipleSelection,
1469
+ withPreviousNext: true,
1470
+ alwaysShowButtons: true
1471
+ });
1472
+ $[69] = baseUrl;
1473
+ $[70] = lastPage;
1474
+ $[71] = multipleSelection;
1475
+ $[72] = onClickPage;
1476
+ $[73] = onSelectionChange;
1477
+ $[74] = page;
1478
+ $[75] = query;
1479
+ $[76] = selectable;
1480
+ $[77] = selectedItems;
1481
+ $[78] = t67;
1482
+ $[79] = total;
1483
+ $[80] = t68;
1484
+ } else {
1485
+ t68 = $[80];
1486
+ }
1487
+ const pagination = t68;
1219
1488
  const hidePagination = loaded && !loading && total === 0;
1220
- const finalFilters = useMemo(() => {
1221
- const partialFilters = withTrash ? (filters || []).concat([{
1222
- name: 'trashed',
1223
- component: 'button',
1224
- theme: showTrashed ? 'danger' : 'secondary',
1489
+ let t69;
1490
+ if ($[81] !== filters || $[82] !== onClickTrash || $[83] !== showTrashed || $[84] !== uploadProcessing || $[85] !== withTrash) {
1491
+ t69 = withTrash ? (filters || []).concat([{
1492
+ name: "trashed",
1493
+ component: "button",
1494
+ theme: showTrashed ? "danger" : "secondary",
1225
1495
  outline: !showTrashed,
1226
- activeTheme: 'danger',
1227
- icon: showTrashed ? 'trash-fill' : 'trash',
1496
+ activeTheme: "danger",
1497
+ icon: showTrashed ? "trash-fill" : "trash",
1228
1498
  disabled: uploadProcessing,
1229
1499
  onClick: onClickTrash
1230
1500
  }]) : filters;
1231
- if (types !== null && partialFilters !== null) {
1232
- return (partialFilters || []).map(filter => {
1233
- const {
1234
- id: id_0 = null
1235
- } = filter || {};
1236
- return id_0 === 'types' ? {
1237
- ...filter,
1238
- disabled: true
1239
- } : filter;
1240
- });
1501
+ $[81] = filters;
1502
+ $[82] = onClickTrash;
1503
+ $[83] = showTrashed;
1504
+ $[84] = uploadProcessing;
1505
+ $[85] = withTrash;
1506
+ $[86] = t69;
1507
+ } else {
1508
+ t69 = $[86];
1509
+ }
1510
+ let finalFilters = t69;
1511
+ if (types !== null && finalFilters !== null) {
1512
+ let t70;
1513
+ if ($[87] !== finalFilters) {
1514
+ t70 = finalFilters || [];
1515
+ $[87] = finalFilters;
1516
+ $[88] = t70;
1517
+ } else {
1518
+ t70 = $[88];
1241
1519
  }
1242
- return partialFilters;
1243
- }, [filters, types, withTrash, showTrashed, uploadProcessing, onClickTrash]);
1244
- const partialColumns = useMemo(() => withTrash && showTrashed ? (columns || []).map(column => {
1245
- const {
1246
- id: columnId = null
1247
- } = column || {};
1248
- if (columnId === 'created_at') {
1249
- return {
1250
- ...column,
1251
- path: 'deleted_at',
1252
- label: /*#__PURE__*/jsx(FormattedMessage, {
1253
- id: "uds4wJ"
1254
- })
1255
- };
1520
+ let t71;
1521
+ if ($[89] !== t70) {
1522
+ t71 = t70.map(_temp3);
1523
+ $[89] = t70;
1524
+ $[90] = t71;
1525
+ } else {
1526
+ t71 = $[90];
1256
1527
  }
1257
- if (columnId === 'actions') {
1528
+ finalFilters = t71;
1529
+ }
1530
+ let t70;
1531
+ if ($[91] !== canDelete || $[92] !== canEdit || $[93] !== columns || $[94] !== mediaRestore || $[95] !== reload || $[96] !== showTrashed || $[97] !== withTrash) {
1532
+ const partialColumns = withTrash && showTrashed ? (columns || []).map(column => {
1258
1533
  const {
1259
- actions = []
1534
+ id: t71
1260
1535
  } = column || {};
1261
- return {
1262
- ...column,
1263
- actions: (actions || []).reduce((acc, action) => {
1264
- if (action === 'delete') {
1265
- acc.push({
1266
- id: 'restore',
1267
- component: 'restore',
1268
- withConfirmation: true,
1269
- action: ids => mediaRestore(ids[0]).then(reload)
1270
- });
1536
+ const columnId = t71 === undefined ? null : t71;
1537
+ if (columnId === "created_at") {
1538
+ return {
1539
+ ...column,
1540
+ path: "deleted_at",
1541
+ label: /*#__PURE__*/jsx(FormattedMessage, {
1542
+ id: "uds4wJ"
1543
+ })
1544
+ };
1545
+ }
1546
+ if (columnId === "actions") {
1547
+ const {
1548
+ actions: t72
1549
+ } = column || {};
1550
+ const actions = t72 === undefined ? [] : t72;
1551
+ return {
1552
+ ...column,
1553
+ actions: (actions || []).reduce((acc, action) => {
1554
+ if (action === "delete") {
1555
+ acc.push({
1556
+ id: "restore",
1557
+ component: "restore",
1558
+ withConfirmation: true,
1559
+ action: ids => mediaRestore(ids[0]).then(reload)
1560
+ });
1561
+ }
1562
+ acc.push(action);
1563
+ return acc;
1564
+ }, []).filter(_temp4)
1565
+ };
1566
+ }
1567
+ return column;
1568
+ }) : columns;
1569
+ let t73;
1570
+ if ($[99] !== canDelete || $[100] !== canEdit) {
1571
+ t73 = column_0 => {
1572
+ const {
1573
+ id: t74
1574
+ } = column_0 || {};
1575
+ const columnId_0 = t74 === undefined ? null : t74;
1576
+ if (columnId_0 === "actions") {
1577
+ const {
1578
+ actions: t75
1579
+ } = column_0 || {};
1580
+ const actions_0 = t75 === undefined ? [] : t75;
1581
+ const availableActions = actions_0.filter(act => act !== "delete" || canDelete).filter(act_0 => act_0 !== "edit" || canEdit);
1582
+ if (availableActions.length === 0) {
1583
+ return null;
1271
1584
  }
1272
- acc.push(action);
1273
- return acc;
1274
- }, []).filter(it_1 => it_1 !== 'edit')
1585
+ return {
1586
+ ...column_0,
1587
+ actions: availableActions
1588
+ };
1589
+ }
1590
+ return column_0;
1275
1591
  };
1592
+ $[99] = canDelete;
1593
+ $[100] = canEdit;
1594
+ $[101] = t73;
1595
+ } else {
1596
+ t73 = $[101];
1276
1597
  }
1277
- return column;
1278
- }) : columns, [columns, withTrash, showTrashed]);
1279
- const finalColumns = useMemo(() => (partialColumns || []).map(column_0 => {
1280
- const {
1281
- id: columnId_0 = null
1282
- } = column_0 || {};
1283
- if (columnId_0 === 'actions') {
1598
+ t70 = (partialColumns || []).map(t73).filter(_temp5);
1599
+ $[91] = canDelete;
1600
+ $[92] = canEdit;
1601
+ $[93] = columns;
1602
+ $[94] = mediaRestore;
1603
+ $[95] = reload;
1604
+ $[96] = showTrashed;
1605
+ $[97] = withTrash;
1606
+ $[98] = t70;
1607
+ } else {
1608
+ t70 = $[98];
1609
+ }
1610
+ const finalColumns = t70;
1611
+ const showOnTopQuery = types === null ? query : queryWithoutTypes;
1612
+ let t71;
1613
+ if ($[102] !== showOnTopQuery || $[103] !== trashed) {
1614
+ t71 = showOnTopQuery !== null && !trashed ? Object.keys(showOnTopQuery).length > 0 : false;
1615
+ $[102] = showOnTopQuery;
1616
+ $[103] = trashed;
1617
+ $[104] = t71;
1618
+ } else {
1619
+ t71 = $[104];
1620
+ }
1621
+ const hasQueryItem = t71;
1622
+ let t72;
1623
+ if ($[105] !== allItems || $[106] !== extraItems || $[107] !== hasQueryItem || $[108] !== items || $[109] !== page || $[110] !== showTrashed || $[111] !== uploadProcessing || $[112] !== uploadedMedias || $[113] !== withStickySelection) {
1624
+ t72 = withStickySelection && (extraItems !== null || uploadedMedias !== null || uploadProcessing === true) ? uniqBy([...(uploadProcessing ? [{
1625
+ id: "-",
1626
+ loading: true,
1627
+ actionsDisabled: true,
1628
+ selectionDisabled: true
1629
+ }] : []), ...(page === 1 && !hasQueryItem ? uploadedMedias || [] : []), ...(page === 1 && !hasQueryItem && !showTrashed ? (extraItems || []).map(item_1 => {
1284
1630
  const {
1285
- actions: actions_0 = []
1286
- } = column_0 || {};
1287
- const availableActions = actions_0.filter(act => act !== 'delete' || canDelete).filter(act_0 => act_0 !== 'edit' || canEdit);
1288
- if (availableActions.length === 0) {
1289
- return null;
1290
- }
1291
- return {
1292
- ...column_0,
1293
- actions: availableActions
1294
- };
1295
- }
1296
- return column_0;
1297
- }).filter(act_1 => act_1 !== null), [partialColumns, canEdit, canDelete]);
1298
- const hasQueryItem = useMemo(() => {
1299
- const showOnTopQuery = types === null ? query : queryWithoutTypes;
1300
- return showOnTopQuery !== null && !trashed ? Object.keys(showOnTopQuery).length > 0 : false;
1301
- }, [types, query, queryWithoutTypes, trashed]);
1302
- const finalItems = useMemo(() => {
1303
- if (withStickySelection && (extraItems !== null || uploadedMedias !== null || uploadProcessing === true)) {
1304
- return uniqBy([...(uploadProcessing ? [{
1305
- id: '-',
1306
- loading: true,
1307
- actionsDisabled: true,
1308
- selectionDisabled: true
1309
- }] : []), ...(page === 1 && !hasQueryItem ? uploadedMedias || [] : []), ...(page === 1 && !hasQueryItem && !showTrashed ? (extraItems || []).map(item_1 => {
1631
+ id: t73
1632
+ } = item_1;
1633
+ const itemId_0 = t73 === undefined ? null : t73;
1634
+ return (allItems || []).find(t74 => {
1310
1635
  const {
1311
- id: itemId = null
1312
- } = item_1;
1313
- return (allItems || []).find(({
1314
- id: otherId = null
1315
- } = {}) => otherId === itemId) || item_1 || null;
1316
- }).filter(it_2 => it_2 !== null) || [] : []), ...(items || [])], it_3 => it_3?.id);
1317
- }
1318
- return items;
1319
- }, [items, page, allItems, withStickySelection, extraItems, uploadProcessing, hasQueryItem, showTrashed]);
1320
-
1321
- // const emptyWithSticky = useMemo(
1322
- // () => (items || []).length === 0 && (finalItems || []).length > 0,
1323
- // [items, finalItems],
1324
- // );
1325
-
1326
- return /*#__PURE__*/jsx("div", {
1327
- className: className,
1328
- children: currentMedia !== null ? /*#__PURE__*/jsx(MediaForm, {
1636
+ id: t75
1637
+ } = t74;
1638
+ const otherId = t75 === undefined ? null : t75;
1639
+ return otherId === itemId_0;
1640
+ }) || item_1 || null;
1641
+ }).filter(_temp6) || [] : []), ...(items || [])], _temp7) : items;
1642
+ $[105] = allItems;
1643
+ $[106] = extraItems;
1644
+ $[107] = hasQueryItem;
1645
+ $[108] = items;
1646
+ $[109] = page;
1647
+ $[110] = showTrashed;
1648
+ $[111] = uploadProcessing;
1649
+ $[112] = uploadedMedias;
1650
+ $[113] = withStickySelection;
1651
+ $[114] = t72;
1652
+ } else {
1653
+ t72 = $[114];
1654
+ }
1655
+ const finalItems = t72;
1656
+ let t73;
1657
+ if ($[115] !== canUpload || $[116] !== currentMedia || $[117] !== deleting || $[118] !== fields || $[119] !== filters || $[120] !== filtersClassName || $[121] !== finalColumns || $[122] !== finalFilters || $[123] !== finalItems || $[124] !== formChildren || $[125] !== hasLayouts || $[126] !== hidePagination || $[127] !== layout || $[128] !== layouts || $[129] !== loaded || $[130] !== loading || $[131] !== multipleSelection || $[132] !== onClickLayout || $[133] !== onCloseMedia || $[134] !== onDeleteMedia || $[135] !== onOpenMedia || $[136] !== onQueryChange || $[137] !== onQueryReset || $[138] !== onReplaceMedia || $[139] !== onSaveMedia || $[140] !== onSelectionChange || $[141] !== onTrashMedia || $[142] !== onUploadComplete || $[143] !== pagination || $[144] !== query || $[145] !== queryWithoutTypes || $[146] !== selectable || $[147] !== selectedItems || $[148] !== setCurrentMedia || $[149] !== showTrashed || $[150] !== theme || $[151] !== trashing || $[152] !== types || $[153] !== uploadProcessing || $[154] !== uppyConfig || $[155] !== withDelete || $[156] !== withReplace || $[157] !== withTrash) {
1658
+ t73 = currentMedia !== null ? /*#__PURE__*/jsx(MediaForm, {
1329
1659
  value: currentMedia,
1330
1660
  fields: fields,
1331
1661
  onChange: setCurrentMedia,
@@ -1338,75 +1668,62 @@ function MediasBrowser({
1338
1668
  withReplace: withReplace,
1339
1669
  children: formChildren
1340
1670
  }) : /*#__PURE__*/jsxs(Fragment, {
1341
- children: [/*#__PURE__*/jsxs("div", {
1342
- className: "card card-body py-2 mb-3",
1343
- children: [/*#__PURE__*/jsxs("div", {
1344
- className: "row g-2 align-items-center",
1345
- children: [/*#__PURE__*/jsx("div", {
1346
- className: "col-12 col-lg",
1347
- children: filters !== null ? /*#__PURE__*/jsx(Filters, {
1348
- value: query,
1349
- clearValue: types !== null ? queryWithoutTypes : null,
1350
- filters: finalFilters,
1351
- onChange: onQueryChange,
1352
- onClear: onQueryReset
1353
- }) : null
1354
- }), /*#__PURE__*/jsx("div", {
1355
- className: "col-12 col-lg-auto",
1356
- children: /*#__PURE__*/jsxs("div", {
1357
- className: "d-flex flex-wrap gap-2 justify-content-lg-end",
1358
- children: [hasLayouts ? /*#__PURE__*/jsx(Buttons, {
1359
- size: "sm",
1360
- theme: "secondary",
1361
- outline: true,
1362
- items: (layouts || []).map(lay => ({
1363
- ...lay,
1364
- active: layout === lay.id,
1365
- onClick: () => onClickLayout(lay.id),
1366
- className: 'px-3 py-2'
1367
- }))
1368
- }) : null, canUpload ? /*#__PURE__*/jsx(UploadField, {
1369
- className: "w-auto text-nowrap",
1370
- withButton: true,
1371
- withoutMedia: true,
1372
- uppyProps: uppyConfig,
1373
- types: types,
1374
- allowMultipleUploads: true,
1375
- onChange: onUploadComplete,
1376
- disabled: uploadProcessing,
1377
- loading: uploadProcessing,
1378
- outline: false,
1379
- closeAfterFinish: true
1380
- }) : null]
1381
- })
1382
- })]
1383
- }), !hidePagination ? /*#__PURE__*/jsx("div", {
1384
- className: "d-none d-md-flex mt-2 justify-content-end",
1385
- children: pagination
1386
- }) : null]
1387
- }), layout === 'grid' ? /*#__PURE__*/jsx(Grid, {
1671
+ children: [/*#__PURE__*/jsx("div", {
1672
+ className: classNames(["mb-3", filtersClassName]),
1673
+ children: /*#__PURE__*/jsxs("div", {
1674
+ className: "d-flex flex-wrap gap-2 flex-row-reverse justify-content-end",
1675
+ children: [canUpload ? /*#__PURE__*/jsx(UploadField, {
1676
+ withButton: true,
1677
+ withoutMedia: true,
1678
+ className: "w-auto ms-auto",
1679
+ uppyProps: uppyConfig,
1680
+ types: types,
1681
+ allowMultipleUploads: true,
1682
+ onChange: onUploadComplete,
1683
+ disabled: uploadProcessing,
1684
+ loading: uploadProcessing,
1685
+ outline: false,
1686
+ closeAfterFinish: true
1687
+ }) : null, filters !== null ? /*#__PURE__*/jsx(Filters, {
1688
+ value: query,
1689
+ clearValue: types !== null ? queryWithoutTypes : null,
1690
+ filters: finalFilters,
1691
+ onChange: onQueryChange,
1692
+ onClear: onQueryReset,
1693
+ className: "p-0"
1694
+ }) : null]
1695
+ })
1696
+ }), !hidePagination ? /*#__PURE__*/jsxs("div", {
1697
+ className: "d-flex mb-3 justify-content-end",
1698
+ children: [hasLayouts ? /*#__PURE__*/jsx(Buttons, {
1699
+ size: "sm",
1700
+ theme: "secondary",
1701
+ outline: true,
1702
+ className: "me-auto",
1703
+ items: (layouts || []).map(lay => ({
1704
+ ...lay,
1705
+ active: layout === lay.id,
1706
+ onClick: () => onClickLayout(lay.id),
1707
+ className: "px-3"
1708
+ }))
1709
+ }) : null, pagination]
1710
+ }) : null, layout === "grid" ? /*#__PURE__*/jsx(Grid, {
1388
1711
  size: "small",
1389
1712
  component: MediaCard,
1390
1713
  componentProps: {
1391
- className: 'd-flex w-100',
1392
- cardClassName: 'flex-grow-1',
1714
+ className: "d-flex w-100",
1715
+ cardClassName: "flex-grow-1",
1393
1716
  vertical: true,
1394
- onClickDescription: it_4 => {
1395
- onOpenMedia(it_4);
1396
- }
1717
+ onClickDescription: it_4 => onOpenMedia(it_4)
1397
1718
  },
1398
1719
  selectable: selectable && !showTrashed,
1399
1720
  selectedItems: selectedItems,
1400
1721
  onSelectionChange: uploadProcessing ? null : onSelectionChange,
1401
1722
  multipleSelection: multipleSelection,
1402
- query: query // For sort
1403
- ,
1404
- onQueryChange: onQueryChange,
1405
1723
  items: finalItems || [],
1406
1724
  loading: loading,
1407
1725
  loaded: loaded
1408
- // empty={emptyWithSticky}
1409
- }) : null, layout === 'table' ? /*#__PURE__*/jsx(Table, {
1726
+ }) : null, layout === "table" ? /*#__PURE__*/jsx(Table, {
1410
1727
  theme: theme,
1411
1728
  columns: finalColumns,
1412
1729
  displayPlaceholder: /*#__PURE__*/jsx("span", {
@@ -1417,20 +1734,17 @@ function MediasBrowser({
1417
1734
  selectedItems: selectedItems,
1418
1735
  onSelectionChange: uploadProcessing ? null : onSelectionChange,
1419
1736
  multipleSelection: multipleSelection,
1420
- query: query // For sort
1421
- ,
1737
+ query: query,
1422
1738
  onQueryChange: onQueryChange,
1423
1739
  items: finalItems,
1424
1740
  loading: loading,
1425
- loaded: loaded
1426
- // empty={emptyWithSticky}
1427
- ,
1741
+ loaded: loaded,
1428
1742
  actionsProps: {
1429
1743
  getDeletePropsFromValue: () => ({
1430
1744
  href: null,
1431
1745
  withConfirmation: true,
1432
1746
  disabled: trashing || deleting,
1433
- icon: showTrashed ? 'trash-fill' : 'trash',
1747
+ icon: showTrashed ? "trash-fill" : "trash",
1434
1748
  action: ids_0 => onTrashMedia(ids_0[0])
1435
1749
  }),
1436
1750
  getEditPropsFromValue: it_5 => ({
@@ -1441,28 +1755,113 @@ function MediasBrowser({
1441
1755
  })
1442
1756
  }
1443
1757
  }) : null, !hidePagination ? /*#__PURE__*/jsx("div", {
1444
- className: classNames(['d-flex', 'd-md-none', 'mt-3', 'mb-1', 'justify-content-end']),
1758
+ className: classNames(["d-flex", "mt-3", "mb-1", "justify-content-end"]),
1445
1759
  children: pagination
1446
1760
  }) : null]
1447
- })
1448
- });
1761
+ });
1762
+ $[115] = canUpload;
1763
+ $[116] = currentMedia;
1764
+ $[117] = deleting;
1765
+ $[118] = fields;
1766
+ $[119] = filters;
1767
+ $[120] = filtersClassName;
1768
+ $[121] = finalColumns;
1769
+ $[122] = finalFilters;
1770
+ $[123] = finalItems;
1771
+ $[124] = formChildren;
1772
+ $[125] = hasLayouts;
1773
+ $[126] = hidePagination;
1774
+ $[127] = layout;
1775
+ $[128] = layouts;
1776
+ $[129] = loaded;
1777
+ $[130] = loading;
1778
+ $[131] = multipleSelection;
1779
+ $[132] = onClickLayout;
1780
+ $[133] = onCloseMedia;
1781
+ $[134] = onDeleteMedia;
1782
+ $[135] = onOpenMedia;
1783
+ $[136] = onQueryChange;
1784
+ $[137] = onQueryReset;
1785
+ $[138] = onReplaceMedia;
1786
+ $[139] = onSaveMedia;
1787
+ $[140] = onSelectionChange;
1788
+ $[141] = onTrashMedia;
1789
+ $[142] = onUploadComplete;
1790
+ $[143] = pagination;
1791
+ $[144] = query;
1792
+ $[145] = queryWithoutTypes;
1793
+ $[146] = selectable;
1794
+ $[147] = selectedItems;
1795
+ $[148] = setCurrentMedia;
1796
+ $[149] = showTrashed;
1797
+ $[150] = theme;
1798
+ $[151] = trashing;
1799
+ $[152] = types;
1800
+ $[153] = uploadProcessing;
1801
+ $[154] = uppyConfig;
1802
+ $[155] = withDelete;
1803
+ $[156] = withReplace;
1804
+ $[157] = withTrash;
1805
+ $[158] = t73;
1806
+ } else {
1807
+ t73 = $[158];
1808
+ }
1809
+ let t74;
1810
+ if ($[159] !== className || $[160] !== t73) {
1811
+ t74 = /*#__PURE__*/jsx("div", {
1812
+ className: className,
1813
+ children: t73
1814
+ });
1815
+ $[159] = className;
1816
+ $[160] = t73;
1817
+ $[161] = t74;
1818
+ } else {
1819
+ t74 = $[161];
1820
+ }
1821
+ return t74;
1822
+ }
1823
+ function _temp7(it_3) {
1824
+ return it_3?.id;
1825
+ }
1826
+ function _temp6(it_2) {
1827
+ return it_2 !== null;
1828
+ }
1829
+ function _temp5(act_1) {
1830
+ return act_1 !== null;
1831
+ }
1832
+ function _temp4(it_1) {
1833
+ return it_1 !== "edit";
1834
+ }
1835
+ function _temp3(filter) {
1836
+ const {
1837
+ id: t0
1838
+ } = filter || {};
1839
+ const id_0 = t0 === undefined ? null : t0;
1840
+ return id_0 === "types" ? {
1841
+ ...filter,
1842
+ disabled: true
1843
+ } : filter;
1844
+ }
1845
+ function _temp2(it_0) {
1846
+ return it_0 !== null;
1847
+ }
1848
+ function _temp(it) {
1849
+ return it !== null;
1449
1850
  }
1450
1851
 
1451
1852
  function MediasPicker(t0) {
1452
- const $ = c(16);
1853
+ const $ = c(12);
1453
1854
  let onChange;
1454
1855
  let props;
1455
1856
  let t1;
1456
1857
  let t2;
1457
1858
  let t3;
1458
- let t4;
1459
1859
  if ($[0] !== t0) {
1460
1860
  ({
1461
1861
  items: t1,
1462
1862
  value: t2,
1463
1863
  onChange,
1464
1864
  multiple: t3,
1465
- className: t4,
1466
1865
  ...props
1467
1866
  } = t0);
1468
1867
  $[0] = t0;
@@ -1471,22 +1870,19 @@ function MediasPicker(t0) {
1471
1870
  $[3] = t1;
1472
1871
  $[4] = t2;
1473
1872
  $[5] = t3;
1474
- $[6] = t4;
1475
1873
  } else {
1476
1874
  onChange = $[1];
1477
1875
  props = $[2];
1478
1876
  t1 = $[3];
1479
1877
  t2 = $[4];
1480
1878
  t3 = $[5];
1481
- t4 = $[6];
1482
1879
  }
1483
1880
  const initialItems = t1 === undefined ? null : t1;
1484
1881
  const initialSelectedItems = t2 === undefined ? null : t2;
1485
1882
  const multiple = t3 === undefined ? false : t3;
1486
- const className = t4 === undefined ? null : t4;
1487
- let t5;
1488
- if ($[7] !== initialItems || $[8] !== initialSelectedItems || $[9] !== multiple || $[10] !== onChange || $[11] !== props) {
1489
- t5 = /*#__PURE__*/jsx(MediasBrowser, {
1883
+ let t4;
1884
+ if ($[6] !== initialItems || $[7] !== initialSelectedItems || $[8] !== multiple || $[9] !== onChange || $[10] !== props) {
1885
+ t4 = /*#__PURE__*/jsx(MediasBrowser, {
1490
1886
  items: initialItems,
1491
1887
  selectable: true,
1492
1888
  selectedItems: initialSelectedItems,
@@ -1495,28 +1891,16 @@ function MediasPicker(t0) {
1495
1891
  extraItems: initialSelectedItems,
1496
1892
  ...props
1497
1893
  });
1498
- $[7] = initialItems;
1499
- $[8] = initialSelectedItems;
1500
- $[9] = multiple;
1501
- $[10] = onChange;
1502
- $[11] = props;
1503
- $[12] = t5;
1504
- } else {
1505
- t5 = $[12];
1506
- }
1507
- let t6;
1508
- if ($[13] !== className || $[14] !== t5) {
1509
- t6 = /*#__PURE__*/jsx("div", {
1510
- className: className,
1511
- children: t5
1512
- });
1513
- $[13] = className;
1514
- $[14] = t5;
1515
- $[15] = t6;
1894
+ $[6] = initialItems;
1895
+ $[7] = initialSelectedItems;
1896
+ $[8] = multiple;
1897
+ $[9] = onChange;
1898
+ $[10] = props;
1899
+ $[11] = t4;
1516
1900
  } else {
1517
- t6 = $[15];
1901
+ t4 = $[11];
1518
1902
  }
1519
- return t6;
1903
+ return t4;
1520
1904
  }
1521
1905
 
1522
1906
  function MediasBrowserContainer(t0) {
@@ -1579,73 +1963,66 @@ function MediasBrowserContainer(t0) {
1579
1963
  }
1580
1964
 
1581
1965
  function MediasPickerContainer(t0) {
1582
- const $ = c(14);
1966
+ const $ = c(12);
1583
1967
  let props;
1584
1968
  let t1;
1585
1969
  let t2;
1586
- let t3;
1587
1970
  if ($[0] !== t0) {
1588
1971
  ({
1589
1972
  api: t1,
1590
1973
  media: t2,
1591
- onChange: t3,
1592
1974
  ...props
1593
1975
  } = t0);
1594
1976
  $[0] = t0;
1595
1977
  $[1] = props;
1596
1978
  $[2] = t1;
1597
1979
  $[3] = t2;
1598
- $[4] = t3;
1599
1980
  } else {
1600
1981
  props = $[1];
1601
1982
  t1 = $[2];
1602
1983
  t2 = $[3];
1603
- t3 = $[4];
1604
1984
  }
1605
1985
  const api = t1 === undefined ? null : t1;
1606
1986
  const media = t2 === undefined ? null : t2;
1607
- const onChange = t3 === undefined ? null : t3;
1608
- let t4;
1609
- if ($[5] !== onChange || $[6] !== props) {
1610
- t4 = /*#__PURE__*/jsx(MediasPicker, {
1611
- ...props,
1612
- onChange: onChange
1987
+ let t3;
1988
+ if ($[4] !== props) {
1989
+ t3 = /*#__PURE__*/jsx(MediasPicker, {
1990
+ ...props
1613
1991
  });
1614
- $[5] = onChange;
1615
- $[6] = props;
1616
- $[7] = t4;
1992
+ $[4] = props;
1993
+ $[5] = t3;
1617
1994
  } else {
1618
- t4 = $[7];
1995
+ t3 = $[5];
1619
1996
  }
1620
- let t5;
1621
- if ($[8] !== media || $[9] !== t4) {
1622
- t5 = /*#__PURE__*/jsx(MediaProvider, {
1997
+ let t4;
1998
+ if ($[6] !== media || $[7] !== t3) {
1999
+ t4 = /*#__PURE__*/jsx(MediaProvider, {
1623
2000
  media: media,
1624
- children: t4
2001
+ children: t3
1625
2002
  });
1626
- $[8] = media;
1627
- $[9] = t4;
1628
- $[10] = t5;
2003
+ $[6] = media;
2004
+ $[7] = t3;
2005
+ $[8] = t4;
1629
2006
  } else {
1630
- t5 = $[10];
2007
+ t4 = $[8];
1631
2008
  }
1632
- let t6;
1633
- if ($[11] !== api || $[12] !== t5) {
1634
- t6 = /*#__PURE__*/jsx(MediasApiProvider, {
2009
+ let t5;
2010
+ if ($[9] !== api || $[10] !== t4) {
2011
+ t5 = /*#__PURE__*/jsx(MediasApiProvider, {
1635
2012
  api: api,
1636
- children: t5
2013
+ children: t4
1637
2014
  });
1638
- $[11] = api;
1639
- $[12] = t5;
1640
- $[13] = t6;
2015
+ $[9] = api;
2016
+ $[10] = t4;
2017
+ $[11] = t5;
1641
2018
  } else {
1642
- t6 = $[13];
2019
+ t5 = $[11];
1643
2020
  }
1644
- return t6;
2021
+ return t5;
1645
2022
  }
1646
2023
 
1647
2024
  function MediasResourceBrowser(t0) {
1648
- const $ = c(9);
2025
+ const $ = c(22);
1649
2026
  let props;
1650
2027
  let t1;
1651
2028
  if ($[0] !== t0) {
@@ -1662,59 +2039,123 @@ function MediasResourceBrowser(t0) {
1662
2039
  }
1663
2040
  const resourceId = t1 === undefined ? "medias" : t1;
1664
2041
  const resource = usePanneauResource(resourceId);
1665
- const api = useApi();
1666
2042
  let t2;
1667
- if ($[3] !== api || $[4] !== resource) {
1668
- t2 = {
1669
- get: (...t3) => {
1670
- const args = t3;
2043
+ if ($[3] !== resource) {
2044
+ t2 = resource || {};
2045
+ $[3] = resource;
2046
+ $[4] = t2;
2047
+ } else {
2048
+ t2 = $[4];
2049
+ }
2050
+ const {
2051
+ index: t3,
2052
+ fields: t4
2053
+ } = t2;
2054
+ const index = t3 === undefined ? null : t3;
2055
+ const fields = t4 === undefined ? null : t4;
2056
+ let t5;
2057
+ if ($[5] !== index) {
2058
+ t5 = index || {};
2059
+ $[5] = index;
2060
+ $[6] = t5;
2061
+ } else {
2062
+ t5 = $[6];
2063
+ }
2064
+ const {
2065
+ filters: t6,
2066
+ columns: t7
2067
+ } = t5;
2068
+ const filters = t6 === undefined ? null : t6;
2069
+ const columns = t7 === undefined ? null : t7;
2070
+ const api = useApi();
2071
+ let t8;
2072
+ if ($[7] !== api || $[8] !== resource) {
2073
+ t8 = {
2074
+ get: (...t9) => {
2075
+ const args = t9;
1671
2076
  return api.resources.get(resource, ...args);
1672
2077
  },
1673
- getTrashed: (...t4) => {
1674
- const args_0 = t4;
2078
+ getTrashed: (...t10) => {
2079
+ const args_0 = t10;
1675
2080
  return api.resources.getTrashed(resource, ...args_0);
1676
2081
  },
1677
- find: (...t5) => {
1678
- const args_1 = t5;
2082
+ find: (...t11) => {
2083
+ const args_1 = t11;
1679
2084
  return api.resources.find(resource, ...args_1);
1680
2085
  },
1681
- create: (...t6) => {
1682
- const args_2 = t6;
2086
+ create: (...t12) => {
2087
+ const args_2 = t12;
1683
2088
  return api.resources.store(resource, ...args_2);
1684
2089
  },
1685
- update: (...t7) => {
1686
- const args_3 = t7;
2090
+ update: (...t13) => {
2091
+ const args_3 = t13;
1687
2092
  return api.resources.update(resource, ...args_3);
1688
2093
  },
1689
- trash: (...t8) => {
1690
- const args_4 = t8;
2094
+ trash: (...t14) => {
2095
+ const args_4 = t14;
1691
2096
  return api.resources.trash(resource, ...args_4);
1692
2097
  },
1693
- delete: (...t9) => {
1694
- const args_5 = t9;
2098
+ delete: (...t15) => {
2099
+ const args_5 = t15;
1695
2100
  return api.resources.destroy(resource, ...args_5);
1696
2101
  }
1697
2102
  };
1698
- $[3] = api;
1699
- $[4] = resource;
1700
- $[5] = t2;
2103
+ $[7] = api;
2104
+ $[8] = resource;
2105
+ $[9] = t8;
1701
2106
  } else {
1702
- t2 = $[5];
2107
+ t8 = $[9];
1703
2108
  }
1704
- const mediasApi = t2;
1705
- let t3;
1706
- if ($[6] !== mediasApi || $[7] !== props) {
1707
- t3 = /*#__PURE__*/jsx(MediasBrowserContainer, {
2109
+ const mediasApi = t8;
2110
+ let t9;
2111
+ if ($[10] !== filters) {
2112
+ t9 = filters !== null ? {
2113
+ filters
2114
+ } : null;
2115
+ $[10] = filters;
2116
+ $[11] = t9;
2117
+ } else {
2118
+ t9 = $[11];
2119
+ }
2120
+ let t10;
2121
+ if ($[12] !== fields) {
2122
+ t10 = fields !== null ? {
2123
+ fields
2124
+ } : null;
2125
+ $[12] = fields;
2126
+ $[13] = t10;
2127
+ } else {
2128
+ t10 = $[13];
2129
+ }
2130
+ let t11;
2131
+ if ($[14] !== columns) {
2132
+ t11 = columns !== null ? {
2133
+ columns
2134
+ } : null;
2135
+ $[14] = columns;
2136
+ $[15] = t11;
2137
+ } else {
2138
+ t11 = $[15];
2139
+ }
2140
+ let t12;
2141
+ if ($[16] !== mediasApi || $[17] !== props || $[18] !== t10 || $[19] !== t11 || $[20] !== t9) {
2142
+ t12 = /*#__PURE__*/jsx(MediasBrowserContainer, {
1708
2143
  api: mediasApi,
2144
+ ...t9,
2145
+ ...t10,
2146
+ ...t11,
1709
2147
  ...props
1710
2148
  });
1711
- $[6] = mediasApi;
1712
- $[7] = props;
1713
- $[8] = t3;
2149
+ $[16] = mediasApi;
2150
+ $[17] = props;
2151
+ $[18] = t10;
2152
+ $[19] = t11;
2153
+ $[20] = t9;
2154
+ $[21] = t12;
1714
2155
  } else {
1715
- t3 = $[8];
2156
+ t12 = $[21];
1716
2157
  }
1717
- return t3;
2158
+ return t12;
1718
2159
  }
1719
2160
 
1720
2161
  function MediasResourcePicker(t0) {