intelicoreact 1.4.43 → 1.4.45
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.
|
@@ -501,7 +501,7 @@ const Dropdown = _ref => {
|
|
|
501
501
|
(0, _react.useEffect)(() => {
|
|
502
502
|
if (!isDoNotPullOutListOfMainContainer || dropdownRef.current) {
|
|
503
503
|
initListContainer();
|
|
504
|
-
if (isDefaultOpened) setIsOpen(true);
|
|
504
|
+
if (isDefaultOpened && !isMobileProp) setIsOpen(true);
|
|
505
505
|
}
|
|
506
506
|
}, [isDoNotPullOutListOfMainContainer, dropdownRef.current]);
|
|
507
507
|
(0, _react.useLayoutEffect)(() => {
|
|
@@ -110,6 +110,7 @@ const TagsDropdown = _ref => {
|
|
|
110
110
|
const isMobile = isMobileProp && withMobileLogic && window.screen.width <= 768;
|
|
111
111
|
const [dropdownId] = (0, _react.useState)(id || fieldKey || Math.random().toString(16).slice(2));
|
|
112
112
|
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
|
113
|
+
const [listPos, setListPos] = (0, _react.useState)(null);
|
|
113
114
|
const [initListHeight, setInitListHeight] = (0, _react.useState)(null);
|
|
114
115
|
const [isScrollableList, setIsScrollableList] = (0, _react.useState)(null);
|
|
115
116
|
const [isFixedMaxHeight, setIsFixedMaxHeight] = (0, _react.useState)(false);
|
|
@@ -273,19 +274,34 @@ const TagsDropdown = _ref => {
|
|
|
273
274
|
const maxSelectorWrapperHeight = 500 - ((_listHeader$getBoundi = listHeader === null || listHeader === void 0 ? void 0 : (_listHeader$getBoundi2 = listHeader.getBoundingClientRect()) === null || _listHeader$getBoundi2 === void 0 ? void 0 : _listHeader$getBoundi2.height) !== null && _listHeader$getBoundi !== void 0 ? _listHeader$getBoundi : 0) - ((_listFooter$getBoundi = listFooter === null || listFooter === void 0 ? void 0 : (_listFooter$getBoundi2 = listFooter.getBoundingClientRect()) === null || _listFooter$getBoundi2 === void 0 ? void 0 : _listFooter$getBoundi2.height) !== null && _listFooter$getBoundi !== void 0 ? _listFooter$getBoundi : 0);
|
|
274
275
|
|
|
275
276
|
if (!isMobile || !withMobileLogic) {
|
|
276
|
-
var _getComputedStyle2, _dropdownListMaxHeigh;
|
|
277
|
+
var _getComputedStyle2, _dropdownListMaxHeigh, _customTriggerRef$cur, _customTriggerRef$cur2, _customTriggerRef$cur3;
|
|
277
278
|
|
|
278
279
|
const dropdownListMaxHeightInPx = (_getComputedStyle2 = getComputedStyle(dropdownList)) === null || _getComputedStyle2 === void 0 ? void 0 : _getComputedStyle2.maxHeight;
|
|
279
280
|
const maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_dropdownListMaxHeigh = dropdownListMaxHeightInPx === null || dropdownListMaxHeightInPx === void 0 ? void 0 : dropdownListMaxHeightInPx.replace("px", "")) !== null && _dropdownListMaxHeigh !== void 0 ? _dropdownListMaxHeigh : 0, 10);
|
|
280
281
|
if (initListHeight === null && !isNaN(maxHeight)) setInitListHeight(maxHeight);
|
|
281
282
|
if (selectorWrapperHeight > maxHeight && !isNaN(maxHeight)) selectorWrapperHeight = maxHeight - 2 * margin;
|
|
282
|
-
const toTop = top - margin;
|
|
283
|
+
const toTop = renderCustomTrigger ? top - margin - ((_customTriggerRef$cur = customTriggerRef === null || customTriggerRef === void 0 ? void 0 : (_customTriggerRef$cur2 = customTriggerRef.current) === null || _customTriggerRef$cur2 === void 0 ? void 0 : (_customTriggerRef$cur3 = _customTriggerRef$cur2.getBoundingClientRect()) === null || _customTriggerRef$cur3 === void 0 ? void 0 : _customTriggerRef$cur3.height) !== null && _customTriggerRef$cur !== void 0 ? _customTriggerRef$cur : 0) : top - margin;
|
|
283
284
|
const toBottom = windowHeight - top - height - margin * 2;
|
|
284
|
-
|
|
285
|
-
|
|
285
|
+
let listPosition = listPos;
|
|
286
|
+
|
|
287
|
+
if (!listPos && options.length) {
|
|
288
|
+
listPosition = toTop < toBottom || toBottom >= selectorWrapperHeight ? "bottom" : "top";
|
|
289
|
+
setListPos(listPosition);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (selectorWrapperHeight > (listPosition === "top" ? toTop : toBottom)) {
|
|
293
|
+
selectorWrapperHeight = (listPosition === "top" ? toTop : toBottom) - 3 * margin;
|
|
294
|
+
|
|
295
|
+
if (selectorWrapperHeight < 200) {
|
|
296
|
+
selectorWrapperHeight = 200;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
selectorWrapper.style.maxHeight = "".concat(selectorWrapperHeight, "px");
|
|
300
|
+
}
|
|
301
|
+
|
|
286
302
|
listContainer.style.minWidth = "".concat(width, "px");
|
|
287
303
|
listContainer.style.left = "".concat(left, "px");
|
|
288
|
-
listContainer.style.top = "".concat(
|
|
304
|
+
listContainer.style.top = "".concat(listPosition === "bottom" ? top + height : top - selectorWrapperHeight - 2 * margin, "px");
|
|
289
305
|
} else {
|
|
290
306
|
dropdownList.style.maxHeight = "".concat(maxSelectorWrapperHeight, "px");
|
|
291
307
|
}
|
|
@@ -899,7 +915,7 @@ const TagsDropdown = _ref => {
|
|
|
899
915
|
|
|
900
916
|
(0, _react.useLayoutEffect)(() => {
|
|
901
917
|
initListContainer();
|
|
902
|
-
if (isDefaultOpened) setIsOpen(true);
|
|
918
|
+
if (isDefaultOpened && !isMobileProp) setIsOpen(true);
|
|
903
919
|
return () => {
|
|
904
920
|
var _getListContainer2, _getListContainerWrap;
|
|
905
921
|
|
|
@@ -910,21 +926,14 @@ const TagsDropdown = _ref => {
|
|
|
910
926
|
(0, _react.useLayoutEffect)(() => {
|
|
911
927
|
var _getListContainer3;
|
|
912
928
|
|
|
913
|
-
const onResize = () => {
|
|
914
|
-
setListContainerStyles();
|
|
915
|
-
setEditOptionModalStyles();
|
|
916
|
-
};
|
|
917
|
-
|
|
918
929
|
if (!isMobile) {
|
|
919
|
-
window.addEventListener("resize", onResize);
|
|
920
930
|
window.addEventListener("mousewheel", closeList);
|
|
921
|
-
window.addEventListener("
|
|
931
|
+
window.addEventListener("wheel", closeList);
|
|
922
932
|
window.addEventListener("touchmove", closeList);
|
|
923
933
|
window.addEventListener("mouseup", handleClickOutside);
|
|
924
934
|
} else {
|
|
925
|
-
window.removeEventListener("resize", onResize);
|
|
926
935
|
window.removeEventListener("mousewheel", closeList);
|
|
927
|
-
window.removeEventListener("
|
|
936
|
+
window.removeEventListener("wheel", closeList);
|
|
928
937
|
window.removeEventListener("touchmove", closeList);
|
|
929
938
|
window.removeEventListener("mouseup", handleClickOutside);
|
|
930
939
|
}
|
|
@@ -933,18 +942,19 @@ const TagsDropdown = _ref => {
|
|
|
933
942
|
return () => {
|
|
934
943
|
var _getListContainer4;
|
|
935
944
|
|
|
936
|
-
window.removeEventListener("resize", onResize);
|
|
937
945
|
window.removeEventListener("mousewheel", closeList);
|
|
938
946
|
window.removeEventListener("mouseup", handleClickOutside);
|
|
939
|
-
window.removeEventListener("
|
|
947
|
+
window.removeEventListener("wheel", closeList);
|
|
940
948
|
window.removeEventListener("touchmove", closeList);
|
|
941
949
|
(_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 ? void 0 : _getListContainer4.removeEventListener("click", closeList);
|
|
942
950
|
};
|
|
943
951
|
}, [getListContainer, isMobile]);
|
|
944
952
|
(0, _react.useLayoutEffect)(() => {
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
953
|
+
if (isOpen) {
|
|
954
|
+
setListContainerStyles();
|
|
955
|
+
setEditOptionModalStyles();
|
|
956
|
+
}
|
|
957
|
+
}, [isOpen, optionsProp, chosenOptions, searchValue, isMobile, dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : (_dropdownListWrapperR2 = dropdownListWrapperRef.current) === null || _dropdownListWrapperR2 === void 0 ? void 0 : (_dropdownListWrapperR3 = _dropdownListWrapperR2.getBoundingClientRect()) === null || _dropdownListWrapperR3 === void 0 ? void 0 : _dropdownListWrapperR3.height, recalculateListContainerStylesTrigger]);
|
|
948
958
|
(0, _react.useEffect)(() => {
|
|
949
959
|
if (isUseLocalOptionsStore && chosenOptions.length !== Object.keys(localOptionsStore).length) {
|
|
950
960
|
options.map(option => {
|
|
@@ -990,6 +1000,8 @@ const TagsDropdown = _ref => {
|
|
|
990
1000
|
|
|
991
1001
|
(_getListContainer6 = getListContainer()) === null || _getListContainer6 === void 0 ? void 0 : _getListContainer6.classList.remove("tags-dropdown__container--opened");
|
|
992
1002
|
if (withSearchInputInList) setSearchValueInterceptor("");
|
|
1003
|
+
setListPos(null);
|
|
1004
|
+
setSearchValue("");
|
|
993
1005
|
}
|
|
994
1006
|
}, [isOpen]);
|
|
995
1007
|
(0, _react.useEffect)(() => {
|
|
@@ -20,12 +20,13 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
20
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
21
|
|
|
22
22
|
const RC = "textarea";
|
|
23
|
-
|
|
24
|
-
const Textarea = _ref => {
|
|
23
|
+
const Textarea = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
25
24
|
let {
|
|
26
25
|
id,
|
|
27
26
|
value,
|
|
28
27
|
onChange,
|
|
28
|
+
onFocus,
|
|
29
|
+
onBlur,
|
|
29
30
|
placeholder,
|
|
30
31
|
disabled,
|
|
31
32
|
className,
|
|
@@ -34,12 +35,19 @@ const Textarea = _ref => {
|
|
|
34
35
|
withAutoGrow,
|
|
35
36
|
onKeyDown = () => {}
|
|
36
37
|
} = _ref;
|
|
37
|
-
const
|
|
38
|
+
const internalRef = (0, _react.useRef)();
|
|
39
|
+
const textareaRef = ref || internalRef;
|
|
38
40
|
const handle = {
|
|
39
41
|
change: val => {
|
|
40
42
|
let inputValue = val;
|
|
41
43
|
if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
|
|
42
44
|
onChange(inputValue);
|
|
45
|
+
},
|
|
46
|
+
focus: e => {
|
|
47
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
48
|
+
},
|
|
49
|
+
blur: e => {
|
|
50
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
43
51
|
}
|
|
44
52
|
};
|
|
45
53
|
|
|
@@ -64,9 +72,10 @@ const Textarea = _ref => {
|
|
|
64
72
|
placeholder: placeholder,
|
|
65
73
|
disabled: disabled,
|
|
66
74
|
onKeyDown: onKeyDown,
|
|
67
|
-
ref: textareaRef
|
|
75
|
+
ref: textareaRef,
|
|
76
|
+
onFocus: handle.focus,
|
|
77
|
+
onBlur: handle.blur
|
|
68
78
|
}));
|
|
69
|
-
};
|
|
70
|
-
|
|
79
|
+
});
|
|
71
80
|
var _default = Textarea;
|
|
72
81
|
exports.default = _default;
|