@panneau/medias 3.0.182 → 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 +25 -4
- package/lib/index.js +25 -4
- package/package.json +2 -2
package/es/index.js
CHANGED
@@ -14,6 +14,7 @@ import MediaPlayer from '@panneau/element-media-player';
|
|
14
14
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
15
15
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
16
16
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
17
|
+
import isArray from 'lodash/isArray';
|
17
18
|
import uniqBy from 'lodash/uniqBy';
|
18
19
|
import { PropTypes as PropTypes$1 } from '@panneau/core';
|
19
20
|
import Buttons from '@panneau/element-buttons';
|
@@ -733,7 +734,8 @@ var defaultColumns = [{
|
|
733
734
|
var defaultFilters = [{
|
734
735
|
id: 'search',
|
735
736
|
component: 'search',
|
736
|
-
name: 'search'
|
737
|
+
name: 'search',
|
738
|
+
width: 220
|
737
739
|
}, {
|
738
740
|
id: 'types',
|
739
741
|
component: 'select',
|
@@ -818,6 +820,7 @@ var propTypes$5 = {
|
|
818
820
|
layout: PropTypes.string,
|
819
821
|
layouts: PropTypes.arrayOf(PropTypes.shape({})),
|
820
822
|
theme: PropTypes.string,
|
823
|
+
onUpload: PropTypes.func,
|
821
824
|
onItemsChange: PropTypes.func,
|
822
825
|
onLayoutChange: PropTypes.func,
|
823
826
|
selectable: PropTypes.bool,
|
@@ -835,7 +838,6 @@ var defaultProps$5 = {
|
|
835
838
|
items: null,
|
836
839
|
extraItems: null,
|
837
840
|
types: null,
|
838
|
-
buttons: null,
|
839
841
|
filters: defaultFilters,
|
840
842
|
columns: defaultColumns,
|
841
843
|
fields: defaultFields,
|
@@ -854,6 +856,7 @@ var defaultProps$5 = {
|
|
854
856
|
})
|
855
857
|
}],
|
856
858
|
theme: null,
|
859
|
+
onUpload: null,
|
857
860
|
onItemsChange: null,
|
858
861
|
onLayoutChange: null,
|
859
862
|
selectable: null,
|
@@ -879,6 +882,7 @@ function MediasBrowser(_ref) {
|
|
879
882
|
initialLayout = _ref.layout,
|
880
883
|
layouts = _ref.layouts,
|
881
884
|
theme = _ref.theme,
|
885
|
+
onUpload = _ref.onUpload,
|
882
886
|
onItemsChange = _ref.onItemsChange,
|
883
887
|
onLayoutChange = _ref.onLayoutChange,
|
884
888
|
selectable = _ref.selectable,
|
@@ -959,7 +963,8 @@ function MediasBrowser(_ref) {
|
|
959
963
|
lastPage = _useMedias$pagination2.lastPage,
|
960
964
|
total = _useMedias$pagination2.total,
|
961
965
|
_useMedias$pages = _useMedias.pages,
|
962
|
-
pages = _useMedias$pages === void 0 ? null : _useMedias$pages
|
966
|
+
pages = _useMedias$pages === void 0 ? null : _useMedias$pages,
|
967
|
+
reload = _useMedias.reload;
|
963
968
|
|
964
969
|
// For picker
|
965
970
|
useEffect(function () {
|
@@ -995,6 +1000,21 @@ function MediasBrowser(_ref) {
|
|
995
1000
|
setCurrentMedia(null);
|
996
1001
|
updateItem(item);
|
997
1002
|
}, [setCurrentMedia, updateItem]);
|
1003
|
+
var onMediaUploaded = useCallback(function (medias) {
|
1004
|
+
var rawMedias = isArray(medias) ? medias : [medias];
|
1005
|
+
if (onUpload !== null) {
|
1006
|
+
onUpload(rawMedias).then(function (newMedias) {
|
1007
|
+
if (onSelectionChange !== null) {
|
1008
|
+
onSelectionChange(newMedias);
|
1009
|
+
reload();
|
1010
|
+
}
|
1011
|
+
});
|
1012
|
+
}
|
1013
|
+
if (onSelectionChange !== null) {
|
1014
|
+
onSelectionChange(rawMedias);
|
1015
|
+
reload();
|
1016
|
+
}
|
1017
|
+
}, [onUpload]);
|
998
1018
|
var pagination = /*#__PURE__*/React.createElement(Pagination, {
|
999
1019
|
page: page,
|
1000
1020
|
lastPage: lastPage,
|
@@ -1106,7 +1126,8 @@ function MediasBrowser(_ref) {
|
|
1106
1126
|
className: "ms-auto w-auto text-nowrap mt-2",
|
1107
1127
|
withButton: true,
|
1108
1128
|
withoutMedia: true,
|
1109
|
-
uppyConfig: uppyConfig
|
1129
|
+
uppyConfig: uppyConfig,
|
1130
|
+
onChange: onMediaUploaded
|
1110
1131
|
}) : null), /*#__PURE__*/React.createElement("div", {
|
1111
1132
|
className: classNames(['d-flex', 'mt-1', 'mb-3', {
|
1112
1133
|
'justify-content-between': hasLayouts,
|
package/lib/index.js
CHANGED
@@ -16,6 +16,7 @@ var MediaPlayer = require('@panneau/element-media-player');
|
|
16
16
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
17
17
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
18
18
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
19
|
+
var isArray = require('lodash/isArray');
|
19
20
|
var uniqBy = require('lodash/uniqBy');
|
20
21
|
var core = require('@panneau/core');
|
21
22
|
var Buttons = require('@panneau/element-buttons');
|
@@ -735,7 +736,8 @@ var defaultColumns = [{
|
|
735
736
|
var defaultFilters = [{
|
736
737
|
id: 'search',
|
737
738
|
component: 'search',
|
738
|
-
name: 'search'
|
739
|
+
name: 'search',
|
740
|
+
width: 220
|
739
741
|
}, {
|
740
742
|
id: 'types',
|
741
743
|
component: 'select',
|
@@ -820,6 +822,7 @@ var propTypes$5 = {
|
|
820
822
|
layout: PropTypes.string,
|
821
823
|
layouts: PropTypes.arrayOf(PropTypes.shape({})),
|
822
824
|
theme: PropTypes.string,
|
825
|
+
onUpload: PropTypes.func,
|
823
826
|
onItemsChange: PropTypes.func,
|
824
827
|
onLayoutChange: PropTypes.func,
|
825
828
|
selectable: PropTypes.bool,
|
@@ -837,7 +840,6 @@ var defaultProps$5 = {
|
|
837
840
|
items: null,
|
838
841
|
extraItems: null,
|
839
842
|
types: null,
|
840
|
-
buttons: null,
|
841
843
|
filters: defaultFilters,
|
842
844
|
columns: defaultColumns,
|
843
845
|
fields: defaultFields,
|
@@ -856,6 +858,7 @@ var defaultProps$5 = {
|
|
856
858
|
})
|
857
859
|
}],
|
858
860
|
theme: null,
|
861
|
+
onUpload: null,
|
859
862
|
onItemsChange: null,
|
860
863
|
onLayoutChange: null,
|
861
864
|
selectable: null,
|
@@ -881,6 +884,7 @@ function MediasBrowser(_ref) {
|
|
881
884
|
initialLayout = _ref.layout,
|
882
885
|
layouts = _ref.layouts,
|
883
886
|
theme = _ref.theme,
|
887
|
+
onUpload = _ref.onUpload,
|
884
888
|
onItemsChange = _ref.onItemsChange,
|
885
889
|
onLayoutChange = _ref.onLayoutChange,
|
886
890
|
selectable = _ref.selectable,
|
@@ -961,7 +965,8 @@ function MediasBrowser(_ref) {
|
|
961
965
|
lastPage = _useMedias$pagination2.lastPage,
|
962
966
|
total = _useMedias$pagination2.total,
|
963
967
|
_useMedias$pages = _useMedias.pages,
|
964
|
-
pages = _useMedias$pages === void 0 ? null : _useMedias$pages
|
968
|
+
pages = _useMedias$pages === void 0 ? null : _useMedias$pages,
|
969
|
+
reload = _useMedias.reload;
|
965
970
|
|
966
971
|
// For picker
|
967
972
|
React.useEffect(function () {
|
@@ -997,6 +1002,21 @@ function MediasBrowser(_ref) {
|
|
997
1002
|
setCurrentMedia(null);
|
998
1003
|
updateItem(item);
|
999
1004
|
}, [setCurrentMedia, updateItem]);
|
1005
|
+
var onMediaUploaded = React.useCallback(function (medias) {
|
1006
|
+
var rawMedias = isArray(medias) ? medias : [medias];
|
1007
|
+
if (onUpload !== null) {
|
1008
|
+
onUpload(rawMedias).then(function (newMedias) {
|
1009
|
+
if (onSelectionChange !== null) {
|
1010
|
+
onSelectionChange(newMedias);
|
1011
|
+
reload();
|
1012
|
+
}
|
1013
|
+
});
|
1014
|
+
}
|
1015
|
+
if (onSelectionChange !== null) {
|
1016
|
+
onSelectionChange(rawMedias);
|
1017
|
+
reload();
|
1018
|
+
}
|
1019
|
+
}, [onUpload]);
|
1000
1020
|
var pagination = /*#__PURE__*/React.createElement(Pagination, {
|
1001
1021
|
page: page,
|
1002
1022
|
lastPage: lastPage,
|
@@ -1108,7 +1128,8 @@ function MediasBrowser(_ref) {
|
|
1108
1128
|
className: "ms-auto w-auto text-nowrap mt-2",
|
1109
1129
|
withButton: true,
|
1110
1130
|
withoutMedia: true,
|
1111
|
-
uppyConfig: uppyConfig
|
1131
|
+
uppyConfig: uppyConfig,
|
1132
|
+
onChange: onMediaUploaded
|
1112
1133
|
}) : null), /*#__PURE__*/React.createElement("div", {
|
1113
1134
|
className: classNames(['d-flex', 'mt-1', 'mb-3', {
|
1114
1135
|
'justify-content-between': hasLayouts,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@panneau/medias",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.183",
|
4
4
|
"description": "",
|
5
5
|
"keywords": [
|
6
6
|
"javascript"
|
@@ -69,5 +69,5 @@
|
|
69
69
|
"publishConfig": {
|
70
70
|
"access": "public"
|
71
71
|
},
|
72
|
-
"gitHead": "
|
72
|
+
"gitHead": "1a43436f1a5e0db3a0b2951138e9280b21220467"
|
73
73
|
}
|