@panneau/medias 3.0.162 → 3.0.164
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/es/index.js +156 -93
- package/lib/index.js +156 -93
- package/package.json +17 -17
package/es/index.js
CHANGED
@@ -32,9 +32,11 @@ var useMediasApi = function useMediasApi() {
|
|
32
32
|
};
|
33
33
|
var apiPropTypes = PropTypes.shape({
|
34
34
|
get: PropTypes.func.isRequired,
|
35
|
+
getTrashed: PropTypes.func.isRequired,
|
35
36
|
create: PropTypes.func.isRequired,
|
36
37
|
find: PropTypes.func.isRequired,
|
37
38
|
update: PropTypes.func.isRequired,
|
39
|
+
trash: PropTypes.func.isRequired,
|
38
40
|
"delete": PropTypes.func.isRequired
|
39
41
|
});
|
40
42
|
var propTypes$9 = {
|
@@ -255,89 +257,97 @@ var defaultFields = [{
|
|
255
257
|
}),
|
256
258
|
type: 'text',
|
257
259
|
component: 'text'
|
258
|
-
},
|
259
|
-
|
260
|
+
},
|
261
|
+
// {
|
262
|
+
// id: 'info',
|
263
|
+
// component: 'fields',
|
264
|
+
// title: <FormattedMessage defaultMessage="Informations" description="Field title" />,
|
265
|
+
// isList: true,
|
266
|
+
// horizontal: true,
|
267
|
+
// fields: [
|
268
|
+
// {
|
269
|
+
// id: 'user',
|
270
|
+
// label: <FormattedMessage defaultMessage="Added by" description="Field label" />,
|
271
|
+
// type: 'display',
|
272
|
+
// display: 'avatar',
|
273
|
+
// name: 'user',
|
274
|
+
// },
|
275
|
+
// {
|
276
|
+
// id: 'created_at',
|
277
|
+
// label: <FormattedMessage defaultMessage="Created at" description="Field label" />,
|
278
|
+
// type: 'display',
|
279
|
+
// display: 'date',
|
280
|
+
// name: 'created_at',
|
281
|
+
// format: 'yyyy-MM-dd hh:ss',
|
282
|
+
// },
|
283
|
+
// ],
|
284
|
+
// },
|
285
|
+
{
|
286
|
+
id: 'technical',
|
260
287
|
component: 'fields',
|
261
288
|
title: /*#__PURE__*/React.createElement(FormattedMessage, {
|
262
|
-
id: "
|
289
|
+
id: "xKUOLG",
|
263
290
|
defaultMessage: [{
|
264
291
|
"type": 0,
|
265
|
-
"value": "
|
292
|
+
"value": "Technical details"
|
266
293
|
}]
|
267
294
|
}),
|
295
|
+
isList: true,
|
296
|
+
horizontal: true,
|
268
297
|
fields: [{
|
269
|
-
id: '
|
298
|
+
id: 'format',
|
270
299
|
label: /*#__PURE__*/React.createElement(FormattedMessage, {
|
271
|
-
id: "
|
300
|
+
id: "JuxiUN",
|
272
301
|
defaultMessage: [{
|
273
302
|
"type": 0,
|
274
|
-
"value": "
|
303
|
+
"value": "Format"
|
275
304
|
}]
|
276
305
|
}),
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
306
|
+
type: 'display',
|
307
|
+
display: 'unit',
|
308
|
+
format: 'format',
|
309
|
+
name: 'format'
|
281
310
|
}, {
|
282
|
-
id: '
|
311
|
+
id: 'dimensions',
|
283
312
|
label: /*#__PURE__*/React.createElement(FormattedMessage, {
|
284
|
-
id: "
|
313
|
+
id: "rmJBin",
|
285
314
|
defaultMessage: [{
|
286
315
|
"type": 0,
|
287
|
-
"value": "
|
316
|
+
"value": "Dimensions"
|
288
317
|
}]
|
289
318
|
}),
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
319
|
+
type: 'display',
|
320
|
+
display: 'unit',
|
321
|
+
format: 'dimensions',
|
322
|
+
name: 'metadata'
|
323
|
+
}, {
|
324
|
+
id: 'size',
|
325
|
+
label: /*#__PURE__*/React.createElement(FormattedMessage, {
|
326
|
+
id: "g2CRt5",
|
327
|
+
defaultMessage: [{
|
328
|
+
"type": 0,
|
329
|
+
"value": "Size"
|
330
|
+
}]
|
331
|
+
}),
|
332
|
+
type: 'display',
|
333
|
+
display: 'unit',
|
334
|
+
format: 'bytes',
|
335
|
+
name: 'metadata.size'
|
336
|
+
}, {
|
337
|
+
id: 'duration',
|
338
|
+
label: /*#__PURE__*/React.createElement(FormattedMessage, {
|
339
|
+
id: "wU++NJ",
|
340
|
+
defaultMessage: [{
|
341
|
+
"type": 0,
|
342
|
+
"value": "Duration"
|
343
|
+
}]
|
344
|
+
}),
|
345
|
+
type: 'display',
|
346
|
+
display: 'unit',
|
347
|
+
format: 'duration',
|
348
|
+
name: 'metadata.duration'
|
295
349
|
}]
|
296
|
-
}
|
297
|
-
// {
|
298
|
-
// id: 'technical',
|
299
|
-
// component: 'fields',
|
300
|
-
// title: <FormattedMessage defaultMessage="Technical details" description="Field title" />,
|
301
|
-
// fields: [
|
302
|
-
// {
|
303
|
-
// id: 'format',
|
304
|
-
// label: <FormattedMessage defaultMessage="Format" description="Field label" />,
|
305
|
-
// type: 'display',
|
306
|
-
// component: 'unit',
|
307
|
-
// format: 'format',
|
308
|
-
// path: 'format',
|
309
|
-
// section: 'technical',
|
310
|
-
// },
|
311
|
-
// {
|
312
|
-
// id: 'dimensions',
|
313
|
-
// label: <FormattedMessage defaultMessage="Dimensions" description="Field label" />,
|
314
|
-
// type: 'display',
|
315
|
-
// component: 'unit',
|
316
|
-
// format: 'dimensions',
|
317
|
-
// path: 'metadata',
|
318
|
-
// section: 'technical',
|
319
|
-
// },
|
320
|
-
// {
|
321
|
-
// id: 'size',
|
322
|
-
// label: <FormattedMessage defaultMessage="Size" description="Field label" />,
|
323
|
-
// type: 'display',
|
324
|
-
// component: 'unit',
|
325
|
-
// format: 'bytes',
|
326
|
-
// path: 'metadata.size',
|
327
|
-
// section: 'technical',
|
328
|
-
// },
|
329
|
-
// {
|
330
|
-
// id: 'duration',
|
331
|
-
// label: <FormattedMessage defaultMessage="Duration" description="Field label" />,
|
332
|
-
// type: 'display',
|
333
|
-
// component: 'unit',
|
334
|
-
// format: 'duration',
|
335
|
-
// path: 'metadata.duration',
|
336
|
-
// section: 'technical',
|
337
|
-
// },
|
338
|
-
// ],
|
339
|
-
// },
|
340
|
-
];
|
350
|
+
}];
|
341
351
|
|
342
352
|
var propTypes$7 = {
|
343
353
|
value: PropTypes.shape({
|
@@ -346,8 +356,8 @@ var propTypes$7 = {
|
|
346
356
|
fields: PropTypes.arrayOf(PropTypes.shape({
|
347
357
|
name: PropTypes.string
|
348
358
|
})),
|
349
|
-
onChange: PropTypes.func
|
350
|
-
onSave: PropTypes.func
|
359
|
+
onChange: PropTypes.func,
|
360
|
+
onSave: PropTypes.func,
|
351
361
|
onDelete: PropTypes.func,
|
352
362
|
onClose: PropTypes.func,
|
353
363
|
className: PropTypes.string,
|
@@ -356,8 +366,10 @@ var propTypes$7 = {
|
|
356
366
|
var defaultProps$7 = {
|
357
367
|
value: null,
|
358
368
|
fields: defaultFields,
|
359
|
-
|
369
|
+
onChange: null,
|
370
|
+
onSave: null,
|
360
371
|
onDelete: null,
|
372
|
+
onClose: null,
|
361
373
|
className: null,
|
362
374
|
children: null
|
363
375
|
};
|
@@ -405,13 +417,13 @@ function MediaForm(_ref) {
|
|
405
417
|
_ref3$id = _ref3.id,
|
406
418
|
id = _ref3$id === void 0 ? null : _ref3$id;
|
407
419
|
destroy(id, initialValue).then(function () {
|
408
|
-
if (onClose !== null) {
|
409
|
-
onClose();
|
410
|
-
}
|
411
420
|
if (onDelete !== null) {
|
412
421
|
onDelete();
|
413
422
|
}
|
414
423
|
setChanged(false);
|
424
|
+
if (onClose !== null) {
|
425
|
+
onClose();
|
426
|
+
}
|
415
427
|
});
|
416
428
|
}, [initialValue, destroy, destroying, setChanged]);
|
417
429
|
var postForm = useCallback(function (action, data) {
|
@@ -433,16 +445,16 @@ function MediaForm(_ref) {
|
|
433
445
|
generalError = _useForm.generalError;
|
434
446
|
return /*#__PURE__*/React.createElement("div", {
|
435
447
|
className: classNames(['text-body', _defineProperty({}, className, className !== null)])
|
448
|
+
}, /*#__PURE__*/React.createElement("nav", {
|
449
|
+
className: "navbar d-flex w-100 align-items-end justify-content-between border-bottom mb-3"
|
436
450
|
}, /*#__PURE__*/React.createElement("div", {
|
437
|
-
className: "d-flex
|
438
|
-
}, /*#__PURE__*/React.createElement("div", {
|
439
|
-
className: "d-flex align-items-end justify-content-end mb-0"
|
451
|
+
className: "d-flex align-items-end justify-content-end mb-1"
|
440
452
|
}, /*#__PURE__*/React.createElement("h4", {
|
441
453
|
className: "d-inline text-break mb-0"
|
442
454
|
}, name), /*#__PURE__*/React.createElement("span", {
|
443
455
|
className: "mx-2"
|
444
456
|
}, type)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
|
445
|
-
className: "me-2 mb-1",
|
457
|
+
className: "me-2 mb-1 mt-1",
|
446
458
|
theme: "danger",
|
447
459
|
onClick: onDeleteMedia,
|
448
460
|
disabled: destroying
|
@@ -453,7 +465,7 @@ function MediaForm(_ref) {
|
|
453
465
|
"value": "Delete"
|
454
466
|
}]
|
455
467
|
})), onSave !== null ? /*#__PURE__*/React.createElement(Button, {
|
456
|
-
className: "mb-1",
|
468
|
+
className: "mb-1 mt-1",
|
457
469
|
theme: "primary",
|
458
470
|
onClick: onSubmit,
|
459
471
|
disabled: !changed || updating || destroying
|
@@ -895,6 +907,10 @@ function MediasBrowser(_ref) {
|
|
895
907
|
onSelectItems(media);
|
896
908
|
onQueryReset();
|
897
909
|
}, [setCurrentMedia, onQueryReset, onSelectItems]);
|
910
|
+
var onSaveMedia = useCallback(function () {
|
911
|
+
setCurrentMedia(null);
|
912
|
+
onQueryReset();
|
913
|
+
}, [setCurrentMedia, onQueryReset]);
|
898
914
|
var pagination = /*#__PURE__*/React.createElement(Pagination, {
|
899
915
|
page: page,
|
900
916
|
lastPage: lastPage,
|
@@ -940,6 +956,8 @@ function MediasBrowser(_ref) {
|
|
940
956
|
}))), /*#__PURE__*/React.createElement(MediaForm, {
|
941
957
|
value: currentMedia,
|
942
958
|
fields: fields,
|
959
|
+
onChange: setCurrentMedia,
|
960
|
+
onSave: onSaveMedia,
|
943
961
|
onClose: onCloseMedia
|
944
962
|
})) : /*#__PURE__*/React.createElement(React.Fragment, null, buttons !== null ? /*#__PURE__*/React.createElement(Buttons, {
|
945
963
|
items: buttons,
|
@@ -992,6 +1010,7 @@ function MediasBrowser(_ref) {
|
|
992
1010
|
}
|
993
1011
|
}, tableProps, {
|
994
1012
|
items: items || [],
|
1013
|
+
loading: loading,
|
995
1014
|
onSelectItem: onSelectItem !== null ? onSelectItem : function (it) {
|
996
1015
|
return onOpenMedia(it);
|
997
1016
|
}
|
@@ -1003,6 +1022,7 @@ function MediasBrowser(_ref) {
|
|
1003
1022
|
}, "\u2014")
|
1004
1023
|
}, tableProps, {
|
1005
1024
|
items: items,
|
1025
|
+
loading: loading,
|
1006
1026
|
onSelectItem: onSelectItem !== null ? onSelectItem : function (it) {
|
1007
1027
|
return onOpenMedia(it);
|
1008
1028
|
},
|
@@ -1226,33 +1246,47 @@ function MediasResourceBrowser(_ref) {
|
|
1226
1246
|
}
|
1227
1247
|
return (_api$resources = api.resources).get.apply(_api$resources, [resource].concat(args));
|
1228
1248
|
},
|
1229
|
-
|
1249
|
+
getTrashed: function getTrashed() {
|
1230
1250
|
var _api$resources2;
|
1231
1251
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
1232
1252
|
args[_key2] = arguments[_key2];
|
1233
1253
|
}
|
1234
|
-
return (_api$resources2 = api.resources).
|
1254
|
+
return (_api$resources2 = api.resources).getTrashed.apply(_api$resources2, [resource].concat(args));
|
1235
1255
|
},
|
1236
|
-
|
1256
|
+
find: function find() {
|
1237
1257
|
var _api$resources3;
|
1238
1258
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
1239
1259
|
args[_key3] = arguments[_key3];
|
1240
1260
|
}
|
1241
|
-
return (_api$resources3 = api.resources).
|
1261
|
+
return (_api$resources3 = api.resources).find.apply(_api$resources3, [resource].concat(args));
|
1242
1262
|
},
|
1243
|
-
|
1263
|
+
create: function create() {
|
1244
1264
|
var _api$resources4;
|
1245
1265
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
1246
1266
|
args[_key4] = arguments[_key4];
|
1247
1267
|
}
|
1248
|
-
return (_api$resources4 = api.resources).
|
1268
|
+
return (_api$resources4 = api.resources).create.apply(_api$resources4, [resource].concat(args));
|
1249
1269
|
},
|
1250
|
-
|
1270
|
+
update: function update() {
|
1251
1271
|
var _api$resources5;
|
1252
1272
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
1253
1273
|
args[_key5] = arguments[_key5];
|
1254
1274
|
}
|
1255
|
-
return (_api$resources5 = api.resources)
|
1275
|
+
return (_api$resources5 = api.resources).update.apply(_api$resources5, [resource].concat(args));
|
1276
|
+
},
|
1277
|
+
trash: function trash() {
|
1278
|
+
var _api$resources6;
|
1279
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
1280
|
+
args[_key6] = arguments[_key6];
|
1281
|
+
}
|
1282
|
+
return (_api$resources6 = api.resources).trash.apply(_api$resources6, [resource].concat(args));
|
1283
|
+
},
|
1284
|
+
"delete": function _delete() {
|
1285
|
+
var _api$resources7;
|
1286
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
1287
|
+
args[_key7] = arguments[_key7];
|
1288
|
+
}
|
1289
|
+
return (_api$resources7 = api.resources)["delete"].apply(_api$resources7, [resource].concat(args));
|
1256
1290
|
}
|
1257
1291
|
};
|
1258
1292
|
}, [api, resource]);
|
@@ -1274,7 +1308,16 @@ function MediasResourcePicker(_ref) {
|
|
1274
1308
|
var resourceId = _ref.resource,
|
1275
1309
|
props = _objectWithoutProperties(_ref, _excluded);
|
1276
1310
|
var resource = usePanneauResource(resourceId);
|
1277
|
-
|
1311
|
+
var _ref2 = resource || {},
|
1312
|
+
_ref2$index = _ref2.index,
|
1313
|
+
index = _ref2$index === void 0 ? null : _ref2$index,
|
1314
|
+
_ref2$fields = _ref2.fields,
|
1315
|
+
fields = _ref2$fields === void 0 ? null : _ref2$fields;
|
1316
|
+
var _ref3 = index || {},
|
1317
|
+
_ref3$filters = _ref3.filters,
|
1318
|
+
filters = _ref3$filters === void 0 ? null : _ref3$filters,
|
1319
|
+
_ref3$columns = _ref3.columns,
|
1320
|
+
columns = _ref3$columns === void 0 ? null : _ref3$columns;
|
1278
1321
|
var api = useApi();
|
1279
1322
|
var mediasApi = useMemo(function () {
|
1280
1323
|
return {
|
@@ -1285,39 +1328,59 @@ function MediasResourcePicker(_ref) {
|
|
1285
1328
|
}
|
1286
1329
|
return (_api$resources = api.resources).get.apply(_api$resources, [resource].concat(args));
|
1287
1330
|
},
|
1288
|
-
|
1331
|
+
getTrashed: function getTrashed() {
|
1289
1332
|
var _api$resources2;
|
1290
1333
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
1291
1334
|
args[_key2] = arguments[_key2];
|
1292
1335
|
}
|
1293
|
-
return (_api$resources2 = api.resources).
|
1336
|
+
return (_api$resources2 = api.resources).getTrashed.apply(_api$resources2, [resource].concat(args));
|
1294
1337
|
},
|
1295
|
-
|
1338
|
+
find: function find() {
|
1296
1339
|
var _api$resources3;
|
1297
1340
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
1298
1341
|
args[_key3] = arguments[_key3];
|
1299
1342
|
}
|
1300
|
-
return (_api$resources3 = api.resources).
|
1343
|
+
return (_api$resources3 = api.resources).find.apply(_api$resources3, [resource].concat(args));
|
1301
1344
|
},
|
1302
|
-
|
1345
|
+
create: function create() {
|
1303
1346
|
var _api$resources4;
|
1304
1347
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
1305
1348
|
args[_key4] = arguments[_key4];
|
1306
1349
|
}
|
1307
|
-
return (_api$resources4 = api.resources).
|
1350
|
+
return (_api$resources4 = api.resources).create.apply(_api$resources4, [resource].concat(args));
|
1308
1351
|
},
|
1309
|
-
|
1352
|
+
update: function update() {
|
1310
1353
|
var _api$resources5;
|
1311
1354
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
1312
1355
|
args[_key5] = arguments[_key5];
|
1313
1356
|
}
|
1314
|
-
return (_api$resources5 = api.resources)
|
1357
|
+
return (_api$resources5 = api.resources).update.apply(_api$resources5, [resource].concat(args));
|
1358
|
+
},
|
1359
|
+
trash: function trash() {
|
1360
|
+
var _api$resources6;
|
1361
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
1362
|
+
args[_key6] = arguments[_key6];
|
1363
|
+
}
|
1364
|
+
return (_api$resources6 = api.resources).trash.apply(_api$resources6, [resource].concat(args));
|
1365
|
+
},
|
1366
|
+
"delete": function _delete() {
|
1367
|
+
var _api$resources7;
|
1368
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
1369
|
+
args[_key7] = arguments[_key7];
|
1370
|
+
}
|
1371
|
+
return (_api$resources7 = api.resources)["delete"].apply(_api$resources7, [resource].concat(args));
|
1315
1372
|
}
|
1316
1373
|
};
|
1317
1374
|
}, [api, resource]);
|
1318
1375
|
return /*#__PURE__*/React.createElement(MediasPickerContainer, Object.assign({
|
1319
1376
|
api: mediasApi
|
1320
|
-
},
|
1377
|
+
}, filters !== null ? {
|
1378
|
+
filters: filters
|
1379
|
+
} : null, fields !== null ? {
|
1380
|
+
fields: fields
|
1381
|
+
} : null, columns !== null ? {
|
1382
|
+
columns: columns
|
1383
|
+
} : null, props));
|
1321
1384
|
}
|
1322
1385
|
MediasResourcePicker.propTypes = propTypes;
|
1323
1386
|
MediasResourcePicker.defaultProps = defaultProps;
|
package/lib/index.js
CHANGED
@@ -34,9 +34,11 @@ var useMediasApi = function useMediasApi() {
|
|
34
34
|
};
|
35
35
|
var apiPropTypes = PropTypes.shape({
|
36
36
|
get: PropTypes.func.isRequired,
|
37
|
+
getTrashed: PropTypes.func.isRequired,
|
37
38
|
create: PropTypes.func.isRequired,
|
38
39
|
find: PropTypes.func.isRequired,
|
39
40
|
update: PropTypes.func.isRequired,
|
41
|
+
trash: PropTypes.func.isRequired,
|
40
42
|
"delete": PropTypes.func.isRequired
|
41
43
|
});
|
42
44
|
var propTypes$9 = {
|
@@ -257,89 +259,97 @@ var defaultFields = [{
|
|
257
259
|
}),
|
258
260
|
type: 'text',
|
259
261
|
component: 'text'
|
260
|
-
},
|
261
|
-
|
262
|
+
},
|
263
|
+
// {
|
264
|
+
// id: 'info',
|
265
|
+
// component: 'fields',
|
266
|
+
// title: <FormattedMessage defaultMessage="Informations" description="Field title" />,
|
267
|
+
// isList: true,
|
268
|
+
// horizontal: true,
|
269
|
+
// fields: [
|
270
|
+
// {
|
271
|
+
// id: 'user',
|
272
|
+
// label: <FormattedMessage defaultMessage="Added by" description="Field label" />,
|
273
|
+
// type: 'display',
|
274
|
+
// display: 'avatar',
|
275
|
+
// name: 'user',
|
276
|
+
// },
|
277
|
+
// {
|
278
|
+
// id: 'created_at',
|
279
|
+
// label: <FormattedMessage defaultMessage="Created at" description="Field label" />,
|
280
|
+
// type: 'display',
|
281
|
+
// display: 'date',
|
282
|
+
// name: 'created_at',
|
283
|
+
// format: 'yyyy-MM-dd hh:ss',
|
284
|
+
// },
|
285
|
+
// ],
|
286
|
+
// },
|
287
|
+
{
|
288
|
+
id: 'technical',
|
262
289
|
component: 'fields',
|
263
290
|
title: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
264
|
-
id: "
|
291
|
+
id: "xKUOLG",
|
265
292
|
defaultMessage: [{
|
266
293
|
"type": 0,
|
267
|
-
"value": "
|
294
|
+
"value": "Technical details"
|
268
295
|
}]
|
269
296
|
}),
|
297
|
+
isList: true,
|
298
|
+
horizontal: true,
|
270
299
|
fields: [{
|
271
|
-
id: '
|
300
|
+
id: 'format',
|
272
301
|
label: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
273
|
-
id: "
|
302
|
+
id: "JuxiUN",
|
274
303
|
defaultMessage: [{
|
275
304
|
"type": 0,
|
276
|
-
"value": "
|
305
|
+
"value": "Format"
|
277
306
|
}]
|
278
307
|
}),
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
308
|
+
type: 'display',
|
309
|
+
display: 'unit',
|
310
|
+
format: 'format',
|
311
|
+
name: 'format'
|
283
312
|
}, {
|
284
|
-
id: '
|
313
|
+
id: 'dimensions',
|
285
314
|
label: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
286
|
-
id: "
|
315
|
+
id: "rmJBin",
|
287
316
|
defaultMessage: [{
|
288
317
|
"type": 0,
|
289
|
-
"value": "
|
318
|
+
"value": "Dimensions"
|
290
319
|
}]
|
291
320
|
}),
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
321
|
+
type: 'display',
|
322
|
+
display: 'unit',
|
323
|
+
format: 'dimensions',
|
324
|
+
name: 'metadata'
|
325
|
+
}, {
|
326
|
+
id: 'size',
|
327
|
+
label: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
328
|
+
id: "g2CRt5",
|
329
|
+
defaultMessage: [{
|
330
|
+
"type": 0,
|
331
|
+
"value": "Size"
|
332
|
+
}]
|
333
|
+
}),
|
334
|
+
type: 'display',
|
335
|
+
display: 'unit',
|
336
|
+
format: 'bytes',
|
337
|
+
name: 'metadata.size'
|
338
|
+
}, {
|
339
|
+
id: 'duration',
|
340
|
+
label: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
341
|
+
id: "wU++NJ",
|
342
|
+
defaultMessage: [{
|
343
|
+
"type": 0,
|
344
|
+
"value": "Duration"
|
345
|
+
}]
|
346
|
+
}),
|
347
|
+
type: 'display',
|
348
|
+
display: 'unit',
|
349
|
+
format: 'duration',
|
350
|
+
name: 'metadata.duration'
|
297
351
|
}]
|
298
|
-
}
|
299
|
-
// {
|
300
|
-
// id: 'technical',
|
301
|
-
// component: 'fields',
|
302
|
-
// title: <FormattedMessage defaultMessage="Technical details" description="Field title" />,
|
303
|
-
// fields: [
|
304
|
-
// {
|
305
|
-
// id: 'format',
|
306
|
-
// label: <FormattedMessage defaultMessage="Format" description="Field label" />,
|
307
|
-
// type: 'display',
|
308
|
-
// component: 'unit',
|
309
|
-
// format: 'format',
|
310
|
-
// path: 'format',
|
311
|
-
// section: 'technical',
|
312
|
-
// },
|
313
|
-
// {
|
314
|
-
// id: 'dimensions',
|
315
|
-
// label: <FormattedMessage defaultMessage="Dimensions" description="Field label" />,
|
316
|
-
// type: 'display',
|
317
|
-
// component: 'unit',
|
318
|
-
// format: 'dimensions',
|
319
|
-
// path: 'metadata',
|
320
|
-
// section: 'technical',
|
321
|
-
// },
|
322
|
-
// {
|
323
|
-
// id: 'size',
|
324
|
-
// label: <FormattedMessage defaultMessage="Size" description="Field label" />,
|
325
|
-
// type: 'display',
|
326
|
-
// component: 'unit',
|
327
|
-
// format: 'bytes',
|
328
|
-
// path: 'metadata.size',
|
329
|
-
// section: 'technical',
|
330
|
-
// },
|
331
|
-
// {
|
332
|
-
// id: 'duration',
|
333
|
-
// label: <FormattedMessage defaultMessage="Duration" description="Field label" />,
|
334
|
-
// type: 'display',
|
335
|
-
// component: 'unit',
|
336
|
-
// format: 'duration',
|
337
|
-
// path: 'metadata.duration',
|
338
|
-
// section: 'technical',
|
339
|
-
// },
|
340
|
-
// ],
|
341
|
-
// },
|
342
|
-
];
|
352
|
+
}];
|
343
353
|
|
344
354
|
var propTypes$7 = {
|
345
355
|
value: PropTypes.shape({
|
@@ -348,8 +358,8 @@ var propTypes$7 = {
|
|
348
358
|
fields: PropTypes.arrayOf(PropTypes.shape({
|
349
359
|
name: PropTypes.string
|
350
360
|
})),
|
351
|
-
onChange: PropTypes.func
|
352
|
-
onSave: PropTypes.func
|
361
|
+
onChange: PropTypes.func,
|
362
|
+
onSave: PropTypes.func,
|
353
363
|
onDelete: PropTypes.func,
|
354
364
|
onClose: PropTypes.func,
|
355
365
|
className: PropTypes.string,
|
@@ -358,8 +368,10 @@ var propTypes$7 = {
|
|
358
368
|
var defaultProps$7 = {
|
359
369
|
value: null,
|
360
370
|
fields: defaultFields,
|
361
|
-
|
371
|
+
onChange: null,
|
372
|
+
onSave: null,
|
362
373
|
onDelete: null,
|
374
|
+
onClose: null,
|
363
375
|
className: null,
|
364
376
|
children: null
|
365
377
|
};
|
@@ -407,13 +419,13 @@ function MediaForm(_ref) {
|
|
407
419
|
_ref3$id = _ref3.id,
|
408
420
|
id = _ref3$id === void 0 ? null : _ref3$id;
|
409
421
|
destroy(id, initialValue).then(function () {
|
410
|
-
if (onClose !== null) {
|
411
|
-
onClose();
|
412
|
-
}
|
413
422
|
if (onDelete !== null) {
|
414
423
|
onDelete();
|
415
424
|
}
|
416
425
|
setChanged(false);
|
426
|
+
if (onClose !== null) {
|
427
|
+
onClose();
|
428
|
+
}
|
417
429
|
});
|
418
430
|
}, [initialValue, destroy, destroying, setChanged]);
|
419
431
|
var postForm = React.useCallback(function (action, data) {
|
@@ -435,16 +447,16 @@ function MediaForm(_ref) {
|
|
435
447
|
generalError = _useForm.generalError;
|
436
448
|
return /*#__PURE__*/React.createElement("div", {
|
437
449
|
className: classNames(['text-body', _defineProperty({}, className, className !== null)])
|
450
|
+
}, /*#__PURE__*/React.createElement("nav", {
|
451
|
+
className: "navbar d-flex w-100 align-items-end justify-content-between border-bottom mb-3"
|
438
452
|
}, /*#__PURE__*/React.createElement("div", {
|
439
|
-
className: "d-flex
|
440
|
-
}, /*#__PURE__*/React.createElement("div", {
|
441
|
-
className: "d-flex align-items-end justify-content-end mb-0"
|
453
|
+
className: "d-flex align-items-end justify-content-end mb-1"
|
442
454
|
}, /*#__PURE__*/React.createElement("h4", {
|
443
455
|
className: "d-inline text-break mb-0"
|
444
456
|
}, name), /*#__PURE__*/React.createElement("span", {
|
445
457
|
className: "mx-2"
|
446
458
|
}, type)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
|
447
|
-
className: "me-2 mb-1",
|
459
|
+
className: "me-2 mb-1 mt-1",
|
448
460
|
theme: "danger",
|
449
461
|
onClick: onDeleteMedia,
|
450
462
|
disabled: destroying
|
@@ -455,7 +467,7 @@ function MediaForm(_ref) {
|
|
455
467
|
"value": "Delete"
|
456
468
|
}]
|
457
469
|
})), onSave !== null ? /*#__PURE__*/React.createElement(Button, {
|
458
|
-
className: "mb-1",
|
470
|
+
className: "mb-1 mt-1",
|
459
471
|
theme: "primary",
|
460
472
|
onClick: onSubmit,
|
461
473
|
disabled: !changed || updating || destroying
|
@@ -897,6 +909,10 @@ function MediasBrowser(_ref) {
|
|
897
909
|
onSelectItems(media);
|
898
910
|
onQueryReset();
|
899
911
|
}, [setCurrentMedia, onQueryReset, onSelectItems]);
|
912
|
+
var onSaveMedia = React.useCallback(function () {
|
913
|
+
setCurrentMedia(null);
|
914
|
+
onQueryReset();
|
915
|
+
}, [setCurrentMedia, onQueryReset]);
|
900
916
|
var pagination = /*#__PURE__*/React.createElement(Pagination, {
|
901
917
|
page: page,
|
902
918
|
lastPage: lastPage,
|
@@ -942,6 +958,8 @@ function MediasBrowser(_ref) {
|
|
942
958
|
}))), /*#__PURE__*/React.createElement(MediaForm, {
|
943
959
|
value: currentMedia,
|
944
960
|
fields: fields,
|
961
|
+
onChange: setCurrentMedia,
|
962
|
+
onSave: onSaveMedia,
|
945
963
|
onClose: onCloseMedia
|
946
964
|
})) : /*#__PURE__*/React.createElement(React.Fragment, null, buttons !== null ? /*#__PURE__*/React.createElement(Buttons, {
|
947
965
|
items: buttons,
|
@@ -994,6 +1012,7 @@ function MediasBrowser(_ref) {
|
|
994
1012
|
}
|
995
1013
|
}, tableProps, {
|
996
1014
|
items: items || [],
|
1015
|
+
loading: loading,
|
997
1016
|
onSelectItem: onSelectItem !== null ? onSelectItem : function (it) {
|
998
1017
|
return onOpenMedia(it);
|
999
1018
|
}
|
@@ -1005,6 +1024,7 @@ function MediasBrowser(_ref) {
|
|
1005
1024
|
}, "\u2014")
|
1006
1025
|
}, tableProps, {
|
1007
1026
|
items: items,
|
1027
|
+
loading: loading,
|
1008
1028
|
onSelectItem: onSelectItem !== null ? onSelectItem : function (it) {
|
1009
1029
|
return onOpenMedia(it);
|
1010
1030
|
},
|
@@ -1228,33 +1248,47 @@ function MediasResourceBrowser(_ref) {
|
|
1228
1248
|
}
|
1229
1249
|
return (_api$resources = api.resources).get.apply(_api$resources, [resource].concat(args));
|
1230
1250
|
},
|
1231
|
-
|
1251
|
+
getTrashed: function getTrashed() {
|
1232
1252
|
var _api$resources2;
|
1233
1253
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
1234
1254
|
args[_key2] = arguments[_key2];
|
1235
1255
|
}
|
1236
|
-
return (_api$resources2 = api.resources).
|
1256
|
+
return (_api$resources2 = api.resources).getTrashed.apply(_api$resources2, [resource].concat(args));
|
1237
1257
|
},
|
1238
|
-
|
1258
|
+
find: function find() {
|
1239
1259
|
var _api$resources3;
|
1240
1260
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
1241
1261
|
args[_key3] = arguments[_key3];
|
1242
1262
|
}
|
1243
|
-
return (_api$resources3 = api.resources).
|
1263
|
+
return (_api$resources3 = api.resources).find.apply(_api$resources3, [resource].concat(args));
|
1244
1264
|
},
|
1245
|
-
|
1265
|
+
create: function create() {
|
1246
1266
|
var _api$resources4;
|
1247
1267
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
1248
1268
|
args[_key4] = arguments[_key4];
|
1249
1269
|
}
|
1250
|
-
return (_api$resources4 = api.resources).
|
1270
|
+
return (_api$resources4 = api.resources).create.apply(_api$resources4, [resource].concat(args));
|
1251
1271
|
},
|
1252
|
-
|
1272
|
+
update: function update() {
|
1253
1273
|
var _api$resources5;
|
1254
1274
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
1255
1275
|
args[_key5] = arguments[_key5];
|
1256
1276
|
}
|
1257
|
-
return (_api$resources5 = api.resources)
|
1277
|
+
return (_api$resources5 = api.resources).update.apply(_api$resources5, [resource].concat(args));
|
1278
|
+
},
|
1279
|
+
trash: function trash() {
|
1280
|
+
var _api$resources6;
|
1281
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
1282
|
+
args[_key6] = arguments[_key6];
|
1283
|
+
}
|
1284
|
+
return (_api$resources6 = api.resources).trash.apply(_api$resources6, [resource].concat(args));
|
1285
|
+
},
|
1286
|
+
"delete": function _delete() {
|
1287
|
+
var _api$resources7;
|
1288
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
1289
|
+
args[_key7] = arguments[_key7];
|
1290
|
+
}
|
1291
|
+
return (_api$resources7 = api.resources)["delete"].apply(_api$resources7, [resource].concat(args));
|
1258
1292
|
}
|
1259
1293
|
};
|
1260
1294
|
}, [api, resource]);
|
@@ -1276,7 +1310,16 @@ function MediasResourcePicker(_ref) {
|
|
1276
1310
|
var resourceId = _ref.resource,
|
1277
1311
|
props = _objectWithoutProperties(_ref, _excluded);
|
1278
1312
|
var resource = contexts.usePanneauResource(resourceId);
|
1279
|
-
|
1313
|
+
var _ref2 = resource || {},
|
1314
|
+
_ref2$index = _ref2.index,
|
1315
|
+
index = _ref2$index === void 0 ? null : _ref2$index,
|
1316
|
+
_ref2$fields = _ref2.fields,
|
1317
|
+
fields = _ref2$fields === void 0 ? null : _ref2$fields;
|
1318
|
+
var _ref3 = index || {},
|
1319
|
+
_ref3$filters = _ref3.filters,
|
1320
|
+
filters = _ref3$filters === void 0 ? null : _ref3$filters,
|
1321
|
+
_ref3$columns = _ref3.columns,
|
1322
|
+
columns = _ref3$columns === void 0 ? null : _ref3$columns;
|
1280
1323
|
var api = data.useApi();
|
1281
1324
|
var mediasApi = React.useMemo(function () {
|
1282
1325
|
return {
|
@@ -1287,39 +1330,59 @@ function MediasResourcePicker(_ref) {
|
|
1287
1330
|
}
|
1288
1331
|
return (_api$resources = api.resources).get.apply(_api$resources, [resource].concat(args));
|
1289
1332
|
},
|
1290
|
-
|
1333
|
+
getTrashed: function getTrashed() {
|
1291
1334
|
var _api$resources2;
|
1292
1335
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
1293
1336
|
args[_key2] = arguments[_key2];
|
1294
1337
|
}
|
1295
|
-
return (_api$resources2 = api.resources).
|
1338
|
+
return (_api$resources2 = api.resources).getTrashed.apply(_api$resources2, [resource].concat(args));
|
1296
1339
|
},
|
1297
|
-
|
1340
|
+
find: function find() {
|
1298
1341
|
var _api$resources3;
|
1299
1342
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
1300
1343
|
args[_key3] = arguments[_key3];
|
1301
1344
|
}
|
1302
|
-
return (_api$resources3 = api.resources).
|
1345
|
+
return (_api$resources3 = api.resources).find.apply(_api$resources3, [resource].concat(args));
|
1303
1346
|
},
|
1304
|
-
|
1347
|
+
create: function create() {
|
1305
1348
|
var _api$resources4;
|
1306
1349
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
1307
1350
|
args[_key4] = arguments[_key4];
|
1308
1351
|
}
|
1309
|
-
return (_api$resources4 = api.resources).
|
1352
|
+
return (_api$resources4 = api.resources).create.apply(_api$resources4, [resource].concat(args));
|
1310
1353
|
},
|
1311
|
-
|
1354
|
+
update: function update() {
|
1312
1355
|
var _api$resources5;
|
1313
1356
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
1314
1357
|
args[_key5] = arguments[_key5];
|
1315
1358
|
}
|
1316
|
-
return (_api$resources5 = api.resources)
|
1359
|
+
return (_api$resources5 = api.resources).update.apply(_api$resources5, [resource].concat(args));
|
1360
|
+
},
|
1361
|
+
trash: function trash() {
|
1362
|
+
var _api$resources6;
|
1363
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
1364
|
+
args[_key6] = arguments[_key6];
|
1365
|
+
}
|
1366
|
+
return (_api$resources6 = api.resources).trash.apply(_api$resources6, [resource].concat(args));
|
1367
|
+
},
|
1368
|
+
"delete": function _delete() {
|
1369
|
+
var _api$resources7;
|
1370
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
1371
|
+
args[_key7] = arguments[_key7];
|
1372
|
+
}
|
1373
|
+
return (_api$resources7 = api.resources)["delete"].apply(_api$resources7, [resource].concat(args));
|
1317
1374
|
}
|
1318
1375
|
};
|
1319
1376
|
}, [api, resource]);
|
1320
1377
|
return /*#__PURE__*/React.createElement(MediasPickerContainer, Object.assign({
|
1321
1378
|
api: mediasApi
|
1322
|
-
},
|
1379
|
+
}, filters !== null ? {
|
1380
|
+
filters: filters
|
1381
|
+
} : null, fields !== null ? {
|
1382
|
+
fields: fields
|
1383
|
+
} : null, columns !== null ? {
|
1384
|
+
columns: columns
|
1385
|
+
} : null, props));
|
1323
1386
|
}
|
1324
1387
|
MediasResourcePicker.propTypes = propTypes;
|
1325
1388
|
MediasResourcePicker.defaultProps = defaultProps;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@panneau/medias",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.164",
|
4
4
|
"description": "",
|
5
5
|
"keywords": [
|
6
6
|
"javascript"
|
@@ -46,21 +46,21 @@
|
|
46
46
|
},
|
47
47
|
"dependencies": {
|
48
48
|
"@babel/runtime": "^7.12.5",
|
49
|
-
"@panneau/core": "^3.0.
|
50
|
-
"@panneau/data": "^3.0.
|
51
|
-
"@panneau/element-button": "^3.0.
|
52
|
-
"@panneau/element-buttons": "^3.0.
|
53
|
-
"@panneau/element-form": "^3.0.
|
54
|
-
"@panneau/element-form-status": "^3.0.
|
55
|
-
"@panneau/element-grid": "^3.0.
|
56
|
-
"@panneau/element-icon": "^3.0.
|
57
|
-
"@panneau/element-media-card": "^3.0.
|
58
|
-
"@panneau/element-media-player": "^3.0.
|
59
|
-
"@panneau/element-media-preview": "^3.0.
|
60
|
-
"@panneau/element-pagination": "^3.0.
|
61
|
-
"@panneau/element-table": "^3.0.
|
62
|
-
"@panneau/field-upload": "^3.0.
|
63
|
-
"@panneau/filter-filters": "^3.0.
|
49
|
+
"@panneau/core": "^3.0.164",
|
50
|
+
"@panneau/data": "^3.0.164",
|
51
|
+
"@panneau/element-button": "^3.0.164",
|
52
|
+
"@panneau/element-buttons": "^3.0.164",
|
53
|
+
"@panneau/element-form": "^3.0.164",
|
54
|
+
"@panneau/element-form-status": "^3.0.164",
|
55
|
+
"@panneau/element-grid": "^3.0.164",
|
56
|
+
"@panneau/element-icon": "^3.0.164",
|
57
|
+
"@panneau/element-media-card": "^3.0.164",
|
58
|
+
"@panneau/element-media-player": "^3.0.164",
|
59
|
+
"@panneau/element-media-preview": "^3.0.164",
|
60
|
+
"@panneau/element-pagination": "^3.0.164",
|
61
|
+
"@panneau/element-table": "^3.0.164",
|
62
|
+
"@panneau/field-upload": "^3.0.164",
|
63
|
+
"@panneau/filter-filters": "^3.0.164",
|
64
64
|
"classnames": "^2.5.1",
|
65
65
|
"lodash": "^4.17.21",
|
66
66
|
"prop-types": "^15.7.2",
|
@@ -69,5 +69,5 @@
|
|
69
69
|
"publishConfig": {
|
70
70
|
"access": "public"
|
71
71
|
},
|
72
|
-
"gitHead": "
|
72
|
+
"gitHead": "7a1511eb7b08a09cfcf708d1ca314a12155e9bd8"
|
73
73
|
}
|