indicator-ui 0.0.331 → 0.0.332
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
|
@@ -42066,7 +42066,11 @@ function useSmartPosition() {
|
|
|
42066
42066
|
_args$$position = _args$.position,
|
|
42067
42067
|
position = _args$$position === void 0 ? 'fixed' : _args$$position,
|
|
42068
42068
|
_args$$weights = _args$.weights,
|
|
42069
|
-
weights = _args$$weights === void 0 ? DEFAULT_WEIGHTS : _args$$weights
|
|
42069
|
+
weights = _args$$weights === void 0 ? DEFAULT_WEIGHTS : _args$$weights,
|
|
42070
|
+
_args$$alignX = _args$.alignX,
|
|
42071
|
+
alignX = _args$$alignX === void 0 ? 'center' : _args$$alignX,
|
|
42072
|
+
_args$$alignY = _args$.alignY,
|
|
42073
|
+
alignY = _args$$alignY === void 0 ? 'center' : _args$$alignY;
|
|
42070
42074
|
var getSizeOfObj = function getSizeOfObj() {
|
|
42071
42075
|
var _ref$current;
|
|
42072
42076
|
var rect = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect();
|
|
@@ -42168,10 +42172,22 @@ function useSmartPosition() {
|
|
|
42168
42172
|
_getPosOfParent6 = _slicedToArray(_getPosOfParent5, 1),
|
|
42169
42173
|
pX = _getPosOfParent6[0];
|
|
42170
42174
|
var newLeft;
|
|
42175
|
+
var stepX;
|
|
42176
|
+
switch (alignX) {
|
|
42177
|
+
case "center":
|
|
42178
|
+
stepX = w / 2;
|
|
42179
|
+
break;
|
|
42180
|
+
case "left":
|
|
42181
|
+
stepX = pW / 2;
|
|
42182
|
+
break;
|
|
42183
|
+
case "right":
|
|
42184
|
+
stepX = w - pW / 2;
|
|
42185
|
+
break;
|
|
42186
|
+
}
|
|
42171
42187
|
if (position === 'fixed') {
|
|
42172
|
-
newLeft = pX + pW / 2 -
|
|
42188
|
+
newLeft = pX + pW / 2 - stepX;
|
|
42173
42189
|
} else {
|
|
42174
|
-
newLeft = pW / 2 -
|
|
42190
|
+
newLeft = pW / 2 - stepX;
|
|
42175
42191
|
}
|
|
42176
42192
|
if (ref.current) {
|
|
42177
42193
|
ref.current.style.left = "".concat(newLeft, "px");
|
|
@@ -42222,10 +42238,22 @@ function useSmartPosition() {
|
|
|
42222
42238
|
_getSizeOfParent8 = _slicedToArray(_getSizeOfParent7, 2),
|
|
42223
42239
|
pH = _getSizeOfParent8[1];
|
|
42224
42240
|
var newTop;
|
|
42241
|
+
var stepY;
|
|
42242
|
+
switch (alignY) {
|
|
42243
|
+
case "center":
|
|
42244
|
+
stepY = h / 2;
|
|
42245
|
+
break;
|
|
42246
|
+
case "top":
|
|
42247
|
+
stepY = pH / 2;
|
|
42248
|
+
break;
|
|
42249
|
+
case "bottom":
|
|
42250
|
+
stepY = h - pH / 2;
|
|
42251
|
+
break;
|
|
42252
|
+
}
|
|
42225
42253
|
if (position === 'fixed') {
|
|
42226
|
-
newTop = pY + pH / 2 -
|
|
42254
|
+
newTop = pY + pH / 2 - stepY;
|
|
42227
42255
|
} else {
|
|
42228
|
-
newTop = pH / 2 -
|
|
42256
|
+
newTop = pH / 2 - stepY;
|
|
42229
42257
|
}
|
|
42230
42258
|
if (ref.current) {
|
|
42231
42259
|
ref.current.style.top = "".concat(newTop, "px");
|