intelicoreact 1.4.8 → 1.4.9
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.
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var _reactFeather = require("react-feather");
|
|
11
|
-
var
|
|
11
|
+
var _Spinner = _interopRequireDefault(require("./../../Layout/Spinner/Spinner"));
|
|
12
12
|
require("./Tag.scss");
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -21,6 +21,10 @@ const Tag = _ref => {
|
|
|
21
21
|
removeItem,
|
|
22
22
|
name,
|
|
23
23
|
color,
|
|
24
|
+
isPopup,
|
|
25
|
+
popupInfo,
|
|
26
|
+
popupInfoContent,
|
|
27
|
+
popupClassName,
|
|
24
28
|
id,
|
|
25
29
|
isNoDismiss = true,
|
|
26
30
|
onClick = () => {},
|
|
@@ -28,6 +32,37 @@ const Tag = _ref => {
|
|
|
28
32
|
testIdRemove = "test-tag-remove"
|
|
29
33
|
} = _ref;
|
|
30
34
|
const [isTagHover, setIsTagHover] = (0, _react.useState)(false);
|
|
35
|
+
const [isTagPopupOpened, setIsTagPopupOpened] = (0, _react.useState)(false);
|
|
36
|
+
const handle = {
|
|
37
|
+
onTagClick: () => {
|
|
38
|
+
if (isPopup) {
|
|
39
|
+
setIsTagPopupOpened(!isTagPopupOpened);
|
|
40
|
+
}
|
|
41
|
+
onClick(id);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// закрытие по кликаутсайду
|
|
46
|
+
const handleClickOutside = () => {
|
|
47
|
+
setIsTagPopupOpened(false);
|
|
48
|
+
};
|
|
49
|
+
(0, _react.useEffect)(() => {
|
|
50
|
+
document.addEventListener("click", handleClickOutside, true);
|
|
51
|
+
return () => {
|
|
52
|
+
document.removeEventListener("click", handleClickOutside, true);
|
|
53
|
+
};
|
|
54
|
+
}, []);
|
|
55
|
+
|
|
56
|
+
// закрытие по скролу
|
|
57
|
+
(0, _react.useEffect)(() => {
|
|
58
|
+
const handleScroll = () => {
|
|
59
|
+
setIsTagPopupOpened(false);
|
|
60
|
+
};
|
|
61
|
+
window.addEventListener("scroll", handleScroll, true);
|
|
62
|
+
return () => {
|
|
63
|
+
window.removeEventListener("scroll", handleScroll, true);
|
|
64
|
+
};
|
|
65
|
+
}, []);
|
|
31
66
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
32
67
|
onMouseEnter: () => setIsTagHover(true),
|
|
33
68
|
onMouseLeave: () => setIsTagHover(false),
|
|
@@ -38,7 +73,7 @@ const Tag = _ref => {
|
|
|
38
73
|
style: {
|
|
39
74
|
background: color
|
|
40
75
|
},
|
|
41
|
-
onClick: () =>
|
|
76
|
+
onClick: () => handle.onTagClick()
|
|
42
77
|
}, warning && typeof warning === "string" && /*#__PURE__*/_react.default.createElement(_reactFeather.AlertTriangle, {
|
|
43
78
|
className: "advanced-tags--warning-icon mr5"
|
|
44
79
|
}), warning && typeof warning === "string" && isTagHover && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -51,6 +86,10 @@ const Tag = _ref => {
|
|
|
51
86
|
className: "tag__button"
|
|
52
87
|
}, /*#__PURE__*/_react.default.createElement(_reactFeather.X, {
|
|
53
88
|
className: "color--text"
|
|
54
|
-
}))
|
|
89
|
+
})), isTagPopupOpened && /*#__PURE__*/_react.default.createElement("div", {
|
|
90
|
+
className: (0, _classnames.default)("tag__popup", popupClassName)
|
|
91
|
+
}, !popupInfo ? /*#__PURE__*/_react.default.createElement(_Spinner.default, {
|
|
92
|
+
size: "small"
|
|
93
|
+
}) : popupInfoContent));
|
|
55
94
|
};
|
|
56
95
|
var _default = exports.default = Tag;
|
|
@@ -86,3 +86,28 @@
|
|
|
86
86
|
max-height: 16px;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
+
|
|
90
|
+
.tag__popup {
|
|
91
|
+
position: absolute;
|
|
92
|
+
top: 34px;
|
|
93
|
+
background: #FFFFFF;
|
|
94
|
+
box-shadow: 0px 4px 25px 0px rgba(0, 0, 0, 0.25);
|
|
95
|
+
z-index: 1;
|
|
96
|
+
right: 0px;
|
|
97
|
+
border-radius: 4px;
|
|
98
|
+
min-height: 60px;
|
|
99
|
+
min-width: 200px;
|
|
100
|
+
box-sizing: border-box;
|
|
101
|
+
padding: 8px;
|
|
102
|
+
|
|
103
|
+
&:before {
|
|
104
|
+
content: '';
|
|
105
|
+
position: absolute;
|
|
106
|
+
width: 12px;
|
|
107
|
+
height: 12px;
|
|
108
|
+
background: #FFFFFF;
|
|
109
|
+
top: -6px;
|
|
110
|
+
right: 15px;
|
|
111
|
+
transform: rotate(45deg);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _utils = require("
|
|
10
|
+
var _utils = require("lib/src/Functions/utils");
|
|
11
11
|
var _Tag = _interopRequireDefault(require("../Tag/Tag"));
|
|
12
12
|
require("./TagList.scss");
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -15,14 +15,16 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
15
15
|
const TagList = _ref => {
|
|
16
16
|
let {
|
|
17
17
|
className,
|
|
18
|
-
warning,
|
|
19
18
|
onTagClick,
|
|
20
19
|
removeItem = null,
|
|
21
20
|
items = [],
|
|
22
21
|
withToggle = true,
|
|
23
22
|
disableShowMore = false,
|
|
24
23
|
shownItemsCount = "auto",
|
|
25
|
-
testId = "test-taglist"
|
|
24
|
+
testId = "test-taglist",
|
|
25
|
+
isPopup,
|
|
26
|
+
popupInfo,
|
|
27
|
+
popupInfoContent
|
|
26
28
|
} = _ref;
|
|
27
29
|
const wrapperRef = (0, _react.useRef)(null);
|
|
28
30
|
const [wrapperWidth, setWrapperWidth] = (0, _react.useState)(-1);
|
|
@@ -31,7 +33,6 @@ const TagList = _ref => {
|
|
|
31
33
|
const [renderItemsCount, setRenderItemsCount] = (0, _react.useState)(-1);
|
|
32
34
|
const [renderAll, setRenderAll] = (0, _react.useState)(!withToggle);
|
|
33
35
|
const [lastCheckTime, setLastCheckTime] = (0, _react.useState)(-1);
|
|
34
|
-
const [checkTagsRefDate, setCheckTagsRefDate] = (0, _react.useState)(Date.now());
|
|
35
36
|
const isTagsRefSet = () => {
|
|
36
37
|
if (!tagList.length) return false;
|
|
37
38
|
return tagList.map(_ref2 => {
|
|
@@ -122,7 +123,7 @@ const TagList = _ref => {
|
|
|
122
123
|
return tagList.map((item, i) => ({
|
|
123
124
|
...item,
|
|
124
125
|
isHidden: renderItemsCount !== -1 ? i >= renderItemsCount : false
|
|
125
|
-
})).map(
|
|
126
|
+
})).map(item => /*#__PURE__*/_react.default.createElement("div", {
|
|
126
127
|
className: "tag-list_wrapper_item ".concat(item.isHidden ? "tag-list_wrapper_item--hidden" : ""),
|
|
127
128
|
key: "tag-list-item-".concat(item.id),
|
|
128
129
|
ref: (0, _utils.checkedRef)(item === null || item === void 0 ? void 0 : item.itemRef)
|
|
@@ -130,7 +131,10 @@ const TagList = _ref => {
|
|
|
130
131
|
testId: "test-taglist-item-".concat(item.id)
|
|
131
132
|
}, item, {
|
|
132
133
|
onClick: onTagClick,
|
|
133
|
-
removeItem: removeItem
|
|
134
|
+
removeItem: removeItem,
|
|
135
|
+
isPopup: isPopup,
|
|
136
|
+
popupInfo: popupInfo,
|
|
137
|
+
popupInfoContent: popupInfoContent
|
|
134
138
|
}))));
|
|
135
139
|
};
|
|
136
140
|
const renderMoreTags = () => {
|