@panneau/modal-medias-picker 4.0.39 → 4.0.40-alpha.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/dist/index.d.ts +7 -6
- package/dist/index.js +180 -81
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Media, Resource } from '@panneau/core';
|
|
2
3
|
|
|
3
4
|
interface MediasPickerModalProps {
|
|
4
|
-
id: string
|
|
5
|
-
value?:
|
|
6
|
-
resource?: string | null;
|
|
5
|
+
id: string;
|
|
6
|
+
value?: Media | Media[] | null;
|
|
7
|
+
resource?: Resource | string | null;
|
|
7
8
|
title?: string | null;
|
|
8
9
|
multiple?: boolean;
|
|
9
|
-
onChange?: ((items:
|
|
10
|
-
|
|
10
|
+
onChange?: ((items: Media[]) => void) | null;
|
|
11
|
+
onClosed?: (() => void) | null;
|
|
11
12
|
confirmButton?: Record<string, unknown> | null;
|
|
12
13
|
cancelButton?: Record<string, unknown> | null;
|
|
13
14
|
}
|
|
14
|
-
declare function MediasPickerModal({ id, value, resource, title, onChange,
|
|
15
|
+
declare function MediasPickerModal({ id, value, resource, title, onChange, onClosed, confirmButton, cancelButton, multiple, ...props }: MediasPickerModalProps): react_jsx_runtime.JSX.Element;
|
|
15
16
|
|
|
16
17
|
export { MediasPickerModal as default };
|
package/dist/index.js
CHANGED
|
@@ -1,104 +1,203 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
|
-
import { useState, useCallback } from 'react';
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
5
3
|
import { FormattedMessage } from 'react-intl';
|
|
6
4
|
import { MediasResourcePicker, MediasPickerContainer } from '@panneau/medias';
|
|
7
5
|
import Dialog from '@panneau/modal-dialog';
|
|
8
6
|
import { jsx } from 'react/jsx-runtime';
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
8
|
+
function MediasPickerModal(t0) {
|
|
9
|
+
const $ = c(35);
|
|
10
|
+
let id;
|
|
11
|
+
let props;
|
|
12
|
+
let t1;
|
|
13
|
+
let t2;
|
|
14
|
+
let t3;
|
|
15
|
+
let t4;
|
|
16
|
+
let t5;
|
|
17
|
+
let t6;
|
|
18
|
+
let t7;
|
|
19
|
+
let t8;
|
|
20
|
+
if ($[0] !== t0) {
|
|
21
|
+
({
|
|
22
|
+
id,
|
|
23
|
+
value: t1,
|
|
24
|
+
resource: t2,
|
|
25
|
+
title: t3,
|
|
26
|
+
onChange: t4,
|
|
27
|
+
onClosed: t5,
|
|
28
|
+
confirmButton: t6,
|
|
29
|
+
cancelButton: t7,
|
|
30
|
+
multiple: t8,
|
|
31
|
+
...props
|
|
32
|
+
} = t0);
|
|
33
|
+
$[0] = t0;
|
|
34
|
+
$[1] = id;
|
|
35
|
+
$[2] = props;
|
|
36
|
+
$[3] = t1;
|
|
37
|
+
$[4] = t2;
|
|
38
|
+
$[5] = t3;
|
|
39
|
+
$[6] = t4;
|
|
40
|
+
$[7] = t5;
|
|
41
|
+
$[8] = t6;
|
|
42
|
+
$[9] = t7;
|
|
43
|
+
$[10] = t8;
|
|
44
|
+
} else {
|
|
45
|
+
id = $[1];
|
|
46
|
+
props = $[2];
|
|
47
|
+
t1 = $[3];
|
|
48
|
+
t2 = $[4];
|
|
49
|
+
t3 = $[5];
|
|
50
|
+
t4 = $[6];
|
|
51
|
+
t5 = $[7];
|
|
52
|
+
t6 = $[8];
|
|
53
|
+
t7 = $[9];
|
|
54
|
+
t8 = $[10];
|
|
55
|
+
}
|
|
56
|
+
const value = t1 === undefined ? null : t1;
|
|
57
|
+
const resource = t2 === undefined ? null : t2;
|
|
58
|
+
const title = t3 === undefined ? null : t3;
|
|
59
|
+
const onChange = t4 === undefined ? null : t4;
|
|
60
|
+
const onClosed = t5 === undefined ? null : t5;
|
|
61
|
+
const confirmButton = t6 === undefined ? null : t6;
|
|
62
|
+
const cancelButton = t7 === undefined ? null : t7;
|
|
63
|
+
const multiple = t8 === undefined ? false : t8;
|
|
64
|
+
const [opened, setOpened] = useState(true);
|
|
65
|
+
let t9;
|
|
66
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
67
|
+
t9 = () => {
|
|
68
|
+
setOpened(false);
|
|
69
|
+
};
|
|
70
|
+
$[11] = t9;
|
|
71
|
+
} else {
|
|
72
|
+
t9 = $[11];
|
|
73
|
+
}
|
|
74
|
+
const requestClose = t9;
|
|
75
|
+
const [selectedItems, setSelectedItems] = useState(value);
|
|
76
|
+
let t10;
|
|
77
|
+
if ($[12] !== onChange || $[13] !== selectedItems) {
|
|
78
|
+
t10 = () => {
|
|
79
|
+
if (onChange !== null) {
|
|
80
|
+
onChange(selectedItems);
|
|
81
|
+
}
|
|
82
|
+
requestClose();
|
|
83
|
+
};
|
|
84
|
+
$[12] = onChange;
|
|
85
|
+
$[13] = selectedItems;
|
|
86
|
+
$[14] = t10;
|
|
87
|
+
} else {
|
|
88
|
+
t10 = $[14];
|
|
89
|
+
}
|
|
90
|
+
const onConfirm = t10;
|
|
91
|
+
let t11;
|
|
92
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
93
|
+
t11 = items => {
|
|
94
|
+
setSelectedItems(items);
|
|
95
|
+
};
|
|
96
|
+
$[15] = t11;
|
|
97
|
+
} else {
|
|
98
|
+
t11 = $[15];
|
|
99
|
+
}
|
|
100
|
+
const onSelectionChange = t11;
|
|
101
|
+
const [mediaFormOpen, setMediaFormOpen] = useState(false);
|
|
102
|
+
let t12;
|
|
103
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
104
|
+
t12 = () => {
|
|
105
|
+
setMediaFormOpen(true);
|
|
106
|
+
};
|
|
107
|
+
$[16] = t12;
|
|
108
|
+
} else {
|
|
109
|
+
t12 = $[16];
|
|
110
|
+
}
|
|
111
|
+
const onMediaFormOpen = t12;
|
|
112
|
+
let t13;
|
|
113
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
114
|
+
t13 = () => {
|
|
115
|
+
setMediaFormOpen(false);
|
|
116
|
+
};
|
|
117
|
+
$[17] = t13;
|
|
118
|
+
} else {
|
|
119
|
+
t13 = $[17];
|
|
120
|
+
}
|
|
121
|
+
const onMediaFormClose = t13;
|
|
122
|
+
const t14 = id || "medias-picker";
|
|
123
|
+
let t15;
|
|
124
|
+
if ($[18] !== cancelButton || $[19] !== confirmButton || $[20] !== mediaFormOpen || $[21] !== onConfirm) {
|
|
125
|
+
t15 = !mediaFormOpen ? [{
|
|
126
|
+
id: "cancel",
|
|
63
127
|
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
64
|
-
id: "PyxZY2"
|
|
65
|
-
defaultMessage: [{
|
|
66
|
-
"type": 0,
|
|
67
|
-
"value": "Cancel"
|
|
68
|
-
}]
|
|
128
|
+
id: "PyxZY2"
|
|
69
129
|
}),
|
|
70
|
-
theme:
|
|
71
|
-
onClick:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
130
|
+
theme: "secondary",
|
|
131
|
+
onClick: requestClose,
|
|
132
|
+
...cancelButton
|
|
133
|
+
}, {
|
|
134
|
+
id: "confirm",
|
|
75
135
|
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
76
|
-
id: "rvOVCV"
|
|
77
|
-
defaultMessage: [{
|
|
78
|
-
"type": 0,
|
|
79
|
-
"value": "Confirm selection"
|
|
80
|
-
}]
|
|
136
|
+
id: "rvOVCV"
|
|
81
137
|
}),
|
|
82
|
-
theme:
|
|
83
|
-
onClick: onConfirm
|
|
84
|
-
|
|
85
|
-
|
|
138
|
+
theme: "primary",
|
|
139
|
+
onClick: onConfirm,
|
|
140
|
+
...confirmButton
|
|
141
|
+
}] : null;
|
|
142
|
+
$[18] = cancelButton;
|
|
143
|
+
$[19] = confirmButton;
|
|
144
|
+
$[20] = mediaFormOpen;
|
|
145
|
+
$[21] = onConfirm;
|
|
146
|
+
$[22] = t15;
|
|
147
|
+
} else {
|
|
148
|
+
t15 = $[22];
|
|
149
|
+
}
|
|
150
|
+
let t16;
|
|
151
|
+
if ($[23] !== multiple || $[24] !== props || $[25] !== resource || $[26] !== selectedItems) {
|
|
152
|
+
t16 = resource !== null ? /*#__PURE__*/jsx(MediasResourcePicker, {
|
|
153
|
+
...props,
|
|
86
154
|
value: selectedItems,
|
|
87
155
|
resource: resource,
|
|
88
156
|
onChange: onSelectionChange,
|
|
89
|
-
onClose:
|
|
157
|
+
onClose: requestClose,
|
|
90
158
|
multiple: multiple,
|
|
91
159
|
onMediaFormOpen: onMediaFormOpen,
|
|
92
160
|
onMediaFormClose: onMediaFormClose
|
|
93
|
-
})
|
|
161
|
+
}) : /*#__PURE__*/jsx(MediasPickerContainer, {
|
|
162
|
+
...props,
|
|
94
163
|
value: selectedItems,
|
|
95
164
|
onChange: onSelectionChange,
|
|
96
|
-
onClose:
|
|
165
|
+
onClose: requestClose,
|
|
97
166
|
multiple: multiple,
|
|
98
167
|
onMediaFormOpen: onMediaFormOpen,
|
|
99
168
|
onMediaFormClose: onMediaFormClose
|
|
100
|
-
})
|
|
101
|
-
|
|
169
|
+
});
|
|
170
|
+
$[23] = multiple;
|
|
171
|
+
$[24] = props;
|
|
172
|
+
$[25] = resource;
|
|
173
|
+
$[26] = selectedItems;
|
|
174
|
+
$[27] = t16;
|
|
175
|
+
} else {
|
|
176
|
+
t16 = $[27];
|
|
177
|
+
}
|
|
178
|
+
let t17;
|
|
179
|
+
if ($[28] !== onClosed || $[29] !== opened || $[30] !== t14 || $[31] !== t15 || $[32] !== t16 || $[33] !== title) {
|
|
180
|
+
t17 = /*#__PURE__*/jsx(Dialog, {
|
|
181
|
+
id: t14,
|
|
182
|
+
size: "xl",
|
|
183
|
+
visible: opened,
|
|
184
|
+
requestClose: requestClose,
|
|
185
|
+
onClosed: onClosed,
|
|
186
|
+
title: title,
|
|
187
|
+
buttons: t15,
|
|
188
|
+
children: t16
|
|
189
|
+
});
|
|
190
|
+
$[28] = onClosed;
|
|
191
|
+
$[29] = opened;
|
|
192
|
+
$[30] = t14;
|
|
193
|
+
$[31] = t15;
|
|
194
|
+
$[32] = t16;
|
|
195
|
+
$[33] = title;
|
|
196
|
+
$[34] = t17;
|
|
197
|
+
} else {
|
|
198
|
+
t17 = $[34];
|
|
199
|
+
}
|
|
200
|
+
return t17;
|
|
102
201
|
}
|
|
103
202
|
|
|
104
203
|
export { MediasPickerModal as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/modal-medias-picker",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.40-alpha.3",
|
|
4
4
|
"description": "Medias picker modal",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@babel/runtime": "^7.28.6",
|
|
55
|
-
"@panneau/core": "^4.0.
|
|
56
|
-
"@panneau/medias": "^4.0.
|
|
57
|
-
"@panneau/modal-dialog": "^4.0.
|
|
55
|
+
"@panneau/core": "^4.0.40-alpha.3",
|
|
56
|
+
"@panneau/medias": "^4.0.40-alpha.3",
|
|
57
|
+
"@panneau/modal-dialog": "^4.0.40-alpha.3",
|
|
58
58
|
"@uppy/core": "^5.1.1",
|
|
59
59
|
"@uppy/dashboard": "^5.0.4",
|
|
60
60
|
"@uppy/react": "^5.1.1",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "1735964a2702ae0480b642225286e4184f36680d"
|
|
69
69
|
}
|