intelicoreact 0.0.98 → 0.1.1
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.
|
@@ -136,10 +136,12 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
136
136
|
setSearchValue(name);
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
-
var hightlightedText = function hightlightedText(text) {
|
|
140
|
-
|
|
139
|
+
var hightlightedText = function hightlightedText(text, postfix) {
|
|
140
|
+
var main = searchValue ? text === null || text === void 0 ? void 0 : text.replace(new RegExp(searchValue, 'i'), function (match) {
|
|
141
141
|
return "<span class=\"bg--yellow\">".concat(match, "</span>");
|
|
142
142
|
}) : text;
|
|
143
|
+
var postfixPart = postfix ? "<span class=\"dropdown__list-item-postfix\">".concat(postfix, "</span>") : '';
|
|
144
|
+
return main + postfixPart;
|
|
143
145
|
};
|
|
144
146
|
|
|
145
147
|
var depend = getDepends(modalBtnTrigger);
|
|
@@ -156,7 +158,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
156
158
|
}, /*#__PURE__*/_react.default.createElement(_reactFeather.Check, null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
157
159
|
className: item.className || '',
|
|
158
160
|
dangerouslySetInnerHTML: {
|
|
159
|
-
__html: hightlightedText(item.label)
|
|
161
|
+
__html: hightlightedText(item.label, item.postfix)
|
|
160
162
|
}
|
|
161
163
|
})) : null;
|
|
162
164
|
};
|
|
@@ -184,11 +186,14 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
184
186
|
})) === null || _item$items4$find === void 0 ? void 0 : _item$items4$find.label);
|
|
185
187
|
}, null);
|
|
186
188
|
var doScrollCallback = (0, _react.useCallback)(function (e) {
|
|
187
|
-
var
|
|
188
|
-
|
|
189
|
+
var _ref2 = scrollReactionObj || {},
|
|
190
|
+
callback = _ref2.callback,
|
|
191
|
+
isWithAnyScrolling = _ref2.isWithAnyScrolling,
|
|
192
|
+
_ref2$scrollingInaccu = _ref2.scrollingInaccuracy,
|
|
193
|
+
scrollingInaccuracy = _ref2$scrollingInaccu === void 0 ? 0 : _ref2$scrollingInaccu;
|
|
189
194
|
|
|
190
195
|
if (callback && typeof callback === 'function') {
|
|
191
|
-
if (isWithAnyScrolling) callback(e);else if (e.target.clientHeight + e.target.scrollTop >= e.target.scrollHeight) callback(e);
|
|
196
|
+
if (isWithAnyScrolling) callback(e);else if (Math.round(e.target.clientHeight + e.target.scrollTop + scrollingInaccuracy) >= e.target.scrollHeight) callback(e);
|
|
192
197
|
}
|
|
193
198
|
}, [filteredOptions]);
|
|
194
199
|
(0, _react.useEffect)(function () {
|
|
@@ -80,7 +80,8 @@ var Template = function Template(args) {
|
|
|
80
80
|
scrollReactionObj: {
|
|
81
81
|
callback: function callback(e) {
|
|
82
82
|
return setDisabled(true);
|
|
83
|
-
}
|
|
83
|
+
},
|
|
84
|
+
scrollingInaccuracy: 5
|
|
84
85
|
}
|
|
85
86
|
}))), /*#__PURE__*/_react.default.createElement("button", {
|
|
86
87
|
key: "reset",
|
|
@@ -109,7 +110,8 @@ DropdownTemplate.args = {
|
|
|
109
110
|
isSearchable: true,
|
|
110
111
|
options: [{
|
|
111
112
|
label: 'Dropdown2',
|
|
112
|
-
value: 'drop2'
|
|
113
|
+
value: 'drop2',
|
|
114
|
+
postfix: '(postfix)'
|
|
113
115
|
}, {
|
|
114
116
|
label: 'Dropdown3',
|
|
115
117
|
value: 'drop3',
|
|
@@ -33,7 +33,7 @@ var formatInput = {
|
|
|
33
33
|
var soft = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
34
34
|
|
|
35
35
|
if (soft) {
|
|
36
|
-
return value.toString().replace(/[^a-z
|
|
36
|
+
return value.toString().replace(/[^a-z- ]/gi, '');
|
|
37
37
|
} else {
|
|
38
38
|
return value.toString().replace(/[^a-z]/gi, '');
|
|
39
39
|
}
|