@react-fabric/searchbar 1.0.0-beta.26 → 1.0.0-beta.27
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.
|
@@ -15,7 +15,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
15
15
|
var FilterSchema = new utilities.yup.ObjectSchema({
|
|
16
16
|
id: utilities.yup.string().required(),
|
|
17
17
|
field: utilities.yup.string().required(),
|
|
18
|
-
type:
|
|
18
|
+
// type: yup.string().oneOf(Object.values(FIELD_TYPE)),
|
|
19
19
|
operator: utilities.yup.string().required().oneOf(Object.values(index.OPERATOR)),
|
|
20
20
|
negate: utilities.yup["boolean"](),
|
|
21
21
|
label: utilities.yup.string(),
|
|
@@ -66,7 +66,6 @@ var FilterForm = function FilterForm(_ref) {
|
|
|
66
66
|
(_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 || _formRef$current2.setValues({
|
|
67
67
|
id: utilities.shortHash(),
|
|
68
68
|
field: "",
|
|
69
|
-
type: index.FIELD_TYPE.NONE,
|
|
70
69
|
operator: index.OPERATOR.EXISTS
|
|
71
70
|
});
|
|
72
71
|
}
|
|
@@ -191,7 +190,6 @@ var FilterForm = function FilterForm(_ref) {
|
|
|
191
190
|
var filter = {
|
|
192
191
|
id: model.id,
|
|
193
192
|
field: model.field,
|
|
194
|
-
type: model.type,
|
|
195
193
|
negate: model.negate,
|
|
196
194
|
operator: model.operator,
|
|
197
195
|
value: model.value,
|
|
@@ -221,11 +219,7 @@ var FilterForm = function FilterForm(_ref) {
|
|
|
221
219
|
options: fields,
|
|
222
220
|
labelProperty: "label",
|
|
223
221
|
valueProperty: "field",
|
|
224
|
-
groupProperty: "type"
|
|
225
|
-
onSelect: function onSelect(field) {
|
|
226
|
-
var _formRef$current10;
|
|
227
|
-
return (_formRef$current10 = formRef.current) === null || _formRef$current10 === void 0 ? void 0 : _formRef$current10.setValue("type", field.type);
|
|
228
|
-
}
|
|
222
|
+
groupProperty: "type"
|
|
229
223
|
})
|
|
230
224
|
})
|
|
231
225
|
}), /*#__PURE__*/jsxRuntime.jsxs(core.Col, {
|
|
@@ -8,14 +8,14 @@ import { Field, Controller, Switch, Select, Input, Number, Form } from '@react-f
|
|
|
8
8
|
import { yup, shortHash, isArray } from '@react-fabric/utilities';
|
|
9
9
|
import { useRef, useState, useEffect, useMemo, useCallback } from 'react';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
|
-
import {
|
|
11
|
+
import { OPERATOR, TypeOperators, FIELD_TYPE } from '../types/index.js';
|
|
12
12
|
import { useFilterContext } from './Context.js';
|
|
13
13
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
14
|
|
|
15
15
|
var FilterSchema = new yup.ObjectSchema({
|
|
16
16
|
id: yup.string().required(),
|
|
17
17
|
field: yup.string().required(),
|
|
18
|
-
type: yup.string().
|
|
18
|
+
// type: yup.string().oneOf(Object.values(FIELD_TYPE)),
|
|
19
19
|
operator: yup.string().required().oneOf(Object.values(OPERATOR)),
|
|
20
20
|
negate: yup["boolean"](),
|
|
21
21
|
label: yup.string(),
|
|
@@ -66,7 +66,6 @@ var FilterForm = function FilterForm(_ref) {
|
|
|
66
66
|
(_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 || _formRef$current2.setValues({
|
|
67
67
|
id: shortHash(),
|
|
68
68
|
field: "",
|
|
69
|
-
type: FIELD_TYPE.NONE,
|
|
70
69
|
operator: OPERATOR.EXISTS
|
|
71
70
|
});
|
|
72
71
|
}
|
|
@@ -191,7 +190,6 @@ var FilterForm = function FilterForm(_ref) {
|
|
|
191
190
|
var filter = {
|
|
192
191
|
id: model.id,
|
|
193
192
|
field: model.field,
|
|
194
|
-
type: model.type,
|
|
195
193
|
negate: model.negate,
|
|
196
194
|
operator: model.operator,
|
|
197
195
|
value: model.value,
|
|
@@ -221,11 +219,7 @@ var FilterForm = function FilterForm(_ref) {
|
|
|
221
219
|
options: fields,
|
|
222
220
|
labelProperty: "label",
|
|
223
221
|
valueProperty: "field",
|
|
224
|
-
groupProperty: "type"
|
|
225
|
-
onSelect: function onSelect(field) {
|
|
226
|
-
var _formRef$current10;
|
|
227
|
-
return (_formRef$current10 = formRef.current) === null || _formRef$current10 === void 0 ? void 0 : _formRef$current10.setValue("type", field.type);
|
|
228
|
-
}
|
|
222
|
+
groupProperty: "type"
|
|
229
223
|
})
|
|
230
224
|
})
|
|
231
225
|
}), /*#__PURE__*/jsxs(Col, {
|
|
@@ -56,13 +56,11 @@ interface BaseFilter {
|
|
|
56
56
|
}
|
|
57
57
|
export type FilterObject = BaseFilter & ({
|
|
58
58
|
field: string;
|
|
59
|
-
type: FIELD_TYPE;
|
|
60
59
|
operator: OPERATOR;
|
|
61
60
|
value?: FilterValue;
|
|
62
61
|
query?: never;
|
|
63
62
|
} | {
|
|
64
63
|
field?: never;
|
|
65
|
-
type?: never;
|
|
66
64
|
operator?: never;
|
|
67
65
|
label: string;
|
|
68
66
|
query: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-fabric/searchbar",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.27",
|
|
4
4
|
"description": "RUF: Searchbar with filters package",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@floating-ui/react": "^0.26.24",
|
|
37
|
-
"@react-fabric/core": "^1.0.0-beta.
|
|
38
|
-
"@react-fabric/date": "^1.0.0-beta.
|
|
39
|
-
"@react-fabric/form": "^1.0.0-beta.
|
|
40
|
-
"@react-fabric/monaco": "^1.0.0-beta.
|
|
41
|
-
"@react-fabric/utilities": "^1.0.0-beta.
|
|
37
|
+
"@react-fabric/core": "^1.0.0-beta.27",
|
|
38
|
+
"@react-fabric/date": "^1.0.0-beta.27",
|
|
39
|
+
"@react-fabric/form": "^1.0.0-beta.27",
|
|
40
|
+
"@react-fabric/monaco": "^1.0.0-beta.27",
|
|
41
|
+
"@react-fabric/utilities": "^1.0.0-beta.27",
|
|
42
42
|
"classnames": "^2.5.1",
|
|
43
43
|
"react-hook-form": "^7.52.1"
|
|
44
44
|
},
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"node": ">=18.12.0",
|
|
53
53
|
"npm": ">=8.19.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "02ddac152718fe86b6003f35ea5e1ef1581168f2"
|
|
56
56
|
}
|
|
@@ -48,7 +48,7 @@ import { useFilterContext } from "./Context";
|
|
|
48
48
|
const FilterSchema = new yup.ObjectSchema({
|
|
49
49
|
id: yup.string().required(),
|
|
50
50
|
field: yup.string().required(),
|
|
51
|
-
type: yup.string().
|
|
51
|
+
// type: yup.string().oneOf(Object.values(FIELD_TYPE)),
|
|
52
52
|
operator: yup.string().required().oneOf(Object.values(OPERATOR)),
|
|
53
53
|
negate: yup.boolean(),
|
|
54
54
|
label: yup.string(),
|
|
@@ -95,7 +95,6 @@ export const FilterForm = ({
|
|
|
95
95
|
formRef.current?.setValues({
|
|
96
96
|
id: shortHash(),
|
|
97
97
|
field: "",
|
|
98
|
-
type: FIELD_TYPE.NONE,
|
|
99
98
|
operator: OPERATOR.EXISTS,
|
|
100
99
|
});
|
|
101
100
|
}
|
|
@@ -213,7 +212,6 @@ export const FilterForm = ({
|
|
|
213
212
|
const filter: FilterObject = {
|
|
214
213
|
id: model.id,
|
|
215
214
|
field: model.field,
|
|
216
|
-
type: model.type,
|
|
217
215
|
negate: model.negate,
|
|
218
216
|
operator: model.operator,
|
|
219
217
|
value: model.value as AnyObject,
|
|
@@ -246,9 +244,6 @@ export const FilterForm = ({
|
|
|
246
244
|
labelProperty="label"
|
|
247
245
|
valueProperty="field"
|
|
248
246
|
groupProperty="type"
|
|
249
|
-
onSelect={(field) =>
|
|
250
|
-
formRef.current?.setValue("type", field.type)
|
|
251
|
-
}
|
|
252
247
|
/>
|
|
253
248
|
</Controller>
|
|
254
249
|
</Col>
|
package/src/types/index.ts
CHANGED
|
@@ -153,14 +153,12 @@ export type FilterObject = BaseFilter &
|
|
|
153
153
|
(
|
|
154
154
|
| {
|
|
155
155
|
field: string;
|
|
156
|
-
type: FIELD_TYPE;
|
|
157
156
|
operator: OPERATOR;
|
|
158
157
|
value?: FilterValue;
|
|
159
158
|
query?: never;
|
|
160
159
|
}
|
|
161
160
|
| {
|
|
162
161
|
field?: never;
|
|
163
|
-
type?: never;
|
|
164
162
|
operator?: never;
|
|
165
163
|
label: string;
|
|
166
164
|
query: string;
|