@panneau/modal-medias-picker 3.0.181 → 3.0.183
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 +21 -29
- package/lib/index.js +21 -29
- package/package.json +5 -5
package/es/index.js
CHANGED
@@ -7,27 +7,23 @@ import { FormattedMessage } from 'react-intl';
|
|
7
7
|
import { MediasResourcePicker, MediasPickerContainer } from '@panneau/medias';
|
8
8
|
import Dialog from '@panneau/modal-dialog';
|
9
9
|
|
10
|
-
var _excluded = ["id", "resource", "title", "
|
10
|
+
var _excluded = ["id", "resource", "title", "onChange", "onClose", "confirmButton", "cancelButton", "multiple"];
|
11
11
|
var propTypes = {
|
12
12
|
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
13
13
|
resource: PropTypes.string,
|
14
14
|
title: PropTypes.string,
|
15
15
|
multiple: PropTypes.bool,
|
16
|
-
onConfirm: PropTypes.func,
|
17
|
-
onClose: PropTypes.func,
|
18
16
|
onChange: PropTypes.func,
|
19
|
-
|
20
|
-
confirmButton: PropTypes.
|
21
|
-
|
22
|
-
cancelButton: PropTypes.any
|
17
|
+
onClose: PropTypes.func,
|
18
|
+
confirmButton: PropTypes.shape({}),
|
19
|
+
cancelButton: PropTypes.shape({})
|
23
20
|
};
|
24
21
|
var defaultProps = {
|
25
22
|
resource: null,
|
26
23
|
title: null,
|
27
24
|
multiple: false,
|
28
|
-
onConfirm: null,
|
29
|
-
onClose: null,
|
30
25
|
onChange: null,
|
26
|
+
onClose: null,
|
31
27
|
confirmButton: null,
|
32
28
|
cancelButton: null
|
33
29
|
};
|
@@ -35,31 +31,27 @@ function MediasPickerModal(_ref) {
|
|
35
31
|
var id = _ref.id,
|
36
32
|
resource = _ref.resource,
|
37
33
|
title = _ref.title,
|
38
|
-
onClose = _ref.onClose,
|
39
34
|
onChange = _ref.onChange,
|
40
|
-
|
35
|
+
onClose = _ref.onClose,
|
41
36
|
confirmButton = _ref.confirmButton,
|
42
37
|
cancelButton = _ref.cancelButton,
|
43
38
|
multiple = _ref.multiple,
|
44
39
|
props = _objectWithoutProperties(_ref, _excluded);
|
45
40
|
var _useState = useState(null),
|
46
41
|
_useState2 = _slicedToArray(_useState, 2),
|
47
|
-
|
48
|
-
|
49
|
-
var
|
50
|
-
if (
|
51
|
-
|
42
|
+
selectedItems = _useState2[0],
|
43
|
+
setSelectedItems = _useState2[1];
|
44
|
+
var onConfirm = useCallback(function (items) {
|
45
|
+
if (onChange !== null) {
|
46
|
+
onChange(items);
|
52
47
|
}
|
53
48
|
if (onClose !== null) {
|
54
49
|
onClose();
|
55
50
|
}
|
56
|
-
}, [
|
51
|
+
}, [onChange, onClose]);
|
57
52
|
var onSelectionChange = useCallback(function (items) {
|
58
|
-
|
59
|
-
|
60
|
-
}
|
61
|
-
setCount(items !== null ? items.length : 0);
|
62
|
-
}, [onChange, setCount]);
|
53
|
+
setSelectedItems(items);
|
54
|
+
}, [setSelectedItems]);
|
63
55
|
return /*#__PURE__*/React.createElement(Dialog, {
|
64
56
|
id: id || 'picker',
|
65
57
|
size: "xl",
|
@@ -89,21 +81,21 @@ function MediasPickerModal(_ref) {
|
|
89
81
|
}),
|
90
82
|
theme: 'primary',
|
91
83
|
onClick: onConfirm,
|
92
|
-
disabled:
|
84
|
+
disabled: selectedItems === null || multiple && selectedItems.length === 0
|
93
85
|
}, confirmButton)]
|
94
86
|
}, resource !== null ? /*#__PURE__*/React.createElement(MediasResourcePicker, Object.assign({}, props, {
|
95
87
|
resource: resource,
|
96
|
-
|
97
|
-
|
88
|
+
onSelectionChange: onSelectionChange,
|
89
|
+
onChange: onChange,
|
98
90
|
onClose: onClose,
|
99
|
-
|
91
|
+
multipleSelection: multiple,
|
100
92
|
withoutButtons: true
|
101
93
|
})) : /*#__PURE__*/React.createElement(MediasPickerContainer, Object.assign({}, props, {
|
102
94
|
resource: resource,
|
103
|
-
|
104
|
-
|
95
|
+
onSelectionChange: onSelectionChange,
|
96
|
+
onChange: onChange,
|
105
97
|
onClose: onClose,
|
106
|
-
|
98
|
+
multipleSelection: multiple,
|
107
99
|
withoutButtons: true
|
108
100
|
})));
|
109
101
|
}
|
package/lib/index.js
CHANGED
@@ -11,27 +11,23 @@ var reactIntl = require('react-intl');
|
|
11
11
|
var medias = require('@panneau/medias');
|
12
12
|
var Dialog = require('@panneau/modal-dialog');
|
13
13
|
|
14
|
-
var _excluded = ["id", "resource", "title", "
|
14
|
+
var _excluded = ["id", "resource", "title", "onChange", "onClose", "confirmButton", "cancelButton", "multiple"];
|
15
15
|
var propTypes = {
|
16
16
|
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
17
17
|
resource: PropTypes.string,
|
18
18
|
title: PropTypes.string,
|
19
19
|
multiple: PropTypes.bool,
|
20
|
-
onConfirm: PropTypes.func,
|
21
|
-
onClose: PropTypes.func,
|
22
20
|
onChange: PropTypes.func,
|
23
|
-
|
24
|
-
confirmButton: PropTypes.
|
25
|
-
|
26
|
-
cancelButton: PropTypes.any
|
21
|
+
onClose: PropTypes.func,
|
22
|
+
confirmButton: PropTypes.shape({}),
|
23
|
+
cancelButton: PropTypes.shape({})
|
27
24
|
};
|
28
25
|
var defaultProps = {
|
29
26
|
resource: null,
|
30
27
|
title: null,
|
31
28
|
multiple: false,
|
32
|
-
onConfirm: null,
|
33
|
-
onClose: null,
|
34
29
|
onChange: null,
|
30
|
+
onClose: null,
|
35
31
|
confirmButton: null,
|
36
32
|
cancelButton: null
|
37
33
|
};
|
@@ -39,31 +35,27 @@ function MediasPickerModal(_ref) {
|
|
39
35
|
var id = _ref.id,
|
40
36
|
resource = _ref.resource,
|
41
37
|
title = _ref.title,
|
42
|
-
onClose = _ref.onClose,
|
43
38
|
onChange = _ref.onChange,
|
44
|
-
|
39
|
+
onClose = _ref.onClose,
|
45
40
|
confirmButton = _ref.confirmButton,
|
46
41
|
cancelButton = _ref.cancelButton,
|
47
42
|
multiple = _ref.multiple,
|
48
43
|
props = _objectWithoutProperties(_ref, _excluded);
|
49
44
|
var _useState = React.useState(null),
|
50
45
|
_useState2 = _slicedToArray(_useState, 2),
|
51
|
-
|
52
|
-
|
53
|
-
var
|
54
|
-
if (
|
55
|
-
|
46
|
+
selectedItems = _useState2[0],
|
47
|
+
setSelectedItems = _useState2[1];
|
48
|
+
var onConfirm = React.useCallback(function (items) {
|
49
|
+
if (onChange !== null) {
|
50
|
+
onChange(items);
|
56
51
|
}
|
57
52
|
if (onClose !== null) {
|
58
53
|
onClose();
|
59
54
|
}
|
60
|
-
}, [
|
55
|
+
}, [onChange, onClose]);
|
61
56
|
var onSelectionChange = React.useCallback(function (items) {
|
62
|
-
|
63
|
-
|
64
|
-
}
|
65
|
-
setCount(items !== null ? items.length : 0);
|
66
|
-
}, [onChange, setCount]);
|
57
|
+
setSelectedItems(items);
|
58
|
+
}, [setSelectedItems]);
|
67
59
|
return /*#__PURE__*/React.createElement(Dialog, {
|
68
60
|
id: id || 'picker',
|
69
61
|
size: "xl",
|
@@ -93,21 +85,21 @@ function MediasPickerModal(_ref) {
|
|
93
85
|
}),
|
94
86
|
theme: 'primary',
|
95
87
|
onClick: onConfirm,
|
96
|
-
disabled:
|
88
|
+
disabled: selectedItems === null || multiple && selectedItems.length === 0
|
97
89
|
}, confirmButton)]
|
98
90
|
}, resource !== null ? /*#__PURE__*/React.createElement(medias.MediasResourcePicker, Object.assign({}, props, {
|
99
91
|
resource: resource,
|
100
|
-
|
101
|
-
|
92
|
+
onSelectionChange: onSelectionChange,
|
93
|
+
onChange: onChange,
|
102
94
|
onClose: onClose,
|
103
|
-
|
95
|
+
multipleSelection: multiple,
|
104
96
|
withoutButtons: true
|
105
97
|
})) : /*#__PURE__*/React.createElement(medias.MediasPickerContainer, Object.assign({}, props, {
|
106
98
|
resource: resource,
|
107
|
-
|
108
|
-
|
99
|
+
onSelectionChange: onSelectionChange,
|
100
|
+
onChange: onChange,
|
109
101
|
onClose: onClose,
|
110
|
-
|
102
|
+
multipleSelection: multiple,
|
111
103
|
withoutButtons: true
|
112
104
|
})));
|
113
105
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@panneau/modal-medias-picker",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.183",
|
4
4
|
"description": "Medias picker modal",
|
5
5
|
"keywords": [
|
6
6
|
"javascript"
|
@@ -46,9 +46,9 @@
|
|
46
46
|
},
|
47
47
|
"dependencies": {
|
48
48
|
"@babel/runtime": "^7.12.5",
|
49
|
-
"@panneau/core": "^3.0.
|
50
|
-
"@panneau/medias": "^3.0.
|
51
|
-
"@panneau/modal-dialog": "^3.0.
|
49
|
+
"@panneau/core": "^3.0.182",
|
50
|
+
"@panneau/medias": "^3.0.183",
|
51
|
+
"@panneau/modal-dialog": "^3.0.182",
|
52
52
|
"@uppy/core": "^3.9.1",
|
53
53
|
"@uppy/dashboard": "^3.7.3",
|
54
54
|
"@uppy/drag-drop": "^3.0.3",
|
@@ -64,5 +64,5 @@
|
|
64
64
|
"publishConfig": {
|
65
65
|
"access": "public"
|
66
66
|
},
|
67
|
-
"gitHead": "
|
67
|
+
"gitHead": "1a43436f1a5e0db3a0b2951138e9280b21220467"
|
68
68
|
}
|