@micromag/media-gallery 0.4.89 → 0.4.90-alpha.1
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.d.ts +11 -1
- package/es/index.js +227 -4
- package/package.json +5 -5
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Media } from '@micromag/core';
|
|
3
|
+
import { ForwardedRef } from 'react';
|
|
4
|
+
import { DialogModalProps } from '@panneau/modal-dialog';
|
|
3
5
|
|
|
4
6
|
interface MediaGalleryProps {
|
|
5
7
|
value?: Media | Media[] | null;
|
|
@@ -25,4 +27,12 @@ interface MediaGalleryProps {
|
|
|
25
27
|
}
|
|
26
28
|
declare function MediaGallery({ value, types, source, filters: providedFilters, fields: providedFields, columns, isPicker, multiple, medias: initialMedias, query, onChange, onMediaFormOpen, onMediaFormClose, className, }: MediaGalleryProps): react_jsx_runtime.JSX.Element;
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
interface MediaGalleryModalProps extends Omit<DialogModalProps, 'id'>, MediaGalleryProps {
|
|
31
|
+
id?: string | null;
|
|
32
|
+
autoClose?: boolean;
|
|
33
|
+
withoutCloseOnComplete?: boolean;
|
|
34
|
+
formRef?: ForwardedRef<HTMLFormElement> | null;
|
|
35
|
+
}
|
|
36
|
+
declare function MediaGalleryModal({ id, title, size, visible, autoClose, multiple, requestClose: customRequestClose, onClosed, className, value: initialValue, onChange, ...props }: MediaGalleryModalProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
|
|
38
|
+
export { MediaGallery, MediaGalleryModal, MediaGallery as default };
|
package/es/index.js
CHANGED
|
@@ -9,6 +9,8 @@ import { useApi, useMediaCreate } from '@micromag/data';
|
|
|
9
9
|
import { FormattedMessage } from 'react-intl';
|
|
10
10
|
import { jsx } from 'react/jsx-runtime';
|
|
11
11
|
import { useUrlGenerator } from '@folklore/routes';
|
|
12
|
+
import { useState } from 'react';
|
|
13
|
+
import Dialog from '@panneau/modal-dialog';
|
|
12
14
|
|
|
13
15
|
var defaultColumns = [{
|
|
14
16
|
id: 'image',
|
|
@@ -569,7 +571,7 @@ function MediaGallery(t0) {
|
|
|
569
571
|
} = t0;
|
|
570
572
|
const value = t1 === undefined ? null : t1;
|
|
571
573
|
const types = t2 === undefined ? null : t2;
|
|
572
|
-
const source = t3 === undefined ?
|
|
574
|
+
const source = t3 === undefined ? null : t3;
|
|
573
575
|
const providedFilters = t4 === undefined ? null : t4;
|
|
574
576
|
const providedFields = t5 === undefined ? null : t5;
|
|
575
577
|
const columns = t6 === undefined ? defaultColumns : t6;
|
|
@@ -792,7 +794,6 @@ function MediaGallery(t0) {
|
|
|
792
794
|
className: styles.browser,
|
|
793
795
|
api: mediasApi,
|
|
794
796
|
value: pickerValue,
|
|
795
|
-
theme: "dark",
|
|
796
797
|
types: finalTypes,
|
|
797
798
|
query: finalQuery,
|
|
798
799
|
items: initialMedias,
|
|
@@ -810,7 +811,6 @@ function MediaGallery(t0) {
|
|
|
810
811
|
}) : /*#__PURE__*/jsx(MediasBrowserContainer, {
|
|
811
812
|
className: styles.browser,
|
|
812
813
|
api: mediasApi,
|
|
813
|
-
theme: "dark",
|
|
814
814
|
types: finalTypes,
|
|
815
815
|
query: finalQuery,
|
|
816
816
|
items: initialMedias,
|
|
@@ -870,4 +870,227 @@ function _temp(t) {
|
|
|
870
870
|
return ["image", "video", "audio"].indexOf(t) !== -1 ? `${t}/*` : null;
|
|
871
871
|
}
|
|
872
872
|
|
|
873
|
-
|
|
873
|
+
function MediaGalleryModal(t0) {
|
|
874
|
+
const $ = c(47);
|
|
875
|
+
let initialValue;
|
|
876
|
+
let props;
|
|
877
|
+
let t1;
|
|
878
|
+
let t10;
|
|
879
|
+
let t2;
|
|
880
|
+
let t3;
|
|
881
|
+
let t4;
|
|
882
|
+
let t5;
|
|
883
|
+
let t6;
|
|
884
|
+
let t7;
|
|
885
|
+
let t8;
|
|
886
|
+
let t9;
|
|
887
|
+
if ($[0] !== t0) {
|
|
888
|
+
({
|
|
889
|
+
id: t1,
|
|
890
|
+
title: t2,
|
|
891
|
+
size: t3,
|
|
892
|
+
visible: t4,
|
|
893
|
+
autoClose: t5,
|
|
894
|
+
multiple: t6,
|
|
895
|
+
requestClose: t7,
|
|
896
|
+
onClosed: t8,
|
|
897
|
+
className: t9,
|
|
898
|
+
value: initialValue,
|
|
899
|
+
onChange: t10,
|
|
900
|
+
...props
|
|
901
|
+
} = t0);
|
|
902
|
+
$[0] = t0;
|
|
903
|
+
$[1] = initialValue;
|
|
904
|
+
$[2] = props;
|
|
905
|
+
$[3] = t1;
|
|
906
|
+
$[4] = t10;
|
|
907
|
+
$[5] = t2;
|
|
908
|
+
$[6] = t3;
|
|
909
|
+
$[7] = t4;
|
|
910
|
+
$[8] = t5;
|
|
911
|
+
$[9] = t6;
|
|
912
|
+
$[10] = t7;
|
|
913
|
+
$[11] = t8;
|
|
914
|
+
$[12] = t9;
|
|
915
|
+
} else {
|
|
916
|
+
initialValue = $[1];
|
|
917
|
+
props = $[2];
|
|
918
|
+
t1 = $[3];
|
|
919
|
+
t10 = $[4];
|
|
920
|
+
t2 = $[5];
|
|
921
|
+
t3 = $[6];
|
|
922
|
+
t4 = $[7];
|
|
923
|
+
t5 = $[8];
|
|
924
|
+
t6 = $[9];
|
|
925
|
+
t7 = $[10];
|
|
926
|
+
t8 = $[11];
|
|
927
|
+
t9 = $[12];
|
|
928
|
+
}
|
|
929
|
+
const id = t1 === undefined ? null : t1;
|
|
930
|
+
const title = t2 === undefined ? null : t2;
|
|
931
|
+
const size = t3 === undefined ? "xl" : t3;
|
|
932
|
+
const visible = t4 === undefined ? null : t4;
|
|
933
|
+
const autoClose = t5 === undefined ? true : t5;
|
|
934
|
+
const multiple = t6 === undefined ? false : t6;
|
|
935
|
+
const customRequestClose = t7 === undefined ? null : t7;
|
|
936
|
+
const onClosed = t8 === undefined ? null : t8;
|
|
937
|
+
const className = t9 === undefined ? null : t9;
|
|
938
|
+
const onChange = t10 === undefined ? null : t10;
|
|
939
|
+
const [opened, setOpened] = useState(true);
|
|
940
|
+
const [formOpen, setFormOpen] = useState(false);
|
|
941
|
+
const [value, setValue] = useState(initialValue);
|
|
942
|
+
let t11;
|
|
943
|
+
if ($[13] !== customRequestClose) {
|
|
944
|
+
t11 = customRequestClose ?? (() => {
|
|
945
|
+
setOpened(false);
|
|
946
|
+
});
|
|
947
|
+
$[13] = customRequestClose;
|
|
948
|
+
$[14] = t11;
|
|
949
|
+
} else {
|
|
950
|
+
t11 = $[14];
|
|
951
|
+
}
|
|
952
|
+
const requestClose = t11;
|
|
953
|
+
let t12;
|
|
954
|
+
if ($[15] !== autoClose || $[16] !== multiple || $[17] !== onChange || $[18] !== requestClose) {
|
|
955
|
+
t12 = newValue => {
|
|
956
|
+
if (!autoClose || multiple) {
|
|
957
|
+
setValue(newValue);
|
|
958
|
+
} else {
|
|
959
|
+
if (onChange !== null) {
|
|
960
|
+
onChange(newValue);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
if (autoClose && !multiple) {
|
|
964
|
+
requestClose();
|
|
965
|
+
}
|
|
966
|
+
};
|
|
967
|
+
$[15] = autoClose;
|
|
968
|
+
$[16] = multiple;
|
|
969
|
+
$[17] = onChange;
|
|
970
|
+
$[18] = requestClose;
|
|
971
|
+
$[19] = t12;
|
|
972
|
+
} else {
|
|
973
|
+
t12 = $[19];
|
|
974
|
+
}
|
|
975
|
+
const onGalleryChange = t12;
|
|
976
|
+
let t13;
|
|
977
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
978
|
+
t13 = () => {
|
|
979
|
+
setFormOpen(true);
|
|
980
|
+
};
|
|
981
|
+
$[20] = t13;
|
|
982
|
+
} else {
|
|
983
|
+
t13 = $[20];
|
|
984
|
+
}
|
|
985
|
+
const onFormOpen = t13;
|
|
986
|
+
let t14;
|
|
987
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
988
|
+
t14 = () => {
|
|
989
|
+
setFormOpen(false);
|
|
990
|
+
};
|
|
991
|
+
$[21] = t14;
|
|
992
|
+
} else {
|
|
993
|
+
t14 = $[21];
|
|
994
|
+
}
|
|
995
|
+
const onFormClose = t14;
|
|
996
|
+
let t15;
|
|
997
|
+
if ($[22] !== onChange || $[23] !== value) {
|
|
998
|
+
t15 = () => {
|
|
999
|
+
if (onChange !== null) {
|
|
1000
|
+
onChange(value);
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
$[22] = onChange;
|
|
1004
|
+
$[23] = value;
|
|
1005
|
+
$[24] = t15;
|
|
1006
|
+
} else {
|
|
1007
|
+
t15 = $[24];
|
|
1008
|
+
}
|
|
1009
|
+
const onClickSubmit = t15;
|
|
1010
|
+
const t16 = id ?? "media-gallery";
|
|
1011
|
+
let t17;
|
|
1012
|
+
if ($[25] !== title) {
|
|
1013
|
+
t17 = title || /*#__PURE__*/jsx(FormattedMessage, {
|
|
1014
|
+
id: "ZpoE9K",
|
|
1015
|
+
defaultMessage: "Select media"
|
|
1016
|
+
});
|
|
1017
|
+
$[25] = title;
|
|
1018
|
+
$[26] = t17;
|
|
1019
|
+
} else {
|
|
1020
|
+
t17 = $[26];
|
|
1021
|
+
}
|
|
1022
|
+
const t18 = visible ?? opened;
|
|
1023
|
+
const t19 = !formOpen;
|
|
1024
|
+
const t20 = !formOpen;
|
|
1025
|
+
let t21;
|
|
1026
|
+
if ($[27] !== className) {
|
|
1027
|
+
t21 = classNames(["modal-fullscreen-lg-down", className]);
|
|
1028
|
+
$[27] = className;
|
|
1029
|
+
$[28] = t21;
|
|
1030
|
+
} else {
|
|
1031
|
+
t21 = $[28];
|
|
1032
|
+
}
|
|
1033
|
+
let t22;
|
|
1034
|
+
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1035
|
+
t22 = /*#__PURE__*/jsx(FormattedMessage, {
|
|
1036
|
+
id: "rvOVCV",
|
|
1037
|
+
defaultMessage: "Confirm selection"
|
|
1038
|
+
});
|
|
1039
|
+
$[29] = t22;
|
|
1040
|
+
} else {
|
|
1041
|
+
t22 = $[29];
|
|
1042
|
+
}
|
|
1043
|
+
let t23;
|
|
1044
|
+
if ($[30] !== multiple || $[31] !== onGalleryChange || $[32] !== props || $[33] !== value) {
|
|
1045
|
+
t23 = /*#__PURE__*/jsx(MediaGallery, {
|
|
1046
|
+
isPicker: true,
|
|
1047
|
+
multiple: multiple,
|
|
1048
|
+
value: value,
|
|
1049
|
+
onChange: onGalleryChange,
|
|
1050
|
+
onMediaFormOpen: onFormOpen,
|
|
1051
|
+
onMediaFormClose: onFormClose,
|
|
1052
|
+
...props
|
|
1053
|
+
});
|
|
1054
|
+
$[30] = multiple;
|
|
1055
|
+
$[31] = onGalleryChange;
|
|
1056
|
+
$[32] = props;
|
|
1057
|
+
$[33] = value;
|
|
1058
|
+
$[34] = t23;
|
|
1059
|
+
} else {
|
|
1060
|
+
t23 = $[34];
|
|
1061
|
+
}
|
|
1062
|
+
let t24;
|
|
1063
|
+
if ($[35] !== onClickSubmit || $[36] !== onClosed || $[37] !== requestClose || $[38] !== size || $[39] !== t16 || $[40] !== t17 || $[41] !== t18 || $[42] !== t19 || $[43] !== t20 || $[44] !== t21 || $[45] !== t23) {
|
|
1064
|
+
t24 = /*#__PURE__*/jsx(Dialog, {
|
|
1065
|
+
id: t16,
|
|
1066
|
+
title: t17,
|
|
1067
|
+
size: size,
|
|
1068
|
+
visible: t18,
|
|
1069
|
+
withCancelButton: t19,
|
|
1070
|
+
withSubmitButton: t20,
|
|
1071
|
+
requestClose: requestClose,
|
|
1072
|
+
onClosed: onClosed,
|
|
1073
|
+
onClickSubmit: onClickSubmit,
|
|
1074
|
+
className: t21,
|
|
1075
|
+
submitButtonLabel: t22,
|
|
1076
|
+
children: t23
|
|
1077
|
+
});
|
|
1078
|
+
$[35] = onClickSubmit;
|
|
1079
|
+
$[36] = onClosed;
|
|
1080
|
+
$[37] = requestClose;
|
|
1081
|
+
$[38] = size;
|
|
1082
|
+
$[39] = t16;
|
|
1083
|
+
$[40] = t17;
|
|
1084
|
+
$[41] = t18;
|
|
1085
|
+
$[42] = t19;
|
|
1086
|
+
$[43] = t20;
|
|
1087
|
+
$[44] = t21;
|
|
1088
|
+
$[45] = t23;
|
|
1089
|
+
$[46] = t24;
|
|
1090
|
+
} else {
|
|
1091
|
+
t24 = $[46];
|
|
1092
|
+
}
|
|
1093
|
+
return t24;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
export { MediaGallery, MediaGalleryModal, MediaGallery as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/media-gallery",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.90-alpha.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
|
67
67
|
"@fortawesome/free-solid-svg-icons": "^7.2.0",
|
|
68
68
|
"@fortawesome/react-fontawesome": "^3.2.0",
|
|
69
|
-
"@micromag/core": "^0.4.
|
|
70
|
-
"@micromag/data": "^0.4.
|
|
71
|
-
"@panneau/medias": "^4.0.
|
|
69
|
+
"@micromag/core": "^0.4.90-alpha.1",
|
|
70
|
+
"@micromag/data": "^0.4.90-alpha.1",
|
|
71
|
+
"@panneau/medias": "^4.0.55",
|
|
72
72
|
"bootstrap": "^5.3.8",
|
|
73
73
|
"classnames": "^2.2.6",
|
|
74
74
|
"lodash": "^4.17.23",
|
|
@@ -80,6 +80,6 @@
|
|
|
80
80
|
"access": "public",
|
|
81
81
|
"registry": "https://registry.npmjs.org/"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "a13dd2242ee733dc3b3663354783f0b4395f9926",
|
|
84
84
|
"types": "es/index.d.ts"
|
|
85
85
|
}
|