indicator-ui 0.0.307 → 0.0.309
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
CHANGED
|
@@ -41699,15 +41699,15 @@ var DEFAULT_WEIGHTS = [[0.5, 1.5, 0.5], [1, 0, 1], [0.5, 1.5, 0.5]];
|
|
|
41699
41699
|
* Позволяет определить оптимальное положение элемента,
|
|
41700
41700
|
* чтобы он не выходил за пределы видимой области.
|
|
41701
41701
|
*
|
|
41702
|
-
* @param ref Ref на элемент, который нужно позиционировать
|
|
41703
41702
|
* @param [options.parentRef=undfined] Ref на контейнер, относительно которого будет происходить позиционирование. Если не задан, то будет позиционировать относительно изначального положения.
|
|
41704
41703
|
* @param [options.windowRef=window] Ref на контейнер, в области видимости которого будет происходить позиционирование. По умолчанию позиционирует в главном окне (`window`).
|
|
41705
|
-
* @param [options.position='fixed']
|
|
41706
|
-
* @param [options.offset=4]
|
|
41704
|
+
* @param [options.position='fixed']
|
|
41705
|
+
* @param [options.offset=4]
|
|
41707
41706
|
*
|
|
41708
41707
|
* @returns void
|
|
41709
41708
|
*
|
|
41710
41709
|
* @example
|
|
41710
|
+
* @param args
|
|
41711
41711
|
*/
|
|
41712
41712
|
function useSmartPosition() {
|
|
41713
41713
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -41954,6 +41954,14 @@ function useSmartPosition() {
|
|
|
41954
41954
|
(_callbacksMatrix$max$ = (_callbacksMatrix$max$2 = callbacksMatrix[max.pos[0]])[max.pos[1]]) === null || _callbacksMatrix$max$ === void 0 || _callbacksMatrix$max$.call(_callbacksMatrix$max$2);
|
|
41955
41955
|
}
|
|
41956
41956
|
};
|
|
41957
|
+
var configurateObj = function configurateObj() {
|
|
41958
|
+
if (ref !== null && ref !== void 0 && ref.current) {
|
|
41959
|
+
ref.current.style.position = position;
|
|
41960
|
+
}
|
|
41961
|
+
if (position === 'absolute' && parentRef !== null && parentRef !== void 0 && parentRef.current) {
|
|
41962
|
+
parentRef.current.style.position = 'relative';
|
|
41963
|
+
}
|
|
41964
|
+
};
|
|
41957
41965
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
41958
41966
|
var observer = new ResizeObserver(resizeListener);
|
|
41959
41967
|
var clearListeners = function clearListeners() {
|
|
@@ -41968,6 +41976,7 @@ function useSmartPosition() {
|
|
|
41968
41976
|
};
|
|
41969
41977
|
setUpListeners();
|
|
41970
41978
|
resizeListener();
|
|
41979
|
+
configurateObj();
|
|
41971
41980
|
return clearListeners;
|
|
41972
41981
|
}, []);
|
|
41973
41982
|
}
|