@panneau/modal-medias-picker 4.0.48 → 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.
- package/dist/index.d.ts +5 -5
- package/dist/index.js +108 -82
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { Media, Resource } from '@panneau/core';
|
|
2
|
+
import { Media, Resource, Button } from '@panneau/core';
|
|
3
3
|
|
|
4
4
|
interface MediasPickerModalProps {
|
|
5
5
|
id: string;
|
|
@@ -7,11 +7,11 @@ interface MediasPickerModalProps {
|
|
|
7
7
|
resource?: Resource | string | null;
|
|
8
8
|
title?: string | null;
|
|
9
9
|
multiple?: boolean;
|
|
10
|
-
onChange?: ((items: Media[]) => void) | null;
|
|
10
|
+
onChange?: ((items: Media | Media[] | null) => void) | null;
|
|
11
11
|
onClosed?: (() => void) | null;
|
|
12
|
-
confirmButton?:
|
|
13
|
-
cancelButton?:
|
|
12
|
+
confirmButton?: Button | null;
|
|
13
|
+
cancelButton?: Button | null;
|
|
14
14
|
}
|
|
15
|
-
declare function MediasPickerModal({ id, value, resource, title, onChange, onClosed, confirmButton, cancelButton, multiple, ...props }: MediasPickerModalProps): react_jsx_runtime.JSX.Element;
|
|
15
|
+
declare function MediasPickerModal({ id, value: initialValue, resource, title, onChange, onClosed, confirmButton, cancelButton, multiple, ...props }: MediasPickerModalProps): react_jsx_runtime.JSX.Element;
|
|
16
16
|
|
|
17
17
|
export { MediasPickerModal as default };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { c } from 'react/compiler-runtime';
|
|
2
|
+
import isArray from 'lodash/isArray';
|
|
3
|
+
import isObject from 'lodash/isObject';
|
|
2
4
|
import { useState } from 'react';
|
|
3
5
|
import { FormattedMessage } from 'react-intl';
|
|
4
6
|
import { MediasResourcePicker, MediasPickerContainer } from '@panneau/medias';
|
|
@@ -6,7 +8,7 @@ import Dialog from '@panneau/modal-dialog';
|
|
|
6
8
|
import { jsx } from 'react/jsx-runtime';
|
|
7
9
|
|
|
8
10
|
function MediasPickerModal(t0) {
|
|
9
|
-
const $ = c(
|
|
11
|
+
const $ = c(43);
|
|
10
12
|
let id;
|
|
11
13
|
let props;
|
|
12
14
|
let t1;
|
|
@@ -53,7 +55,7 @@ function MediasPickerModal(t0) {
|
|
|
53
55
|
t7 = $[9];
|
|
54
56
|
t8 = $[10];
|
|
55
57
|
}
|
|
56
|
-
const
|
|
58
|
+
const initialValue = t1 === undefined ? null : t1;
|
|
57
59
|
const resource = t2 === undefined ? null : t2;
|
|
58
60
|
const title = t3 === undefined ? null : t3;
|
|
59
61
|
const onChange = t4 === undefined ? null : t4;
|
|
@@ -72,89 +74,104 @@ function MediasPickerModal(t0) {
|
|
|
72
74
|
t9 = $[11];
|
|
73
75
|
}
|
|
74
76
|
const requestClose = t9;
|
|
75
|
-
const [selectedItems, setSelectedItems] = useState(value);
|
|
76
77
|
let t10;
|
|
77
|
-
if ($[12] !==
|
|
78
|
-
t10 = () =>
|
|
78
|
+
if ($[12] !== initialValue) {
|
|
79
|
+
t10 = () => isObject(initialValue) && !isArray(initialValue) ? [initialValue] : initialValue;
|
|
80
|
+
$[12] = initialValue;
|
|
81
|
+
$[13] = t10;
|
|
82
|
+
} else {
|
|
83
|
+
t10 = $[13];
|
|
84
|
+
}
|
|
85
|
+
const [selectedItems, setSelectedItems] = useState(t10);
|
|
86
|
+
let t11;
|
|
87
|
+
if ($[14] !== multiple || $[15] !== onChange || $[16] !== selectedItems) {
|
|
88
|
+
t11 = () => {
|
|
79
89
|
if (onChange !== null) {
|
|
80
|
-
onChange(selectedItems);
|
|
90
|
+
onChange(!multiple ? selectedItems?.[0] || null : selectedItems);
|
|
81
91
|
}
|
|
82
92
|
requestClose();
|
|
83
93
|
};
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
$[
|
|
94
|
+
$[14] = multiple;
|
|
95
|
+
$[15] = onChange;
|
|
96
|
+
$[16] = selectedItems;
|
|
97
|
+
$[17] = t11;
|
|
87
98
|
} else {
|
|
88
|
-
|
|
99
|
+
t11 = $[17];
|
|
89
100
|
}
|
|
90
|
-
const onConfirm =
|
|
91
|
-
let
|
|
92
|
-
if ($[
|
|
93
|
-
|
|
101
|
+
const onConfirm = t11;
|
|
102
|
+
let t12;
|
|
103
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
104
|
+
t12 = items => {
|
|
94
105
|
setSelectedItems(items);
|
|
95
106
|
};
|
|
96
|
-
$[
|
|
107
|
+
$[18] = t12;
|
|
97
108
|
} else {
|
|
98
|
-
|
|
109
|
+
t12 = $[18];
|
|
99
110
|
}
|
|
100
|
-
const onSelectionChange =
|
|
111
|
+
const onSelectionChange = t12;
|
|
101
112
|
const [mediaFormOpen, setMediaFormOpen] = useState(false);
|
|
102
|
-
let
|
|
103
|
-
if ($[
|
|
104
|
-
|
|
113
|
+
let t13;
|
|
114
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
115
|
+
t13 = () => {
|
|
105
116
|
setMediaFormOpen(true);
|
|
106
117
|
};
|
|
107
|
-
$[
|
|
118
|
+
$[19] = t13;
|
|
108
119
|
} else {
|
|
109
|
-
|
|
120
|
+
t13 = $[19];
|
|
110
121
|
}
|
|
111
|
-
const onMediaFormOpen =
|
|
112
|
-
let
|
|
113
|
-
if ($[
|
|
114
|
-
|
|
122
|
+
const onMediaFormOpen = t13;
|
|
123
|
+
let t14;
|
|
124
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
125
|
+
t14 = () => {
|
|
115
126
|
setMediaFormOpen(false);
|
|
116
127
|
};
|
|
117
|
-
$[
|
|
128
|
+
$[20] = t14;
|
|
118
129
|
} else {
|
|
119
|
-
|
|
130
|
+
t14 = $[20];
|
|
120
131
|
}
|
|
121
|
-
const onMediaFormClose =
|
|
122
|
-
const
|
|
123
|
-
let
|
|
124
|
-
if ($[
|
|
125
|
-
|
|
126
|
-
id: "
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
theme: "secondary",
|
|
131
|
-
onClick: requestClose,
|
|
132
|
-
...cancelButton
|
|
133
|
-
}, {
|
|
134
|
-
id: "confirm",
|
|
135
|
-
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
136
|
-
id: "rvOVCV"
|
|
137
|
-
}),
|
|
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;
|
|
132
|
+
const onMediaFormClose = t14;
|
|
133
|
+
const t15 = id || "medias-picker";
|
|
134
|
+
let t16;
|
|
135
|
+
if ($[21] !== title) {
|
|
136
|
+
t16 = title ?? /*#__PURE__*/jsx(FormattedMessage, {
|
|
137
|
+
id: "DV8/HU"
|
|
138
|
+
});
|
|
139
|
+
$[21] = title;
|
|
140
|
+
$[22] = t16;
|
|
147
141
|
} else {
|
|
148
|
-
|
|
142
|
+
t16 = $[22];
|
|
149
143
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
144
|
+
const t17 = !mediaFormOpen;
|
|
145
|
+
const t18 = !mediaFormOpen;
|
|
146
|
+
let t19;
|
|
147
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
148
|
+
t19 = /*#__PURE__*/jsx(FormattedMessage, {
|
|
149
|
+
id: "rvOVCV"
|
|
150
|
+
});
|
|
151
|
+
$[23] = t19;
|
|
152
|
+
} else {
|
|
153
|
+
t19 = $[23];
|
|
154
|
+
}
|
|
155
|
+
const t20 = selectedItems === null || selectedItems.length === 0;
|
|
156
|
+
let t21;
|
|
157
|
+
if ($[24] !== confirmButton || $[25] !== t20) {
|
|
158
|
+
t21 = {
|
|
159
|
+
...confirmButton,
|
|
160
|
+
disabled: t20
|
|
161
|
+
};
|
|
162
|
+
$[24] = confirmButton;
|
|
163
|
+
$[25] = t20;
|
|
164
|
+
$[26] = t21;
|
|
165
|
+
} else {
|
|
166
|
+
t21 = $[26];
|
|
167
|
+
}
|
|
168
|
+
let t22;
|
|
169
|
+
if ($[27] !== multiple || $[28] !== props || $[29] !== resource || $[30] !== selectedItems) {
|
|
170
|
+
t22 = resource !== null ? /*#__PURE__*/jsx(MediasResourcePicker, {
|
|
153
171
|
...props,
|
|
154
172
|
value: selectedItems,
|
|
155
173
|
resource: resource,
|
|
156
174
|
onChange: onSelectionChange,
|
|
157
|
-
onClose: requestClose,
|
|
158
175
|
multiple: multiple,
|
|
159
176
|
onMediaFormOpen: onMediaFormOpen,
|
|
160
177
|
onMediaFormClose: onMediaFormClose
|
|
@@ -162,42 +179,51 @@ function MediasPickerModal(t0) {
|
|
|
162
179
|
...props,
|
|
163
180
|
value: selectedItems,
|
|
164
181
|
onChange: onSelectionChange,
|
|
165
|
-
onClose: requestClose,
|
|
166
182
|
multiple: multiple,
|
|
167
183
|
onMediaFormOpen: onMediaFormOpen,
|
|
168
184
|
onMediaFormClose: onMediaFormClose
|
|
169
185
|
});
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
186
|
+
$[27] = multiple;
|
|
187
|
+
$[28] = props;
|
|
188
|
+
$[29] = resource;
|
|
189
|
+
$[30] = selectedItems;
|
|
190
|
+
$[31] = t22;
|
|
175
191
|
} else {
|
|
176
|
-
|
|
192
|
+
t22 = $[31];
|
|
177
193
|
}
|
|
178
|
-
let
|
|
179
|
-
if ($[
|
|
180
|
-
|
|
181
|
-
id:
|
|
194
|
+
let t23;
|
|
195
|
+
if ($[32] !== cancelButton || $[33] !== onClosed || $[34] !== onConfirm || $[35] !== opened || $[36] !== t15 || $[37] !== t16 || $[38] !== t17 || $[39] !== t18 || $[40] !== t21 || $[41] !== t22) {
|
|
196
|
+
t23 = /*#__PURE__*/jsx(Dialog, {
|
|
197
|
+
id: t15,
|
|
182
198
|
size: "xl",
|
|
183
199
|
visible: opened,
|
|
184
200
|
requestClose: requestClose,
|
|
185
201
|
onClosed: onClosed,
|
|
186
|
-
title:
|
|
187
|
-
|
|
188
|
-
|
|
202
|
+
title: t16,
|
|
203
|
+
withCancelButton: t17,
|
|
204
|
+
withSubmitButton: t18,
|
|
205
|
+
submitButtonLabel: t19,
|
|
206
|
+
submitButton: t21,
|
|
207
|
+
className: "modal-fullscreen-lg-down",
|
|
208
|
+
cancelButton: cancelButton,
|
|
209
|
+
onClickSubmit: onConfirm,
|
|
210
|
+
children: t22
|
|
189
211
|
});
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
195
|
-
$[
|
|
196
|
-
$[
|
|
212
|
+
$[32] = cancelButton;
|
|
213
|
+
$[33] = onClosed;
|
|
214
|
+
$[34] = onConfirm;
|
|
215
|
+
$[35] = opened;
|
|
216
|
+
$[36] = t15;
|
|
217
|
+
$[37] = t16;
|
|
218
|
+
$[38] = t17;
|
|
219
|
+
$[39] = t18;
|
|
220
|
+
$[40] = t21;
|
|
221
|
+
$[41] = t22;
|
|
222
|
+
$[42] = t23;
|
|
197
223
|
} else {
|
|
198
|
-
|
|
224
|
+
t23 = $[42];
|
|
199
225
|
}
|
|
200
|
-
return
|
|
226
|
+
return t23;
|
|
201
227
|
}
|
|
202
228
|
|
|
203
229
|
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.55",
|
|
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.55",
|
|
56
|
+
"@panneau/medias": "^4.0.55",
|
|
57
|
+
"@panneau/modal-dialog": "^4.0.55",
|
|
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": "1c9183567fc5bf98ba10fa57c63cf2ed2ae4a054"
|
|
69
69
|
}
|