@react-fabric/searchbar 1.0.0-beta.6 → 1.0.0-beta.60
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/cjs/filterbar/FilterBar.js +10 -6
- package/dist/cjs/filterbar/FilterForm.js +141 -36
- package/dist/cjs/filterbar/FilterMenu.js +16 -4
- package/dist/cjs/filterbar/FilterTag.js +16 -8
- package/dist/cjs/filterbar/FilterView.js +6 -2
- package/dist/cjs/filterbar/QueryForm.js +9 -7
- package/dist/cjs/i18n/ar.json.js +42 -39
- package/dist/cjs/i18n/en.json.js +43 -39
- package/dist/cjs/searchbar/SearchBar.js +60 -7
- package/dist/cjs/types/index.js +12 -4
- package/dist/esm/filterbar/FilterBar.js +10 -6
- package/dist/esm/filterbar/FilterForm.js +142 -37
- package/dist/esm/filterbar/FilterMenu.js +16 -4
- package/dist/esm/filterbar/FilterTag.js +16 -8
- package/dist/esm/filterbar/FilterView.js +6 -2
- package/dist/esm/filterbar/QueryForm.js +9 -7
- package/dist/esm/i18n/ar.json.js +42 -39
- package/dist/esm/i18n/en.json.js +43 -39
- package/dist/esm/searchbar/SearchBar.js +61 -8
- package/dist/esm/types/index.js +12 -4
- package/dist/types/filterbar/Context.d.ts +2 -3
- package/dist/types/filterbar/FilterBar.d.ts +27 -1
- package/dist/types/filterbar/FilterMenu.d.ts +2 -1
- package/dist/types/filterbar/FilterTag.d.ts +2 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/searchbar/SearchBar.d.ts +35 -1
- package/dist/types/types/index.d.ts +19 -10
- package/package.json +16 -14
- package/src/filterbar/Context.tsx +4 -1
- package/src/filterbar/FilterBar.tsx +49 -7
- package/src/filterbar/FilterForm.tsx +110 -25
- package/src/filterbar/FilterMenu.tsx +30 -3
- package/src/filterbar/FilterTag.tsx +25 -9
- package/src/filterbar/FilterView.tsx +5 -2
- package/src/filterbar/QueryForm.tsx +5 -5
- package/src/i18n/ar.json +42 -39
- package/src/i18n/en.json +43 -39
- package/src/index.ts +6 -1
- package/src/searchbar/SearchBar.tsx +58 -5
- package/src/types/index.ts +57 -34
package/src/i18n/en.json
CHANGED
|
@@ -1,68 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"label": {
|
|
3
|
-
"
|
|
3
|
+
"add": "Add Filter",
|
|
4
4
|
"all_filters": "All Filters",
|
|
5
|
+
"apply": "Apply",
|
|
6
|
+
"basicFilter": "Basic Filter",
|
|
7
|
+
"cancel": "Cancel",
|
|
8
|
+
"customQuery": "Custom Query",
|
|
9
|
+
"delete": "Delete",
|
|
10
|
+
"disable": "Disable",
|
|
11
|
+
"disableAll": "Disable All",
|
|
12
|
+
"edit": "Edit",
|
|
13
|
+
"enable": "Enable",
|
|
14
|
+
"enableAll": "Enable All",
|
|
15
|
+
"exclude": "Exclude",
|
|
16
|
+
"excludeAll": "Exclude All",
|
|
5
17
|
"field": "Field",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
18
|
+
"filters": "Filters",
|
|
19
|
+
"forAdvanced": "For advanced users only!",
|
|
20
|
+
"include": "Include",
|
|
21
|
+
"includeAll": "Include All",
|
|
22
|
+
"invertAll": "Invert Include/Exclude",
|
|
8
23
|
"label": "Label",
|
|
24
|
+
"matchAll": "Match All",
|
|
25
|
+
"matchAny": "Match Any",
|
|
26
|
+
"operator": "Operator",
|
|
9
27
|
"optional": "Optional",
|
|
10
|
-
"add": "Add Filter",
|
|
11
|
-
"edit": "Edit",
|
|
12
|
-
"view": "View",
|
|
13
28
|
"pin": "Pinned",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"invertAll": "Invert Include/Exclude",
|
|
29
|
+
"query": "Query",
|
|
30
|
+
"refresh": "Refresh",
|
|
31
|
+
"remove": "Remove",
|
|
18
32
|
"removeAll": "Remove All",
|
|
19
|
-
"enableAll": "Enable All",
|
|
20
|
-
"disableAll": "Disable All",
|
|
21
33
|
"toggleDisable": "Invert Disable/Enable",
|
|
22
|
-
"
|
|
23
|
-
"enable": "Enable",
|
|
24
|
-
"disable": "Disable",
|
|
25
|
-
"exclude": "Exclude",
|
|
26
|
-
"include": "Include",
|
|
27
|
-
"refresh": "Refresh",
|
|
34
|
+
"unpin": "Unpinned",
|
|
28
35
|
"update": "Update",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"cancel": "Cancel",
|
|
32
|
-
"delete": "Delete",
|
|
33
|
-
"basicFilter": "Basic Filter",
|
|
34
|
-
"customQuery": "Custom Query",
|
|
35
|
-
"forAdvanced": "For advanced users only!"
|
|
36
|
+
"value": "Value",
|
|
37
|
+
"view": "View"
|
|
36
38
|
},
|
|
37
39
|
"operator": {
|
|
40
|
+
"ALL": "All of",
|
|
41
|
+
"ANY": "Any of",
|
|
42
|
+
"BETWEEN": "Between",
|
|
43
|
+
"ENDS": "Ends with",
|
|
44
|
+
"EQ": "=",
|
|
38
45
|
"EXISTS": "Exists",
|
|
46
|
+
"GT": ">",
|
|
47
|
+
"GTE": "≥",
|
|
39
48
|
"IS": "Is",
|
|
40
|
-
"
|
|
49
|
+
"LIKE": "Like",
|
|
41
50
|
"LT": "<",
|
|
42
|
-
"GT": ">",
|
|
43
51
|
"LTE": "≤",
|
|
44
|
-
"GTE": "≥",
|
|
45
|
-
"INCLUDES": "Includes",
|
|
46
52
|
"STARTS": "Starts with",
|
|
47
|
-
"
|
|
48
|
-
"WITHIN": "Within",
|
|
49
|
-
"BETWEEN": "Between"
|
|
53
|
+
"WITHIN": "Within"
|
|
50
54
|
},
|
|
51
55
|
"placeholder": "Search term...",
|
|
52
56
|
"type": {
|
|
53
|
-
"STRING": "String",
|
|
54
|
-
"NUMBER": "Number",
|
|
55
|
-
"DECIMAL": "Decimal",
|
|
56
57
|
"BOOLEAN": "Bool",
|
|
57
58
|
"DATE": "Date",
|
|
58
59
|
"DATETIME": "Date Time",
|
|
59
|
-
"
|
|
60
|
+
"DECIMAL": "Decimal",
|
|
61
|
+
"GEO": "GeoJSON",
|
|
62
|
+
"NUMBER": "Number",
|
|
63
|
+
"STRING": "String"
|
|
60
64
|
},
|
|
61
65
|
"validate": {
|
|
66
|
+
"compare": "Compare field required",
|
|
62
67
|
"field": "Field required",
|
|
68
|
+
"label": "Label required",
|
|
63
69
|
"operator": "Operator required",
|
|
64
|
-
"value": "Value required"
|
|
65
|
-
"compare": "Compare field required",
|
|
66
|
-
"label": "Label required"
|
|
70
|
+
"value": "Value required"
|
|
67
71
|
}
|
|
68
72
|
}
|
package/src/index.ts
CHANGED
|
@@ -25,4 +25,9 @@ import "./i18n";
|
|
|
25
25
|
|
|
26
26
|
export { FilterBar } from "./filterbar/FilterBar";
|
|
27
27
|
export { SearchBar } from "./searchbar/SearchBar";
|
|
28
|
-
export {
|
|
28
|
+
export {
|
|
29
|
+
FIELD_TYPE,
|
|
30
|
+
OPERATOR,
|
|
31
|
+
type FilterObject,
|
|
32
|
+
type SearchObject,
|
|
33
|
+
} from "./types";
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
import { Button, useDebounce, useLocalStorage } from "@react-fabric/core";
|
|
25
25
|
import { AutoComplete, Field } from "@react-fabric/form";
|
|
26
26
|
import { dedupe, EMPTY_ARRAY, isArray } from "@react-fabric/utilities";
|
|
27
|
-
import { useMemo, useReducer, useState } from "react";
|
|
27
|
+
import { useEffect, useMemo, useReducer, useState } from "react";
|
|
28
28
|
import { useTranslation } from "react-i18next";
|
|
29
29
|
import { FilterBar } from "../filterbar/FilterBar";
|
|
30
30
|
import {
|
|
@@ -40,10 +40,45 @@ interface SearchState {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
type SearchActions =
|
|
43
|
+
| { type: "reset"; query: string | string[]; filters: FilterObject[] }
|
|
43
44
|
| { type: "dirty"; dirty: boolean }
|
|
44
45
|
| { type: "query"; query: string | string[] }
|
|
45
46
|
| { type: "filter"; filters: FilterObject[] };
|
|
46
47
|
|
|
48
|
+
/**
|
|
49
|
+
* This component provides a search input with autocomplete functionality,
|
|
50
|
+
* a button to trigger search, and an optional filter bar.
|
|
51
|
+
* It supports history of search queries, multiple selection, and custom decorations.
|
|
52
|
+
* It can be collapsed to hide filters and has options for customization.
|
|
53
|
+
*
|
|
54
|
+
* @param {SearchBarProps} props - The properties for the SearchBar component.
|
|
55
|
+
* @returns {JSX.Element} The rendered SearchBar component.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```jsx
|
|
59
|
+
* <SearchBar
|
|
60
|
+
* historyKey="myApp:searchHistory"
|
|
61
|
+
* historyCount={10}
|
|
62
|
+
* defaultQueryList={["example", "test"]}
|
|
63
|
+
* prepend={<span>Prepend</span>}
|
|
64
|
+
* append={<span>Append</span>}
|
|
65
|
+
* decorateEnd={<span>End Decoration</span>}
|
|
66
|
+
* decorateStart={<span>Start Decoration</span>}
|
|
67
|
+
* hideFilters={false}
|
|
68
|
+
* defaultCollapsed={false}
|
|
69
|
+
* disabled={false}
|
|
70
|
+
* onCollapsed={(collapsed) => console.log("Collapsed:", collapsed)}
|
|
71
|
+
* onQuery={(query) => console.log("Query:", query)}
|
|
72
|
+
* onSearch={({ query, filters }) => console.log("Search:", query, filters)}
|
|
73
|
+
* query={""}
|
|
74
|
+
* ref={searchInputRef}
|
|
75
|
+
* multiple={false}
|
|
76
|
+
* filters={[{ name: "filter1", value: "value1" }]}
|
|
77
|
+
* />
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/story/searchbar-searchbar--search-bar} for more details on the properties.
|
|
81
|
+
*/
|
|
47
82
|
export const SearchBar = ({
|
|
48
83
|
historyKey = "ruf:search",
|
|
49
84
|
historyCount = 20,
|
|
@@ -60,6 +95,7 @@ export const SearchBar = ({
|
|
|
60
95
|
onQuery,
|
|
61
96
|
onSearch,
|
|
62
97
|
query,
|
|
98
|
+
ref,
|
|
63
99
|
multiple,
|
|
64
100
|
filters = EMPTY_ARRAY,
|
|
65
101
|
...filterProps
|
|
@@ -75,6 +111,7 @@ export const SearchBar = ({
|
|
|
75
111
|
|
|
76
112
|
const fireSearch = useDebounce(
|
|
77
113
|
(query: AnyObject, filters: FilterObject[]) => {
|
|
114
|
+
dispatch({ type: "dirty", dirty: false });
|
|
78
115
|
onSearch?.({
|
|
79
116
|
query,
|
|
80
117
|
filters,
|
|
@@ -85,12 +122,24 @@ export const SearchBar = ({
|
|
|
85
122
|
|
|
86
123
|
const [state, dispatch] = useReducer(
|
|
87
124
|
(state: SearchState, action: SearchActions) => {
|
|
125
|
+
if (action.type === "reset") {
|
|
126
|
+
return {
|
|
127
|
+
...state,
|
|
128
|
+
dirty: false,
|
|
129
|
+
query: action.query,
|
|
130
|
+
filters: action.filters,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
88
133
|
if (action.type === "dirty") {
|
|
89
134
|
return { ...state, dirty: action.dirty };
|
|
90
135
|
}
|
|
91
136
|
if (action.type === "query") {
|
|
92
137
|
!multiple && fireSearch(action.query ?? emptyValue, state.filters);
|
|
93
|
-
return {
|
|
138
|
+
return {
|
|
139
|
+
...state,
|
|
140
|
+
dirty: !!multiple,
|
|
141
|
+
query: action.query ?? emptyValue,
|
|
142
|
+
};
|
|
94
143
|
}
|
|
95
144
|
if (action.type === "filter") {
|
|
96
145
|
fireSearch(state.query, action.filters ?? []);
|
|
@@ -105,6 +154,10 @@ export const SearchBar = ({
|
|
|
105
154
|
},
|
|
106
155
|
);
|
|
107
156
|
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
dispatch({ type: "reset", filters, query });
|
|
159
|
+
}, [filters, query]);
|
|
160
|
+
|
|
108
161
|
const updateHistory = (value: string | string[]) => {
|
|
109
162
|
const historyEntry = isArray(value) ? value : [value];
|
|
110
163
|
setHistory(dedupe([...historyEntry, ...history]).slice(0, historyCount));
|
|
@@ -132,15 +185,15 @@ export const SearchBar = ({
|
|
|
132
185
|
<AutoComplete
|
|
133
186
|
allowClear
|
|
134
187
|
expandOnEdit
|
|
188
|
+
ref={ref}
|
|
135
189
|
multiple={multiple}
|
|
136
190
|
history={history}
|
|
137
191
|
value={state.query}
|
|
138
192
|
decorateEnd={decorateEnd}
|
|
139
193
|
decorateStart={decorateStart}
|
|
140
|
-
onInput={() => dispatch({ type: "dirty", dirty:
|
|
194
|
+
onInput={() => dispatch({ type: "dirty", dirty: !multiple })}
|
|
141
195
|
onSelect={updateHistory}
|
|
142
|
-
|
|
143
|
-
data-testid="searchbar-input"
|
|
196
|
+
data-ref="searchbarInput"
|
|
144
197
|
onEnterPressed={() => fireSearch(state.query, state.filters)}
|
|
145
198
|
/>
|
|
146
199
|
{append}
|
package/src/types/index.ts
CHANGED
|
@@ -21,17 +21,21 @@
|
|
|
21
21
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
type ChildrenProp,
|
|
26
|
+
type RefProp,
|
|
27
|
+
} from "@react-fabric/core/dist/types/types";
|
|
25
28
|
import { type ReactElement } from "react";
|
|
26
29
|
|
|
27
30
|
export enum FIELD_TYPE {
|
|
28
31
|
ID = "ID",
|
|
29
32
|
STRING = "STRING",
|
|
33
|
+
TEXT = "TEXT",
|
|
30
34
|
NUMBER = "NUMBER",
|
|
31
35
|
DECIMAL = "DECIMAL",
|
|
32
36
|
BOOLEAN = "BOOLEAN",
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
DATE = "DATE",
|
|
38
|
+
DATETIME = "DATETIME",
|
|
35
39
|
// GEO = "GEO",
|
|
36
40
|
NONE = "NONE",
|
|
37
41
|
}
|
|
@@ -39,12 +43,14 @@ export enum FIELD_TYPE {
|
|
|
39
43
|
export enum OPERATOR {
|
|
40
44
|
EXISTS = "EXISTS",
|
|
41
45
|
IS = "IS",
|
|
42
|
-
|
|
46
|
+
ALL = "ALL",
|
|
47
|
+
ANY = "ANY",
|
|
48
|
+
EQ = "EQ",
|
|
43
49
|
LT = "LT",
|
|
44
50
|
GT = "GT",
|
|
45
51
|
LTE = "LTE",
|
|
46
52
|
GTE = "GTE",
|
|
47
|
-
|
|
53
|
+
LIKE = "LIKE",
|
|
48
54
|
STARTS = "STARTS",
|
|
49
55
|
ENDS = "ENDS",
|
|
50
56
|
WITHIN = "WITHIN",
|
|
@@ -55,18 +61,22 @@ export enum OPERATOR {
|
|
|
55
61
|
* @internal
|
|
56
62
|
*/
|
|
57
63
|
export const TypeOperators: { [key in FIELD_TYPE]: OPERATOR[] } = {
|
|
58
|
-
[FIELD_TYPE.ID]: [OPERATOR.IS, OPERATOR.
|
|
64
|
+
[FIELD_TYPE.ID]: [OPERATOR.IS, OPERATOR.ANY],
|
|
59
65
|
[FIELD_TYPE.STRING]: [
|
|
60
66
|
OPERATOR.EXISTS,
|
|
61
67
|
OPERATOR.IS,
|
|
62
|
-
OPERATOR.
|
|
63
|
-
OPERATOR.
|
|
68
|
+
OPERATOR.ANY,
|
|
69
|
+
OPERATOR.ALL,
|
|
70
|
+
],
|
|
71
|
+
[FIELD_TYPE.TEXT]: [
|
|
72
|
+
OPERATOR.EXISTS,
|
|
73
|
+
OPERATOR.LIKE,
|
|
64
74
|
OPERATOR.STARTS,
|
|
65
75
|
OPERATOR.ENDS,
|
|
66
76
|
],
|
|
67
77
|
[FIELD_TYPE.NUMBER]: [
|
|
68
78
|
OPERATOR.EXISTS,
|
|
69
|
-
OPERATOR.
|
|
79
|
+
OPERATOR.EQ,
|
|
70
80
|
OPERATOR.BETWEEN,
|
|
71
81
|
OPERATOR.LT,
|
|
72
82
|
OPERATOR.GT,
|
|
@@ -75,46 +85,55 @@ export const TypeOperators: { [key in FIELD_TYPE]: OPERATOR[] } = {
|
|
|
75
85
|
],
|
|
76
86
|
[FIELD_TYPE.DECIMAL]: [
|
|
77
87
|
OPERATOR.EXISTS,
|
|
78
|
-
OPERATOR.
|
|
88
|
+
OPERATOR.EQ,
|
|
89
|
+
OPERATOR.BETWEEN,
|
|
90
|
+
OPERATOR.LT,
|
|
91
|
+
OPERATOR.GT,
|
|
92
|
+
OPERATOR.LTE,
|
|
93
|
+
OPERATOR.GTE,
|
|
94
|
+
],
|
|
95
|
+
[FIELD_TYPE.BOOLEAN]: [OPERATOR.EXISTS, OPERATOR.EQ],
|
|
96
|
+
[FIELD_TYPE.DATE]: [
|
|
97
|
+
OPERATOR.EXISTS,
|
|
98
|
+
OPERATOR.EQ,
|
|
99
|
+
OPERATOR.BETWEEN,
|
|
100
|
+
OPERATOR.LT,
|
|
101
|
+
OPERATOR.GT,
|
|
102
|
+
OPERATOR.LTE,
|
|
103
|
+
OPERATOR.GTE,
|
|
104
|
+
],
|
|
105
|
+
[FIELD_TYPE.DATETIME]: [
|
|
106
|
+
OPERATOR.EXISTS,
|
|
107
|
+
OPERATOR.EQ,
|
|
79
108
|
OPERATOR.BETWEEN,
|
|
80
109
|
OPERATOR.LT,
|
|
81
110
|
OPERATOR.GT,
|
|
82
111
|
OPERATOR.LTE,
|
|
83
112
|
OPERATOR.GTE,
|
|
84
113
|
],
|
|
85
|
-
[FIELD_TYPE.BOOLEAN]: [OPERATOR.EXISTS, OPERATOR.IS],
|
|
86
|
-
// [FIELD_TYPE.DATE]: [
|
|
87
|
-
// OPERATOR.BETWEEN,
|
|
88
|
-
// OPERATOR.LT,
|
|
89
|
-
// OPERATOR.GT,
|
|
90
|
-
// OPERATOR.LTE,
|
|
91
|
-
// OPERATOR.GTE,
|
|
92
|
-
// ],
|
|
93
|
-
// [FIELD_TYPE.DATETIME]: [
|
|
94
|
-
// OPERATOR.BETWEEN,
|
|
95
|
-
// OPERATOR.LT,
|
|
96
|
-
// OPERATOR.GT,
|
|
97
|
-
// OPERATOR.LTE,
|
|
98
|
-
// OPERATOR.GTE,
|
|
99
|
-
// ],
|
|
100
114
|
// [FIELD_TYPE.GEO]: [],
|
|
101
115
|
[FIELD_TYPE.NONE]: [OPERATOR.EXISTS],
|
|
102
116
|
};
|
|
103
117
|
|
|
104
118
|
/**
|
|
105
119
|
* @internal
|
|
120
|
+
* 0 single value
|
|
121
|
+
* 1 many values
|
|
122
|
+
* 2 two values
|
|
106
123
|
*/
|
|
107
124
|
export const OperatorValueType: {
|
|
108
125
|
[key in OPERATOR]: 0 | 1 | 2;
|
|
109
126
|
} = {
|
|
110
127
|
[OPERATOR.EXISTS]: 0,
|
|
111
128
|
[OPERATOR.IS]: 0,
|
|
112
|
-
[OPERATOR.
|
|
129
|
+
[OPERATOR.ANY]: 1,
|
|
130
|
+
[OPERATOR.ALL]: 1,
|
|
113
131
|
[OPERATOR.BETWEEN]: 2,
|
|
114
132
|
[OPERATOR.WITHIN]: 0,
|
|
115
133
|
[OPERATOR.STARTS]: 0,
|
|
116
134
|
[OPERATOR.ENDS]: 0,
|
|
117
|
-
[OPERATOR.
|
|
135
|
+
[OPERATOR.LIKE]: 0,
|
|
136
|
+
[OPERATOR.EQ]: 0,
|
|
118
137
|
[OPERATOR.LT]: 0,
|
|
119
138
|
[OPERATOR.GT]: 0,
|
|
120
139
|
[OPERATOR.LTE]: 0,
|
|
@@ -140,12 +159,10 @@ interface BaseFilter {
|
|
|
140
159
|
color?: string;
|
|
141
160
|
value?: FilterValue;
|
|
142
161
|
pinned?: boolean;
|
|
143
|
-
negate?: boolean;
|
|
144
162
|
disabled?: boolean;
|
|
145
163
|
required?: boolean;
|
|
146
164
|
canPin?: boolean;
|
|
147
165
|
canEdit?: boolean;
|
|
148
|
-
canInvert?: boolean;
|
|
149
166
|
canDisable?: boolean;
|
|
150
167
|
}
|
|
151
168
|
|
|
@@ -153,16 +170,18 @@ export type FilterObject = BaseFilter &
|
|
|
153
170
|
(
|
|
154
171
|
| {
|
|
155
172
|
field: string;
|
|
156
|
-
type?: FIELD_TYPE;
|
|
157
173
|
operator: OPERATOR;
|
|
158
174
|
value?: FilterValue;
|
|
175
|
+
negate?: boolean;
|
|
176
|
+
canInvert?: boolean;
|
|
159
177
|
query?: never;
|
|
178
|
+
type?: string;
|
|
160
179
|
}
|
|
161
180
|
| {
|
|
162
181
|
field?: never;
|
|
163
|
-
type?: never;
|
|
164
182
|
operator?: never;
|
|
165
183
|
label: string;
|
|
184
|
+
canInvert?: false;
|
|
166
185
|
query: string;
|
|
167
186
|
}
|
|
168
187
|
);
|
|
@@ -185,7 +204,9 @@ export interface FilterField {
|
|
|
185
204
|
onSearch?: (q: string) => Promise<FieldValue[]> | FieldValue[];
|
|
186
205
|
}
|
|
187
206
|
|
|
188
|
-
interface BaseSearchBarProps
|
|
207
|
+
interface BaseSearchBarProps
|
|
208
|
+
extends Partial<ChildrenProp>,
|
|
209
|
+
RefProp<HTMLInputElement> {
|
|
189
210
|
/**
|
|
190
211
|
* Query string
|
|
191
212
|
*/
|
|
@@ -291,12 +312,12 @@ export interface FilterBarProps {
|
|
|
291
312
|
/**
|
|
292
313
|
* Editable filters
|
|
293
314
|
*/
|
|
294
|
-
|
|
315
|
+
editable?: boolean;
|
|
295
316
|
|
|
296
317
|
/**
|
|
297
318
|
* Disable component
|
|
298
319
|
*/
|
|
299
|
-
|
|
320
|
+
disabled?: boolean;
|
|
300
321
|
|
|
301
322
|
/**
|
|
302
323
|
* Message for empty field list
|
|
@@ -313,6 +334,8 @@ export interface FilterBarProps {
|
|
|
313
334
|
excludedColor?: string;
|
|
314
335
|
|
|
315
336
|
allowAdd?: boolean;
|
|
337
|
+
|
|
338
|
+
queryLanguage?: "text" | "json";
|
|
316
339
|
querySchema?: Array<{ uri: string; schema: KeyValue }>;
|
|
317
340
|
defaultQuery?: string;
|
|
318
341
|
|