@panneau/medias 4.0.2 → 4.0.3
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 +327 -293
- package/package.json +3 -3
package/es/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import FormStatus from '@panneau/element-form-status';
|
|
|
12
12
|
import UploadField from '@panneau/field-upload';
|
|
13
13
|
import ImageDisplay from '@panneau/display-image';
|
|
14
14
|
import MediaPlayer from '@panneau/element-media-player';
|
|
15
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
15
16
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
16
17
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
17
18
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
@@ -54,9 +55,10 @@ function MediasApiProvider(_ref) {
|
|
|
54
55
|
var api = useMemo(function () {
|
|
55
56
|
return providedApi || previousApi;
|
|
56
57
|
}, [providedApi, previousApi]);
|
|
57
|
-
return /*#__PURE__*/
|
|
58
|
-
value: api
|
|
59
|
-
|
|
58
|
+
return /*#__PURE__*/jsx(MediasApiContext.Provider, {
|
|
59
|
+
value: api,
|
|
60
|
+
children: children
|
|
61
|
+
});
|
|
60
62
|
}
|
|
61
63
|
MediasApiProvider.propTypes = propTypes$9;
|
|
62
64
|
|
|
@@ -251,25 +253,26 @@ function MediaFrame(_ref) {
|
|
|
251
253
|
var onClick = useCallback(function () {
|
|
252
254
|
setShowPlayer(!showPlayer);
|
|
253
255
|
}, [showPlayer, setShowPlayer]);
|
|
254
|
-
return /*#__PURE__*/
|
|
255
|
-
className: classNames([styles.mediaFrame, 'position-relative', 'd-flex', 'flex-grow-1', 'w-100', 'mw-100', _defineProperty({}, className, className != null)])
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
256
|
+
return /*#__PURE__*/jsx("div", {
|
|
257
|
+
className: classNames([styles.mediaFrame, 'position-relative', 'd-flex', 'flex-grow-1', 'w-100', 'mw-100', _defineProperty({}, className, className != null)]),
|
|
258
|
+
children: showPlayer && type !== 'image' ? /*#__PURE__*/jsx(MediaPlayer, {
|
|
259
|
+
value: value,
|
|
260
|
+
autoPlay: false,
|
|
261
|
+
width: "100%"
|
|
262
|
+
}) : /*#__PURE__*/jsx(ImageDisplay, {
|
|
263
|
+
className: "w-100",
|
|
264
|
+
value: value,
|
|
265
|
+
maxWidth: "100%",
|
|
266
|
+
maxHeight: "100%",
|
|
267
|
+
onClick: type === 'video' || type === 'audio' ? onClick : null
|
|
268
|
+
})
|
|
269
|
+
});
|
|
267
270
|
}
|
|
268
271
|
MediaFrame.propTypes = propTypes$8;
|
|
269
272
|
|
|
270
273
|
var defaultFields = [{
|
|
271
274
|
name: 'name',
|
|
272
|
-
label: /*#__PURE__*/
|
|
275
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
273
276
|
id: "WX83V9",
|
|
274
277
|
defaultMessage: [{
|
|
275
278
|
"type": 0,
|
|
@@ -280,7 +283,7 @@ var defaultFields = [{
|
|
|
280
283
|
component: 'text'
|
|
281
284
|
}, {
|
|
282
285
|
name: 'description',
|
|
283
|
-
label: /*#__PURE__*/
|
|
286
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
284
287
|
id: "ygNvmz",
|
|
285
288
|
defaultMessage: [{
|
|
286
289
|
"type": 0,
|
|
@@ -307,7 +310,7 @@ var defaultFields = [{
|
|
|
307
310
|
{
|
|
308
311
|
id: 'info',
|
|
309
312
|
component: 'fields',
|
|
310
|
-
label: /*#__PURE__*/
|
|
313
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
311
314
|
id: "3RT69u",
|
|
312
315
|
defaultMessage: [{
|
|
313
316
|
"type": 0,
|
|
@@ -318,7 +321,7 @@ var defaultFields = [{
|
|
|
318
321
|
hideWithoutValue: true,
|
|
319
322
|
fields: [{
|
|
320
323
|
id: 'user',
|
|
321
|
-
label: /*#__PURE__*/
|
|
324
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
322
325
|
id: "yByaBh",
|
|
323
326
|
defaultMessage: [{
|
|
324
327
|
"type": 0,
|
|
@@ -331,7 +334,7 @@ var defaultFields = [{
|
|
|
331
334
|
horizontal: true
|
|
332
335
|
}, {
|
|
333
336
|
id: 'created_at',
|
|
334
|
-
label: /*#__PURE__*/
|
|
337
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
335
338
|
id: "PN+75e",
|
|
336
339
|
defaultMessage: [{
|
|
337
340
|
"type": 0,
|
|
@@ -347,7 +350,7 @@ var defaultFields = [{
|
|
|
347
350
|
}, {
|
|
348
351
|
id: 'technical',
|
|
349
352
|
component: 'fields',
|
|
350
|
-
label: /*#__PURE__*/
|
|
353
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
351
354
|
id: "xKUOLG",
|
|
352
355
|
defaultMessage: [{
|
|
353
356
|
"type": 0,
|
|
@@ -358,7 +361,7 @@ var defaultFields = [{
|
|
|
358
361
|
hideWithoutValue: true,
|
|
359
362
|
fields: [{
|
|
360
363
|
id: 'format',
|
|
361
|
-
label: /*#__PURE__*/
|
|
364
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
362
365
|
id: "JuxiUN",
|
|
363
366
|
defaultMessage: [{
|
|
364
367
|
"type": 0,
|
|
@@ -372,7 +375,7 @@ var defaultFields = [{
|
|
|
372
375
|
horizontal: true
|
|
373
376
|
}, {
|
|
374
377
|
id: 'dimensions',
|
|
375
|
-
label: /*#__PURE__*/
|
|
378
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
376
379
|
id: "rmJBin",
|
|
377
380
|
defaultMessage: [{
|
|
378
381
|
"type": 0,
|
|
@@ -386,7 +389,7 @@ var defaultFields = [{
|
|
|
386
389
|
horizontal: true
|
|
387
390
|
}, {
|
|
388
391
|
id: 'size',
|
|
389
|
-
label: /*#__PURE__*/
|
|
392
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
390
393
|
id: "g2CRt5",
|
|
391
394
|
defaultMessage: [{
|
|
392
395
|
"type": 0,
|
|
@@ -400,7 +403,7 @@ var defaultFields = [{
|
|
|
400
403
|
horizontal: true
|
|
401
404
|
}, {
|
|
402
405
|
id: 'duration',
|
|
403
|
-
label: /*#__PURE__*/
|
|
406
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
404
407
|
id: "wU++NJ",
|
|
405
408
|
defaultMessage: [{
|
|
406
409
|
"type": 0,
|
|
@@ -545,107 +548,124 @@ function MediaForm(_ref) {
|
|
|
545
548
|
onSubmit = _useForm.onSubmit,
|
|
546
549
|
status = _useForm.status,
|
|
547
550
|
generalError = _useForm.generalError;
|
|
548
|
-
return /*#__PURE__*/
|
|
549
|
-
className: classNames(['text-body', _defineProperty({}, className, className !== null)])
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
551
|
+
return /*#__PURE__*/jsxs("div", {
|
|
552
|
+
className: classNames(['text-body', _defineProperty({}, className, className !== null)]),
|
|
553
|
+
children: [/*#__PURE__*/jsxs("nav", {
|
|
554
|
+
className: "navbar d-flex w-100 align-items-end justify-content-between border-bottom mb-3",
|
|
555
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
556
|
+
className: "d-flex align-items-end justify-content-start mb-1",
|
|
557
|
+
style: {
|
|
558
|
+
maxWidth: '66%'
|
|
559
|
+
},
|
|
560
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
561
|
+
className: "me-3 mb-0",
|
|
562
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
563
|
+
theme: "secondary",
|
|
564
|
+
outline: true,
|
|
565
|
+
onClick: onClose,
|
|
566
|
+
icon: "arrow-left",
|
|
567
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
568
|
+
id: "8NyYTH",
|
|
569
|
+
defaultMessage: [{
|
|
570
|
+
"type": 0,
|
|
571
|
+
"value": "Back"
|
|
572
|
+
}]
|
|
573
|
+
})
|
|
574
|
+
})
|
|
575
|
+
}), /*#__PURE__*/jsx("h4", {
|
|
576
|
+
className: "d-inline text-truncate mb-0",
|
|
577
|
+
children: name
|
|
578
|
+
}), /*#__PURE__*/jsx("span", {
|
|
579
|
+
className: "mx-2",
|
|
580
|
+
children: type
|
|
581
|
+
})]
|
|
582
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
583
|
+
className: classNames('d-flex', 'justify-content-between', 'align-items-center', 'gap-1'),
|
|
584
|
+
children: [withReplace ? /*#__PURE__*/jsx(UploadField, {
|
|
585
|
+
className: "w-auto text-nowrap",
|
|
586
|
+
withButton: true,
|
|
587
|
+
withoutMedia: true,
|
|
588
|
+
types: [type],
|
|
589
|
+
outline: false,
|
|
590
|
+
closeAfterFinish: true,
|
|
591
|
+
disabled: deleting || trashing || updating || replacing,
|
|
592
|
+
addButtonLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
593
|
+
id: "GxOBVL",
|
|
594
|
+
defaultMessage: [{
|
|
595
|
+
"type": 0,
|
|
596
|
+
"value": "Replace"
|
|
597
|
+
}]
|
|
598
|
+
}),
|
|
599
|
+
onChange: onUploadComplete
|
|
600
|
+
}) : null, withDelete ? /*#__PURE__*/jsx(Button, {
|
|
601
|
+
className: "me-2 mb-1 mt-1",
|
|
602
|
+
theme: "danger",
|
|
603
|
+
icon: withTrash && deletedAt !== null ? 'trash-fill' : 'trash',
|
|
604
|
+
iconPosition: "right",
|
|
605
|
+
onClick: onDeleteMedia,
|
|
606
|
+
disabled: deleting || trashing || updating || replacing,
|
|
607
|
+
children: withTrash && deletedAt === null ? /*#__PURE__*/jsx(FormattedMessage, {
|
|
608
|
+
id: "PSlT7H",
|
|
609
|
+
defaultMessage: [{
|
|
610
|
+
"type": 0,
|
|
611
|
+
"value": "Trash"
|
|
612
|
+
}]
|
|
613
|
+
}) : /*#__PURE__*/jsx(FormattedMessage, {
|
|
614
|
+
id: "Bhu3B2",
|
|
615
|
+
defaultMessage: [{
|
|
616
|
+
"type": 0,
|
|
617
|
+
"value": "Delete"
|
|
618
|
+
}]
|
|
619
|
+
})
|
|
620
|
+
}) : null, onSave !== null ? /*#__PURE__*/jsx(Button, {
|
|
621
|
+
className: "mb-1 mt-1",
|
|
622
|
+
theme: "primary",
|
|
623
|
+
icon: changed ? 'check' : 'check',
|
|
624
|
+
iconPosition: "right",
|
|
625
|
+
onClick: onSubmit,
|
|
626
|
+
disabled: !changed || updating || deleting || trashing,
|
|
627
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
628
|
+
id: "R1HYj0",
|
|
629
|
+
defaultMessage: [{
|
|
630
|
+
"type": 0,
|
|
631
|
+
"value": "Save"
|
|
632
|
+
}]
|
|
633
|
+
})
|
|
634
|
+
}) : null]
|
|
635
|
+
})]
|
|
636
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
637
|
+
className: "row",
|
|
638
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
639
|
+
className: "col-md-6",
|
|
640
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
641
|
+
className: "position-relative w-100",
|
|
642
|
+
children: /*#__PURE__*/jsx("div", {
|
|
643
|
+
className: styles.mediaFrame,
|
|
644
|
+
children: /*#__PURE__*/jsx(MediaFrame, {
|
|
645
|
+
value: value
|
|
646
|
+
})
|
|
647
|
+
})
|
|
648
|
+
}), children]
|
|
649
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
650
|
+
className: "col-md-6",
|
|
651
|
+
children: [/*#__PURE__*/jsx(Form, {
|
|
652
|
+
onChange: onChangeMedia,
|
|
653
|
+
withoutActions: true,
|
|
654
|
+
children: /*#__PURE__*/jsx(FieldsComponent, {
|
|
655
|
+
fields: fields,
|
|
656
|
+
value: value,
|
|
657
|
+
onChange: setValue,
|
|
658
|
+
disabled: disabled
|
|
659
|
+
})
|
|
660
|
+
}), generalError !== null && status !== null ? /*#__PURE__*/jsx("div", {
|
|
661
|
+
className: "mt-5",
|
|
662
|
+
children: /*#__PURE__*/jsx(FormStatus, {
|
|
663
|
+
status: status
|
|
664
|
+
})
|
|
665
|
+
}) : null]
|
|
666
|
+
})]
|
|
667
|
+
})]
|
|
668
|
+
});
|
|
649
669
|
}
|
|
650
670
|
MediaForm.propTypes = propTypes$7;
|
|
651
671
|
|
|
@@ -673,15 +693,16 @@ function MediaProvider(_ref) {
|
|
|
673
693
|
setCurrentMedia: setCurrentMedia
|
|
674
694
|
};
|
|
675
695
|
}, [currentMedia, setCurrentMedia]);
|
|
676
|
-
return /*#__PURE__*/
|
|
677
|
-
value: values
|
|
678
|
-
|
|
696
|
+
return /*#__PURE__*/jsx(MediaContext.Provider, {
|
|
697
|
+
value: values,
|
|
698
|
+
children: children
|
|
699
|
+
});
|
|
679
700
|
}
|
|
680
701
|
MediaProvider.propTypes = propTypes$6;
|
|
681
702
|
|
|
682
703
|
var defaultColumns = [{
|
|
683
704
|
id: 'image',
|
|
684
|
-
label: /*#__PURE__*/
|
|
705
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
685
706
|
id: "UbxbKP",
|
|
686
707
|
defaultMessage: [{
|
|
687
708
|
"type": 0,
|
|
@@ -693,7 +714,7 @@ var defaultColumns = [{
|
|
|
693
714
|
sortable: false
|
|
694
715
|
}, {
|
|
695
716
|
id: 'name',
|
|
696
|
-
label: /*#__PURE__*/
|
|
717
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
697
718
|
id: "WX83V9",
|
|
698
719
|
defaultMessage: [{
|
|
699
720
|
"type": 0,
|
|
@@ -704,28 +725,28 @@ var defaultColumns = [{
|
|
|
704
725
|
path: 'name',
|
|
705
726
|
descriptionPath: 'type',
|
|
706
727
|
descriptionValues: {
|
|
707
|
-
image: /*#__PURE__*/
|
|
728
|
+
image: /*#__PURE__*/jsx(FormattedMessage, {
|
|
708
729
|
id: "AwDQvD",
|
|
709
730
|
defaultMessage: [{
|
|
710
731
|
"type": 0,
|
|
711
732
|
"value": "Image"
|
|
712
733
|
}]
|
|
713
734
|
}),
|
|
714
|
-
video: /*#__PURE__*/
|
|
735
|
+
video: /*#__PURE__*/jsx(FormattedMessage, {
|
|
715
736
|
id: "mQiyAm",
|
|
716
737
|
defaultMessage: [{
|
|
717
738
|
"type": 0,
|
|
718
739
|
"value": "Video"
|
|
719
740
|
}]
|
|
720
741
|
}),
|
|
721
|
-
audio: /*#__PURE__*/
|
|
742
|
+
audio: /*#__PURE__*/jsx(FormattedMessage, {
|
|
722
743
|
id: "XnyI69",
|
|
723
744
|
defaultMessage: [{
|
|
724
745
|
"type": 0,
|
|
725
746
|
"value": "Audio"
|
|
726
747
|
}]
|
|
727
748
|
}),
|
|
728
|
-
document: /*#__PURE__*/
|
|
749
|
+
document: /*#__PURE__*/jsx(FormattedMessage, {
|
|
729
750
|
id: "1dqmFw",
|
|
730
751
|
defaultMessage: [{
|
|
731
752
|
"type": 0,
|
|
@@ -736,7 +757,7 @@ var defaultColumns = [{
|
|
|
736
757
|
sortable: true
|
|
737
758
|
}, {
|
|
738
759
|
id: 'dimensions',
|
|
739
|
-
label: /*#__PURE__*/
|
|
760
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
740
761
|
id: "eCe9ZY",
|
|
741
762
|
defaultMessage: [{
|
|
742
763
|
"type": 0,
|
|
@@ -748,7 +769,7 @@ var defaultColumns = [{
|
|
|
748
769
|
path: 'metadata'
|
|
749
770
|
}, {
|
|
750
771
|
id: 'size',
|
|
751
|
-
label: /*#__PURE__*/
|
|
772
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
752
773
|
id: "c3hu9o",
|
|
753
774
|
defaultMessage: [{
|
|
754
775
|
"type": 0,
|
|
@@ -760,7 +781,7 @@ var defaultColumns = [{
|
|
|
760
781
|
path: 'metadata.size'
|
|
761
782
|
}, {
|
|
762
783
|
id: 'duration',
|
|
763
|
-
label: /*#__PURE__*/
|
|
784
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
764
785
|
id: "002oWQ",
|
|
765
786
|
defaultMessage: [{
|
|
766
787
|
"type": 0,
|
|
@@ -781,7 +802,7 @@ var defaultColumns = [{
|
|
|
781
802
|
// },
|
|
782
803
|
{
|
|
783
804
|
id: 'created_at',
|
|
784
|
-
label: /*#__PURE__*/
|
|
805
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
785
806
|
id: "OzYWZz",
|
|
786
807
|
defaultMessage: [{
|
|
787
808
|
"type": 0,
|
|
@@ -794,7 +815,7 @@ var defaultColumns = [{
|
|
|
794
815
|
sortable: true
|
|
795
816
|
}, {
|
|
796
817
|
id: 'actions',
|
|
797
|
-
label: /*#__PURE__*/
|
|
818
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
798
819
|
id: "rtwfuZ",
|
|
799
820
|
defaultMessage: [{
|
|
800
821
|
"type": 0,
|
|
@@ -823,7 +844,7 @@ var defaultFilters = [{
|
|
|
823
844
|
id: 'types',
|
|
824
845
|
component: 'select',
|
|
825
846
|
name: 'types',
|
|
826
|
-
placeholder: /*#__PURE__*/
|
|
847
|
+
placeholder: /*#__PURE__*/jsx(FormattedMessage, {
|
|
827
848
|
id: "9/t5wK",
|
|
828
849
|
defaultMessage: [{
|
|
829
850
|
"type": 0,
|
|
@@ -831,7 +852,7 @@ var defaultFilters = [{
|
|
|
831
852
|
}]
|
|
832
853
|
}),
|
|
833
854
|
options: [{
|
|
834
|
-
label: /*#__PURE__*/
|
|
855
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
835
856
|
id: "yHAmDD",
|
|
836
857
|
defaultMessage: [{
|
|
837
858
|
"type": 0,
|
|
@@ -840,7 +861,7 @@ var defaultFilters = [{
|
|
|
840
861
|
}),
|
|
841
862
|
value: 'image'
|
|
842
863
|
}, {
|
|
843
|
-
label: /*#__PURE__*/
|
|
864
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
844
865
|
id: "xSERPA",
|
|
845
866
|
defaultMessage: [{
|
|
846
867
|
"type": 0,
|
|
@@ -849,7 +870,7 @@ var defaultFilters = [{
|
|
|
849
870
|
}),
|
|
850
871
|
value: 'video'
|
|
851
872
|
}, {
|
|
852
|
-
label: /*#__PURE__*/
|
|
873
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
853
874
|
id: "yQRtgx",
|
|
854
875
|
defaultMessage: [{
|
|
855
876
|
"type": 0,
|
|
@@ -858,7 +879,7 @@ var defaultFilters = [{
|
|
|
858
879
|
}),
|
|
859
880
|
value: 'audio'
|
|
860
881
|
}, {
|
|
861
|
-
label: /*#__PURE__*/
|
|
882
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
862
883
|
id: "8INLfU",
|
|
863
884
|
defaultMessage: [{
|
|
864
885
|
"type": 0,
|
|
@@ -893,12 +914,12 @@ var _excluded$5 = ["page", "count"],
|
|
|
893
914
|
_excluded2 = ["types", "trashed"];
|
|
894
915
|
var DEFAULT_LAYOUTS = [{
|
|
895
916
|
id: 'table',
|
|
896
|
-
label: /*#__PURE__*/
|
|
917
|
+
label: /*#__PURE__*/jsx(Icon, {
|
|
897
918
|
name: "table"
|
|
898
919
|
})
|
|
899
920
|
}, {
|
|
900
921
|
id: 'grid',
|
|
901
|
-
label: /*#__PURE__*/
|
|
922
|
+
label: /*#__PURE__*/jsx(Icon, {
|
|
902
923
|
name: "grid"
|
|
903
924
|
})
|
|
904
925
|
}];
|
|
@@ -1200,7 +1221,7 @@ function MediasBrowser(_ref) {
|
|
|
1200
1221
|
onUploadedMediaChanged(rawMedias);
|
|
1201
1222
|
}
|
|
1202
1223
|
}, [onMediaUploaded, setUploadedMedias, setUploadProcessing, onUploadedMediaChanged]);
|
|
1203
|
-
var pagination = /*#__PURE__*/
|
|
1224
|
+
var pagination = /*#__PURE__*/jsx(Pagination, {
|
|
1204
1225
|
page: page,
|
|
1205
1226
|
lastPage: lastPage,
|
|
1206
1227
|
total: total,
|
|
@@ -1248,7 +1269,7 @@ function MediasBrowser(_ref) {
|
|
|
1248
1269
|
if (columnId === 'created_at') {
|
|
1249
1270
|
return _objectSpread(_objectSpread({}, column), {}, {
|
|
1250
1271
|
path: 'deleted_at',
|
|
1251
|
-
label: /*#__PURE__*/
|
|
1272
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
1252
1273
|
id: "uds4wJ",
|
|
1253
1274
|
defaultMessage: [{
|
|
1254
1275
|
"type": 0,
|
|
@@ -1343,123 +1364,131 @@ function MediasBrowser(_ref) {
|
|
|
1343
1364
|
// [items, finalItems],
|
|
1344
1365
|
// );
|
|
1345
1366
|
|
|
1346
|
-
return /*#__PURE__*/
|
|
1347
|
-
className: className
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
selectedItems: selectedItems,
|
|
1412
|
-
onSelectionChange: uploadProcessing ? null : onSelectionChange,
|
|
1413
|
-
multipleSelection: multipleSelection,
|
|
1414
|
-
query: query // For sort
|
|
1415
|
-
,
|
|
1416
|
-
onQueryChange: onQueryChange,
|
|
1417
|
-
items: finalItems || [],
|
|
1418
|
-
loading: loading,
|
|
1419
|
-
loaded: loaded
|
|
1420
|
-
// empty={emptyWithSticky}
|
|
1421
|
-
}) : null, layout === 'table' ? /*#__PURE__*/React.createElement(Table, {
|
|
1422
|
-
theme: theme,
|
|
1423
|
-
columns: finalColumns,
|
|
1424
|
-
displayPlaceholder: /*#__PURE__*/React.createElement("span", {
|
|
1425
|
-
className: "text-secondary text-opacity-75"
|
|
1426
|
-
}, "\u2014"),
|
|
1427
|
-
selectable: selectable && !showTrashed,
|
|
1428
|
-
selectedItems: selectedItems,
|
|
1429
|
-
onSelectionChange: uploadProcessing ? null : onSelectionChange,
|
|
1430
|
-
multipleSelection: multipleSelection,
|
|
1431
|
-
query: query // For sort
|
|
1432
|
-
,
|
|
1433
|
-
onQueryChange: onQueryChange,
|
|
1434
|
-
items: finalItems,
|
|
1435
|
-
loading: loading,
|
|
1436
|
-
loaded: loaded
|
|
1437
|
-
// empty={emptyWithSticky}
|
|
1438
|
-
,
|
|
1439
|
-
actionsProps: {
|
|
1440
|
-
getDeletePropsFromItem: function getDeletePropsFromItem() {
|
|
1441
|
-
return {
|
|
1442
|
-
href: null,
|
|
1443
|
-
withConfirmation: true,
|
|
1444
|
-
disabled: trashing || deleting,
|
|
1445
|
-
icon: showTrashed ? 'trash-fill' : 'trash',
|
|
1446
|
-
action: function action(ids) {
|
|
1447
|
-
return onTrashMedia(ids[0]);
|
|
1448
|
-
}
|
|
1449
|
-
};
|
|
1450
|
-
},
|
|
1451
|
-
getEditPropsFromItem: function getEditPropsFromItem(it) {
|
|
1452
|
-
return {
|
|
1453
|
-
href: null,
|
|
1454
|
-
onClick: function onClick() {
|
|
1367
|
+
return /*#__PURE__*/jsx("div", {
|
|
1368
|
+
className: className,
|
|
1369
|
+
children: currentMedia !== null ? /*#__PURE__*/jsx(MediaForm, {
|
|
1370
|
+
value: currentMedia,
|
|
1371
|
+
fields: fields,
|
|
1372
|
+
onChange: setCurrentMedia,
|
|
1373
|
+
onSave: onSaveMedia,
|
|
1374
|
+
onReplace: onReplaceMedia,
|
|
1375
|
+
onClose: onCloseMedia,
|
|
1376
|
+
onDelete: onDeleteMedia,
|
|
1377
|
+
withDelete: withDelete,
|
|
1378
|
+
withTrash: withTrash,
|
|
1379
|
+
withReplace: withReplace,
|
|
1380
|
+
children: formChildren
|
|
1381
|
+
}) : /*#__PURE__*/jsxs(Fragment, {
|
|
1382
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
1383
|
+
className: classNames(['d-flex', 'justify-content-between']),
|
|
1384
|
+
children: [filters !== null ? /*#__PURE__*/jsx(Filters, {
|
|
1385
|
+
value: query,
|
|
1386
|
+
clearValue: types !== null ? queryWithoutTypes : null,
|
|
1387
|
+
filters: finalFilters,
|
|
1388
|
+
onChange: onQueryChange,
|
|
1389
|
+
onReset: onQueryReset,
|
|
1390
|
+
theme: theme
|
|
1391
|
+
}) : null, canUpload ? /*#__PURE__*/jsx(UploadField, {
|
|
1392
|
+
className: "ms-auto w-auto text-nowrap mt-2 mb-2 ps-2",
|
|
1393
|
+
withButton: true,
|
|
1394
|
+
withoutMedia: true,
|
|
1395
|
+
uppyProps: uppyConfig,
|
|
1396
|
+
types: types,
|
|
1397
|
+
allowMultipleUploads: true,
|
|
1398
|
+
onChange: onUploadComplete,
|
|
1399
|
+
disabled: uploadProcessing,
|
|
1400
|
+
loading: uploadProcessing,
|
|
1401
|
+
outline: false,
|
|
1402
|
+
closeAfterFinish: true
|
|
1403
|
+
}) : null]
|
|
1404
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
1405
|
+
className: classNames(['d-flex', 'mt-1', 'mb-3', {
|
|
1406
|
+
'justify-content-between': hasLayouts,
|
|
1407
|
+
'justify-content-end': !hasLayouts
|
|
1408
|
+
}]),
|
|
1409
|
+
children: [hasLayouts ? /*#__PURE__*/jsx(Buttons, {
|
|
1410
|
+
size: "sm",
|
|
1411
|
+
theme: "secondary",
|
|
1412
|
+
outline: true,
|
|
1413
|
+
items: (layouts || []).map(function (lay) {
|
|
1414
|
+
return _objectSpread(_objectSpread({}, lay), {}, {
|
|
1415
|
+
active: layout === lay.id,
|
|
1416
|
+
onClick: function onClick() {
|
|
1417
|
+
return onClickLayout(lay.id);
|
|
1418
|
+
},
|
|
1419
|
+
className: 'px-3 py-2'
|
|
1420
|
+
});
|
|
1421
|
+
})
|
|
1422
|
+
}) : null, !hidePagination ? pagination : /*#__PURE__*/jsx("div", {})]
|
|
1423
|
+
}), layout === 'grid' ? /*#__PURE__*/jsx(Grid, {
|
|
1424
|
+
size: "small",
|
|
1425
|
+
theme: theme,
|
|
1426
|
+
component: MediaCard,
|
|
1427
|
+
componentProps: {
|
|
1428
|
+
className: 'd-flex w-100',
|
|
1429
|
+
cardClassName: 'flex-grow-1',
|
|
1430
|
+
vertical: true,
|
|
1431
|
+
onClickDescription: function onClickDescription(it) {
|
|
1455
1432
|
onOpenMedia(it);
|
|
1456
1433
|
}
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1434
|
+
},
|
|
1435
|
+
selectable: selectable && !showTrashed,
|
|
1436
|
+
selectedItems: selectedItems,
|
|
1437
|
+
onSelectionChange: uploadProcessing ? null : onSelectionChange,
|
|
1438
|
+
multipleSelection: multipleSelection,
|
|
1439
|
+
query: query // For sort
|
|
1440
|
+
,
|
|
1441
|
+
onQueryChange: onQueryChange,
|
|
1442
|
+
items: finalItems || [],
|
|
1443
|
+
loading: loading,
|
|
1444
|
+
loaded: loaded
|
|
1445
|
+
// empty={emptyWithSticky}
|
|
1446
|
+
}) : null, layout === 'table' ? /*#__PURE__*/jsx(Table, {
|
|
1447
|
+
theme: theme,
|
|
1448
|
+
columns: finalColumns,
|
|
1449
|
+
displayPlaceholder: /*#__PURE__*/jsx("span", {
|
|
1450
|
+
className: "text-secondary text-opacity-75",
|
|
1451
|
+
children: "\u2014"
|
|
1452
|
+
}),
|
|
1453
|
+
selectable: selectable && !showTrashed,
|
|
1454
|
+
selectedItems: selectedItems,
|
|
1455
|
+
onSelectionChange: uploadProcessing ? null : onSelectionChange,
|
|
1456
|
+
multipleSelection: multipleSelection,
|
|
1457
|
+
query: query // For sort
|
|
1458
|
+
,
|
|
1459
|
+
onQueryChange: onQueryChange,
|
|
1460
|
+
items: finalItems,
|
|
1461
|
+
loading: loading,
|
|
1462
|
+
loaded: loaded
|
|
1463
|
+
// empty={emptyWithSticky}
|
|
1464
|
+
,
|
|
1465
|
+
actionsProps: {
|
|
1466
|
+
getDeletePropsFromItem: function getDeletePropsFromItem() {
|
|
1467
|
+
return {
|
|
1468
|
+
href: null,
|
|
1469
|
+
withConfirmation: true,
|
|
1470
|
+
disabled: trashing || deleting,
|
|
1471
|
+
icon: showTrashed ? 'trash-fill' : 'trash',
|
|
1472
|
+
action: function action(ids) {
|
|
1473
|
+
return onTrashMedia(ids[0]);
|
|
1474
|
+
}
|
|
1475
|
+
};
|
|
1476
|
+
},
|
|
1477
|
+
getEditPropsFromItem: function getEditPropsFromItem(it) {
|
|
1478
|
+
return {
|
|
1479
|
+
href: null,
|
|
1480
|
+
onClick: function onClick() {
|
|
1481
|
+
onOpenMedia(it);
|
|
1482
|
+
}
|
|
1483
|
+
};
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
}) : null, !hidePagination ? /*#__PURE__*/jsx("div", {
|
|
1487
|
+
className: classNames(['d-flex', 'mt-3', 'mb-1', 'justify-content-end']),
|
|
1488
|
+
children: pagination
|
|
1489
|
+
}) : null]
|
|
1490
|
+
})
|
|
1491
|
+
});
|
|
1463
1492
|
}
|
|
1464
1493
|
MediasBrowser.propTypes = propTypes$5;
|
|
1465
1494
|
|
|
@@ -1508,17 +1537,18 @@ function MediasPicker(_ref) {
|
|
|
1508
1537
|
onChange(selectedItems);
|
|
1509
1538
|
}
|
|
1510
1539
|
}, [selectedItems, onChange]);
|
|
1511
|
-
return /*#__PURE__*/
|
|
1512
|
-
className: className
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1540
|
+
return /*#__PURE__*/jsx("div", {
|
|
1541
|
+
className: className,
|
|
1542
|
+
children: /*#__PURE__*/jsx(MediasBrowser, _objectSpread({
|
|
1543
|
+
items: initialItems // TODO: fix useItems if actually using this
|
|
1544
|
+
,
|
|
1545
|
+
selectable: true,
|
|
1546
|
+
selectedItems: selectedItems,
|
|
1547
|
+
onSelectionChange: onSelectionChange,
|
|
1548
|
+
multipleSelection: multiple,
|
|
1549
|
+
extraItems: extraItems
|
|
1550
|
+
}, props))
|
|
1551
|
+
});
|
|
1522
1552
|
}
|
|
1523
1553
|
MediasPicker.propTypes = propTypes$4;
|
|
1524
1554
|
|
|
@@ -1535,11 +1565,13 @@ function MediasBrowserContainer(_ref) {
|
|
|
1535
1565
|
_ref$media = _ref.media,
|
|
1536
1566
|
media = _ref$media === void 0 ? null : _ref$media,
|
|
1537
1567
|
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
1538
|
-
return /*#__PURE__*/
|
|
1539
|
-
api: api
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1568
|
+
return /*#__PURE__*/jsx(MediasApiProvider, {
|
|
1569
|
+
api: api,
|
|
1570
|
+
children: /*#__PURE__*/jsx(MediaProvider, {
|
|
1571
|
+
media: media,
|
|
1572
|
+
children: /*#__PURE__*/jsx(MediasBrowser, _objectSpread({}, props))
|
|
1573
|
+
})
|
|
1574
|
+
});
|
|
1543
1575
|
}
|
|
1544
1576
|
MediasBrowserContainer.propTypes = propTypes$3;
|
|
1545
1577
|
|
|
@@ -1558,13 +1590,15 @@ function MediasPickerContainer(_ref) {
|
|
|
1558
1590
|
media = _ref$media === void 0 ? null : _ref$media,
|
|
1559
1591
|
onChange = _ref.onChange,
|
|
1560
1592
|
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
1561
|
-
return /*#__PURE__*/
|
|
1562
|
-
api: api
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1593
|
+
return /*#__PURE__*/jsx(MediasApiProvider, {
|
|
1594
|
+
api: api,
|
|
1595
|
+
children: /*#__PURE__*/jsx(MediaProvider, {
|
|
1596
|
+
media: media,
|
|
1597
|
+
children: /*#__PURE__*/jsx(MediasPicker, _objectSpread(_objectSpread({}, props), {}, {
|
|
1598
|
+
onChange: onChange
|
|
1599
|
+
}))
|
|
1600
|
+
})
|
|
1601
|
+
});
|
|
1568
1602
|
}
|
|
1569
1603
|
MediasPickerContainer.propTypes = propTypes$2;
|
|
1570
1604
|
|
|
@@ -1631,7 +1665,7 @@ function MediasResourceBrowser(_ref) {
|
|
|
1631
1665
|
}
|
|
1632
1666
|
};
|
|
1633
1667
|
}, [api, resource]);
|
|
1634
|
-
return /*#__PURE__*/
|
|
1668
|
+
return /*#__PURE__*/jsx(MediasBrowserContainer, _objectSpread({
|
|
1635
1669
|
api: mediasApi
|
|
1636
1670
|
}, props));
|
|
1637
1671
|
}
|
|
@@ -1710,15 +1744,15 @@ function MediasResourcePicker(_ref) {
|
|
|
1710
1744
|
}
|
|
1711
1745
|
};
|
|
1712
1746
|
}, [api, resource]);
|
|
1713
|
-
return /*#__PURE__*/
|
|
1747
|
+
return /*#__PURE__*/jsx(MediasPickerContainer, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
1714
1748
|
api: mediasApi
|
|
1715
1749
|
}, filters !== null ? {
|
|
1716
1750
|
filters: filters
|
|
1717
|
-
} : null, fields !== null ? {
|
|
1751
|
+
} : null), fields !== null ? {
|
|
1718
1752
|
fields: fields
|
|
1719
|
-
} : null, columns !== null ? {
|
|
1753
|
+
} : null), columns !== null ? {
|
|
1720
1754
|
columns: columns
|
|
1721
|
-
} : null, props));
|
|
1755
|
+
} : null), props));
|
|
1722
1756
|
}
|
|
1723
1757
|
MediasResourcePicker.propTypes = propTypes;
|
|
1724
1758
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/medias",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@panneau/element-media-player": "^4.0.2",
|
|
65
65
|
"@panneau/element-pagination": "^4.0.2",
|
|
66
66
|
"@panneau/element-table": "^4.0.2",
|
|
67
|
-
"@panneau/field-upload": "^4.0.
|
|
67
|
+
"@panneau/field-upload": "^4.0.3",
|
|
68
68
|
"@panneau/filter-filters": "^4.0.2",
|
|
69
69
|
"classnames": "^2.5.1",
|
|
70
70
|
"lodash-es": "^4.17.21",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "26b5ab7536b0e8c3197d40d302fc2681e7c7122e"
|
|
78
78
|
}
|