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, defaultValue: p.searchText, setSearchText: (val, enter) => {
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);
@@ -4,7 +4,6 @@ export interface ISearchBox {
4
4
  placeholderText?: string;
5
5
  searchText: string;
6
6
  setSearchText: (val: string, enterPressed: boolean) => void;
7
- defaultValue?: string;
8
7
  className?: string;
9
8
  textBoxRef?: React.RefObject<IRefTextEdit>;
10
9
  }
@@ -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
- var _a, _b, _c;
77
- if (!((_a = p.textBoxRef) === null || _a === void 0 ? void 0 : _a.current) ||
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
- (_c = p.textBoxRef) === null || _c === void 0 ? void 0 : _c.current.setValue(p.searchText);
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.textBoxRef, placeholder: p.placeholderText, defaultEditing: { focus: true }, singleLine: true, leftContent: react_1.default.createElement(MagnifyIcon, { onClick: () => { var _a, _b; return p.setSearchText(((_b = (_a = p.textBoxRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.getValue()) || '', true); } },
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 }), defaultValue: p.defaultValue }),
89
+ }, { key: 'pagesearch', time: 200 }) }),
89
90
  p.searchText && (react_1.default.createElement(CrossIconStyled, { onClick: () => {
90
- var _a, _b;
91
- (_b = (_a = p.textBoxRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.setValue('');
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
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.659",
2
+ "version": "0.0.660",
3
3
  "name": "ag-common",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",