@panneau/medias 4.0.27 → 4.0.29
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.js +12 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import { use, useMemo, createContext, useCallback, useState,
|
|
4
|
+
import { use, useMemo, createContext, useCallback, useState, useEffect } from 'react';
|
|
5
5
|
import { FormattedMessage } from 'react-intl';
|
|
6
6
|
import { useFieldComponent, usePanneauResource } from '@panneau/core/contexts';
|
|
7
7
|
import { useForm, useQuery } from '@panneau/core/hooks';
|
|
@@ -237,7 +237,9 @@ function MediaFrame(_ref) {
|
|
|
237
237
|
}) : /*#__PURE__*/jsx(ImageDisplay, {
|
|
238
238
|
className: "w-100",
|
|
239
239
|
value: value,
|
|
240
|
-
onClick: type === 'video' || type === 'audio' ? onClick : null
|
|
240
|
+
onClick: type === 'video' || type === 'audio' ? onClick : null,
|
|
241
|
+
maxWidth: null,
|
|
242
|
+
maxHeight: null
|
|
241
243
|
})
|
|
242
244
|
});
|
|
243
245
|
}
|
|
@@ -952,18 +954,19 @@ function MediasBrowser(_ref) {
|
|
|
952
954
|
var _count;
|
|
953
955
|
return (_count = (fullQuery || {}).count) !== null && _count !== void 0 ? _count : null;
|
|
954
956
|
}, [fullQuery]);
|
|
955
|
-
|
|
956
|
-
|
|
957
|
+
|
|
958
|
+
// Stabilize the filter query reference: only create a new object when filter values actually change.
|
|
959
|
+
// We use JSON.stringify as a stable primitive key so that useMemo only recomputes when values differ.
|
|
960
|
+
var queryJSON = useMemo(function () {
|
|
957
961
|
var _ref2 = fullQuery || {};
|
|
958
962
|
_ref2.page;
|
|
959
963
|
_ref2.count;
|
|
960
964
|
var params = _objectWithoutProperties(_ref2, _excluded$5);
|
|
961
|
-
|
|
962
|
-
if (JSON.stringify(queryRef.current) !== JSON.stringify(newQuery)) {
|
|
963
|
-
queryRef.current = newQuery;
|
|
964
|
-
}
|
|
965
|
-
return queryRef.current;
|
|
965
|
+
return Object.keys(params).length > 0 ? JSON.stringify(params) : null;
|
|
966
966
|
}, [fullQuery]);
|
|
967
|
+
var query = useMemo(function () {
|
|
968
|
+
return queryJSON !== null ? JSON.parse(queryJSON) : null;
|
|
969
|
+
}, [queryJSON]);
|
|
967
970
|
var _ref3 = permissions || {},
|
|
968
971
|
_ref3$create = _ref3.create,
|
|
969
972
|
canCreate = _ref3$create === void 0 ? true : _ref3$create,
|
|
@@ -1431,7 +1434,6 @@ function MediasPicker(_ref) {
|
|
|
1431
1434
|
return Array.isArray(initialSelectedItems) ? initialSelectedItems : [initialSelectedItems];
|
|
1432
1435
|
}, []);
|
|
1433
1436
|
|
|
1434
|
-
// // Mostly for testing
|
|
1435
1437
|
// const [selectedItems, setSelectedItems] = useState<PickerSelection>(
|
|
1436
1438
|
// initialSelectedItems || null,
|
|
1437
1439
|
// );
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/medias",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.29",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "8c6871368e91e2cc741c5286da554d6203faaa9b"
|
|
81
81
|
}
|