elastic-input 0.3.0 → 0.3.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.
- package/README.md +1 -0
- package/dist/elastic-input.es.js +3 -3
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -139,6 +139,7 @@ interface FieldConfig {
|
|
|
139
139
|
operators?: string[]; // Allowed operators (future use)
|
|
140
140
|
description?: string; // Shown in autocomplete dropdown
|
|
141
141
|
placeholder?: string | false; // Hint shown while typing a value (false to suppress)
|
|
142
|
+
suggestions?: boolean; // Whether fetchSuggestions is called (default true)
|
|
142
143
|
}
|
|
143
144
|
```
|
|
144
145
|
|
package/dist/elastic-input.es.js
CHANGED
|
@@ -3988,7 +3988,7 @@ function ElasticInput(props) {
|
|
|
3988
3988
|
}
|
|
3989
3989
|
}
|
|
3990
3990
|
const resolvedField = result.context.fieldName ? engineRef.current.resolveField(result.context.fieldName) : void 0;
|
|
3991
|
-
const willFetchAsync = !!(fetchSuggestionsProp && result.context.type === "FIELD_VALUE" && result.context.fieldName && (resolvedField == null ? void 0 : resolvedField.type) !== "boolean") || !!(typeof savedSearches === "function" && result.context.type === "SAVED_SEARCH") || !!(typeof searchHistory === "function" && result.context.type === "HISTORY_REF");
|
|
3991
|
+
const willFetchAsync = !!(fetchSuggestionsProp && result.context.type === "FIELD_VALUE" && result.context.fieldName && (resolvedField == null ? void 0 : resolvedField.type) !== "boolean" && (resolvedField == null ? void 0 : resolvedField.suggestions) !== false) || !!(typeof savedSearches === "function" && result.context.type === "SAVED_SEARCH") || !!(typeof searchHistory === "function" && result.context.type === "HISTORY_REF");
|
|
3992
3992
|
if (result.showDatePicker) {
|
|
3993
3993
|
asyncActiveRef.current = false;
|
|
3994
3994
|
(_a = abortControllerRef.current) == null ? void 0 : _a.abort();
|
|
@@ -4387,7 +4387,7 @@ function ElasticInput(props) {
|
|
|
4387
4387
|
} else {
|
|
4388
4388
|
const rect = getCaretRect();
|
|
4389
4389
|
if (rect) {
|
|
4390
|
-
const height = s.showDatePicker ? 350 : s.suggestions.length * 32;
|
|
4390
|
+
const height = s.showDatePicker ? 350 : capDropdownHeight(s.suggestions.length * 32, dropdownMaxHeightPx);
|
|
4391
4391
|
setDropdownPosition(getDropdownPosition(rect, height, 300));
|
|
4392
4392
|
}
|
|
4393
4393
|
}
|
|
@@ -4398,7 +4398,7 @@ function ElasticInput(props) {
|
|
|
4398
4398
|
window.removeEventListener("resize", reposition);
|
|
4399
4399
|
window.removeEventListener("scroll", reposition, true);
|
|
4400
4400
|
};
|
|
4401
|
-
}, [dropdownAlignToInput]);
|
|
4401
|
+
}, [dropdownAlignToInput, dropdownMaxHeightPx]);
|
|
4402
4402
|
const prevParenMatchRef = React.useRef(null);
|
|
4403
4403
|
const prevColorsRef = React.useRef(colors);
|
|
4404
4404
|
React.useEffect(() => {
|
package/dist/types.d.ts
CHANGED
|
@@ -49,6 +49,8 @@ export interface FieldConfig {
|
|
|
49
49
|
description?: string;
|
|
50
50
|
/** Custom placeholder hint shown in the dropdown while typing a value for this field (e.g. "Search by company name..."). Overrides the default type-based hint. Set to `false` to suppress the hint entirely. */
|
|
51
51
|
placeholder?: string | false;
|
|
52
|
+
/** Whether `fetchSuggestions` should be called for this field. Defaults to `true`. Set to `false` to skip the async fetch entirely (no "Searching..." spinner, no dropdown). */
|
|
53
|
+
suggestions?: boolean;
|
|
52
54
|
}
|
|
53
55
|
/** A saved/named search that users can reference with `#name` syntax. */
|
|
54
56
|
export interface SavedSearch {
|