minista 2.7.0 → 2.7.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/dist/search.d.ts +6 -0
- package/dist/search.js +19 -3
- package/package.json +1 -1
package/dist/search.d.ts
CHANGED
|
@@ -16,18 +16,24 @@ export declare type SearchResult = {
|
|
|
16
16
|
};
|
|
17
17
|
export interface SearchProps extends React.HTMLAttributes<HTMLElement> {
|
|
18
18
|
jsonPath: string;
|
|
19
|
+
placeholder?: string;
|
|
19
20
|
minHitLength?: number;
|
|
20
21
|
maxHitPages?: number;
|
|
21
22
|
maxHitWords?: number;
|
|
22
23
|
searchFieldClassName?: string;
|
|
24
|
+
searchFieldInsertBeforeElement?: React.ReactElement;
|
|
25
|
+
searchFieldInsertAfterElement?: React.ReactElement;
|
|
23
26
|
searchListClassName?: string;
|
|
24
27
|
attributes?: React.HTMLAttributes<HTMLElement>;
|
|
25
28
|
}
|
|
26
29
|
export interface SearchFieldProps extends React.HTMLAttributes<HTMLElement> {
|
|
27
30
|
jsonPath: string;
|
|
31
|
+
placeholder?: string;
|
|
28
32
|
minHitLength?: number;
|
|
29
33
|
maxHitPages?: number;
|
|
30
34
|
maxHitWords?: number;
|
|
35
|
+
insertBeforeElement?: React.ReactElement;
|
|
36
|
+
insertAfterElement?: React.ReactElement;
|
|
31
37
|
setSearchValues?: React.Dispatch<React.SetStateAction<string[]>>;
|
|
32
38
|
setSearchHitValues?: React.Dispatch<React.SetStateAction<string[]>>;
|
|
33
39
|
setSearchResults?: React.Dispatch<React.SetStateAction<SearchResult[]>>;
|
package/dist/search.js
CHANGED
|
@@ -34,16 +34,22 @@ function compNum(a, b) {
|
|
|
34
34
|
const Search = (props) => {
|
|
35
35
|
const _a = props, {
|
|
36
36
|
jsonPath,
|
|
37
|
+
placeholder = props.placeholder || "",
|
|
37
38
|
minHitLength = props.minHitLength || 2,
|
|
38
39
|
maxHitPages = props.maxHitPages || 5,
|
|
39
40
|
maxHitWords = props.maxHitWords || 20,
|
|
41
|
+
searchFieldInsertBeforeElement,
|
|
42
|
+
searchFieldInsertAfterElement,
|
|
40
43
|
searchFieldClassName,
|
|
41
44
|
searchListClassName
|
|
42
45
|
} = _a, attributes = __objRest(_a, [
|
|
43
46
|
"jsonPath",
|
|
47
|
+
"placeholder",
|
|
44
48
|
"minHitLength",
|
|
45
49
|
"maxHitPages",
|
|
46
50
|
"maxHitWords",
|
|
51
|
+
"searchFieldInsertBeforeElement",
|
|
52
|
+
"searchFieldInsertAfterElement",
|
|
47
53
|
"searchFieldClassName",
|
|
48
54
|
"searchListClassName"
|
|
49
55
|
]);
|
|
@@ -53,9 +59,12 @@ const Search = (props) => {
|
|
|
53
59
|
return /* @__PURE__ */ React.createElement("div", __spreadValues({}, attributes), /* @__PURE__ */ React.createElement(SearchField, {
|
|
54
60
|
className: searchFieldClassName,
|
|
55
61
|
jsonPath,
|
|
62
|
+
placeholder,
|
|
56
63
|
minHitLength,
|
|
57
64
|
maxHitPages,
|
|
58
65
|
maxHitWords,
|
|
66
|
+
insertBeforeElement: searchFieldInsertBeforeElement,
|
|
67
|
+
insertAfterElement: searchFieldInsertAfterElement,
|
|
59
68
|
setSearchValues,
|
|
60
69
|
setSearchHitValues,
|
|
61
70
|
setSearchResults
|
|
@@ -69,17 +78,23 @@ const Search = (props) => {
|
|
|
69
78
|
const SearchField = (props) => {
|
|
70
79
|
const _a = props, {
|
|
71
80
|
jsonPath,
|
|
81
|
+
placeholder = props.placeholder || "",
|
|
72
82
|
minHitLength = props.minHitLength || 2,
|
|
73
83
|
maxHitPages = props.maxHitPages || 5,
|
|
74
84
|
maxHitWords = props.maxHitWords || 20,
|
|
85
|
+
insertBeforeElement,
|
|
86
|
+
insertAfterElement,
|
|
75
87
|
setSearchValues,
|
|
76
88
|
setSearchHitValues,
|
|
77
89
|
setSearchResults
|
|
78
90
|
} = _a, attributes = __objRest(_a, [
|
|
79
91
|
"jsonPath",
|
|
92
|
+
"placeholder",
|
|
80
93
|
"minHitLength",
|
|
81
94
|
"maxHitPages",
|
|
82
95
|
"maxHitWords",
|
|
96
|
+
"insertBeforeElement",
|
|
97
|
+
"insertAfterElement",
|
|
83
98
|
"setSearchValues",
|
|
84
99
|
"setSearchHitValues",
|
|
85
100
|
"setSearchResults"
|
|
@@ -207,10 +222,11 @@ const SearchField = (props) => {
|
|
|
207
222
|
getSearchData();
|
|
208
223
|
}
|
|
209
224
|
}, [callSearchData]);
|
|
210
|
-
return /* @__PURE__ */ React.createElement("
|
|
211
|
-
type: "
|
|
225
|
+
return /* @__PURE__ */ React.createElement("div", __spreadValues({}, attributes), insertBeforeElement, /* @__PURE__ */ React.createElement("input", {
|
|
226
|
+
type: "search",
|
|
227
|
+
placeholder,
|
|
212
228
|
onChange: searchHandler
|
|
213
|
-
},
|
|
229
|
+
}), insertAfterElement);
|
|
214
230
|
};
|
|
215
231
|
const SearchList = (props) => {
|
|
216
232
|
const _a = props, { searchValues, searchHitValues, searchResults } = _a, attributes = __objRest(_a, ["searchValues", "searchHitValues", "searchResults"]);
|