ag-common 0.0.659 → 0.0.660
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.
|
@@ -91,7 +91,7 @@ const AutoHideSearchBox = (p) => {
|
|
|
91
91
|
} },
|
|
92
92
|
open && react_1.default.createElement(icons_1.CrossIcon, null),
|
|
93
93
|
!open && react_1.default.createElement(icons_1.Magnify, { style: { fill: 'white' } })),
|
|
94
|
-
react_1.default.createElement(SearchBoxStyled, Object.assign({ textBoxRef: textEditRef }, p, { className: "", "data-open": open,
|
|
94
|
+
react_1.default.createElement(SearchBoxStyled, Object.assign({ textBoxRef: textEditRef }, p, { className: "", "data-open": open, setSearchText: (val, enter) => {
|
|
95
95
|
//we dont want empty enters to do anything
|
|
96
96
|
if (val === '' && enter) {
|
|
97
97
|
p.setSearchText(val, false);
|
|
@@ -72,23 +72,24 @@ const TextEditStyled = (0, styled_1.default)(TextEdit_1.TextEdit) `
|
|
|
72
72
|
background-color: white;
|
|
73
73
|
`;
|
|
74
74
|
const SearchBox = (p) => {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
const textBoxRef = (0, react_1.useRef)((_b = (_a = p.textBoxRef) === null || _a === void 0 ? void 0 : _a.current) !== null && _b !== void 0 ? _b : null);
|
|
75
77
|
(0, react_1.useEffect)(() => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
((_b = p.textBoxRef) === null || _b === void 0 ? void 0 : _b.current.getValue()) === p.searchText) {
|
|
78
|
+
if (!(textBoxRef === null || textBoxRef === void 0 ? void 0 : textBoxRef.current) ||
|
|
79
|
+
(textBoxRef === null || textBoxRef === void 0 ? void 0 : textBoxRef.current.getValue()) === p.searchText) {
|
|
79
80
|
return;
|
|
80
81
|
}
|
|
81
|
-
|
|
82
|
+
textBoxRef === null || textBoxRef === void 0 ? void 0 : textBoxRef.current.setValue(p.searchText);
|
|
82
83
|
p.setSearchText(p.searchText, true);
|
|
83
84
|
}, [p]);
|
|
84
85
|
return (react_1.default.createElement(Base, Object.assign({ "data-type": "search", className: p.className }, (0, dom_1.filterDataProps)(p)),
|
|
85
|
-
react_1.default.createElement(TextEditStyled, { ref: p.
|
|
86
|
+
react_1.default.createElement(TextEditStyled, { ref: textBoxRef, defaultValue: p.searchText, placeholder: p.placeholderText, defaultEditing: { focus: true }, singleLine: true, leftContent: react_1.default.createElement(MagnifyIcon, { onClick: () => { var _a; return p.setSearchText(((_a = textBoxRef === null || textBoxRef === void 0 ? void 0 : textBoxRef.current) === null || _a === void 0 ? void 0 : _a.getValue()) || '', true); } },
|
|
86
87
|
react_1.default.createElement(icons_1.Magnify, null)), allowUndo: false, onClickOutsideWithNoValue: null, onSubmit: (v, enterPressed) => (0, debounce_1.debounce)(() => {
|
|
87
88
|
p.setSearchText(v, enterPressed);
|
|
88
|
-
}, { key: 'pagesearch', time: 200 })
|
|
89
|
+
}, { key: 'pagesearch', time: 200 }) }),
|
|
89
90
|
p.searchText && (react_1.default.createElement(CrossIconStyled, { onClick: () => {
|
|
90
|
-
var _a
|
|
91
|
-
(
|
|
91
|
+
var _a;
|
|
92
|
+
(_a = textBoxRef === null || textBoxRef === void 0 ? void 0 : textBoxRef.current) === null || _a === void 0 ? void 0 : _a.setValue('');
|
|
92
93
|
p.setSearchText('', true);
|
|
93
94
|
} }))));
|
|
94
95
|
};
|
package/package.json
CHANGED