@react-fabric/searchbar 1.0.0-beta.8 → 1.0.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/cjs/filterbar/Context.js +1 -1
- package/dist/cjs/filterbar/FilterBar.js +28 -23
- package/dist/cjs/filterbar/FilterEdit.js +7 -4
- package/dist/cjs/filterbar/FilterForm.js +176 -56
- package/dist/cjs/filterbar/FilterMenu.js +23 -12
- package/dist/cjs/filterbar/FilterTag.js +30 -20
- package/dist/cjs/filterbar/FilterView.js +11 -6
- package/dist/cjs/filterbar/QueryForm.js +47 -24
- package/dist/cjs/i18n/{ar.json.js → ar/searchbar.json.js} +43 -39
- package/dist/cjs/i18n/{en.json.js → en/searchbar.json.js} +43 -39
- package/dist/cjs/i18n/index.js +4 -4
- package/dist/cjs/index.js +28 -0
- package/dist/cjs/searchbar/SearchBar.js +58 -16
- package/dist/cjs/types/index.js +13 -4
- package/dist/esm/filterbar/Context.js +2 -2
- package/dist/esm/filterbar/FilterBar.js +30 -25
- package/dist/esm/filterbar/FilterEdit.js +7 -4
- package/dist/esm/filterbar/FilterForm.js +179 -59
- package/dist/esm/filterbar/FilterMenu.js +24 -13
- package/dist/esm/filterbar/FilterTag.js +32 -22
- package/dist/esm/filterbar/FilterView.js +11 -6
- package/dist/esm/filterbar/QueryForm.js +48 -25
- package/dist/esm/i18n/{ar.json.js → ar/searchbar.json.js} +43 -39
- package/dist/esm/i18n/{en.json.js → en/searchbar.json.js} +43 -39
- package/dist/esm/i18n/index.js +2 -2
- package/dist/esm/index.js +30 -0
- package/dist/esm/searchbar/SearchBar.js +59 -17
- package/dist/esm/types/index.js +13 -4
- package/dist/types/filterbar/Context.d.ts +2 -3
- package/dist/types/filterbar/FilterBar.d.ts +23 -1
- package/dist/types/filterbar/FilterEdit.d.ts +2 -2
- package/dist/types/filterbar/FilterForm.d.ts +3 -3
- package/dist/types/filterbar/FilterMenu.d.ts +3 -2
- package/dist/types/filterbar/FilterTag.d.ts +3 -2
- package/dist/types/filterbar/FilterView.d.ts +2 -2
- package/dist/types/filterbar/QueryForm.d.ts +2 -2
- package/dist/types/index.d.ts +27 -1
- package/dist/types/searchbar/SearchBar.d.ts +30 -1
- package/dist/types/types/index.d.ts +23 -14
- package/package.json +16 -19
- package/src/filterbar/Context.tsx +5 -5
- package/src/filterbar/FilterBar.tsx +58 -75
- package/src/filterbar/FilterEdit.tsx +9 -16
- package/src/filterbar/FilterForm.tsx +149 -85
- package/src/filterbar/FilterMenu.tsx +29 -16
- package/src/filterbar/FilterTag.tsx +30 -43
- package/src/filterbar/FilterView.tsx +13 -24
- package/src/filterbar/QueryForm.tsx +26 -43
- package/src/i18n/{ar.json → ar/searchbar.json} +43 -39
- package/src/i18n/{en.json → en/searchbar.json} +43 -39
- package/src/i18n/index.ts +2 -2
- package/src/index.ts +23 -18
- package/src/searchbar/SearchBar.tsx +67 -40
- package/src/types/index.ts +38 -70
|
@@ -27,18 +27,11 @@ import { Fragment, useMemo } from "react";
|
|
|
27
27
|
import { useTranslation } from "react-i18next";
|
|
28
28
|
import { type FilterObject, OPERATOR } from "../types";
|
|
29
29
|
|
|
30
|
-
export
|
|
31
|
-
filter,
|
|
32
|
-
onRemove,
|
|
33
|
-
}: {
|
|
34
|
-
filter: FilterObject;
|
|
35
|
-
onRemove: () => void;
|
|
36
|
-
}) => {
|
|
30
|
+
export function FilterView({ filter, onRemove }: { filter: FilterObject; onRemove: () => void }) {
|
|
37
31
|
const { t } = useTranslation("searchbar");
|
|
38
32
|
|
|
39
33
|
const view = useMemo(() => {
|
|
40
|
-
if ("query" in filter)
|
|
41
|
-
return JSON.stringify(JSON.parse(filter.query ?? "{}"), null, 2);
|
|
34
|
+
if ("query" in filter) return JSON.stringify(JSON.parse(filter.query ?? "{}"), null, 2);
|
|
42
35
|
|
|
43
36
|
if ("field" in filter) {
|
|
44
37
|
let value = filter.value?.toString();
|
|
@@ -47,9 +40,12 @@ export const FilterView = ({
|
|
|
47
40
|
value = `[${filter.value?.join(" - ")}]`;
|
|
48
41
|
}
|
|
49
42
|
|
|
50
|
-
if (filter.operator === OPERATOR.
|
|
43
|
+
if (filter.operator === OPERATOR.ANY && isArray(filter.value)) {
|
|
51
44
|
value = `[${filter.value?.join(", ")}]`;
|
|
52
45
|
}
|
|
46
|
+
if (filter.operator === OPERATOR.ALL && isArray(filter.value)) {
|
|
47
|
+
value = `(${filter.value?.join(", ")})`;
|
|
48
|
+
}
|
|
53
49
|
|
|
54
50
|
return (
|
|
55
51
|
<Fragment>
|
|
@@ -61,29 +57,22 @@ export const FilterView = ({
|
|
|
61
57
|
);
|
|
62
58
|
}
|
|
63
59
|
return "";
|
|
60
|
+
// eslint-disable-next-line @eslint-react/exhaustive-deps
|
|
64
61
|
}, [filter]);
|
|
65
62
|
|
|
66
63
|
return (
|
|
67
|
-
<div className="p-2 bg-
|
|
64
|
+
<div className="p-2 bg-default relative rounded-capped">
|
|
68
65
|
{"query" in filter && (
|
|
69
|
-
<div className="absolute top-2
|
|
70
|
-
<Copy size="sm" text={view as
|
|
66
|
+
<div className="absolute top-2 inset-e-2 z-10">
|
|
67
|
+
<Copy size="sm" text={view as string} />
|
|
71
68
|
</div>
|
|
72
69
|
)}
|
|
73
|
-
<pre className="overflow-auto bg-
|
|
74
|
-
{view}
|
|
75
|
-
</pre>
|
|
70
|
+
<pre className="overflow-auto bg-default outline text-sm p-2 max-h-96 max-w-3xl min-w-[24rem]">{view}</pre>
|
|
76
71
|
{!filter.required && (
|
|
77
|
-
<Button
|
|
78
|
-
size="sm"
|
|
79
|
-
variant="link"
|
|
80
|
-
color="danger"
|
|
81
|
-
data-dropdown-dismiss="true"
|
|
82
|
-
onClick={onRemove}
|
|
83
|
-
>
|
|
72
|
+
<Button size="sm" variant="link" color="danger" data-dropdown-dismiss="true" onClick={onRemove}>
|
|
84
73
|
{t("label.remove")}
|
|
85
74
|
</Button>
|
|
86
75
|
)}
|
|
87
76
|
</div>
|
|
88
77
|
);
|
|
89
|
-
}
|
|
78
|
+
}
|
|
@@ -22,16 +22,17 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import { useFloatingTree } from "@floating-ui/react";
|
|
25
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
25
26
|
import { Button, Callout } from "@react-fabric/core";
|
|
26
27
|
import { Controller, Form, Input } from "@react-fabric/form";
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import classNames from "classnames";
|
|
30
|
-
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
28
|
+
import { cn, isEmpty, shortHash, yup } from "@react-fabric/utilities";
|
|
29
|
+
import { lazy, useCallback, useEffect, useMemo, useRef } from "react";
|
|
31
30
|
import { useTranslation } from "react-i18next";
|
|
32
31
|
import { type FilterObject } from "../types";
|
|
33
32
|
import { useFilterContext } from "./Context";
|
|
34
33
|
|
|
34
|
+
const CodeEditor = lazy(async () => await import("@react-fabric/monaco").then((CE) => ({ default: CE.CodeEditor })));
|
|
35
|
+
|
|
35
36
|
const QuerySchema = new yup.ObjectSchema({
|
|
36
37
|
id: yup.string().required(),
|
|
37
38
|
label: yup.string().required(),
|
|
@@ -49,7 +50,7 @@ const QuerySchema = new yup.ObjectSchema({
|
|
|
49
50
|
|
|
50
51
|
type QuerySchemaType = yup.InferType<typeof QuerySchema>;
|
|
51
52
|
|
|
52
|
-
export
|
|
53
|
+
export function QueryForm({
|
|
53
54
|
filter,
|
|
54
55
|
onChange,
|
|
55
56
|
onRemove,
|
|
@@ -57,10 +58,10 @@ export const QueryForm = ({
|
|
|
57
58
|
filter?: FilterObject;
|
|
58
59
|
onRemove?: () => void;
|
|
59
60
|
onChange?: (filter: FilterObject) => void;
|
|
60
|
-
})
|
|
61
|
+
}) {
|
|
61
62
|
const { t } = useTranslation("searchbar");
|
|
62
63
|
const tree = useFloatingTree();
|
|
63
|
-
const { defaultQuery = "", querySchema } = useFilterContext();
|
|
64
|
+
const { defaultQuery = "", querySchema, queryLanguage } = useFilterContext();
|
|
64
65
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
65
66
|
|
|
66
67
|
const filterValue = useMemo(() => {
|
|
@@ -75,12 +76,15 @@ export const QueryForm = ({
|
|
|
75
76
|
label: "",
|
|
76
77
|
query: defaultQuery,
|
|
77
78
|
};
|
|
78
|
-
}, [filter]);
|
|
79
|
+
}, [defaultQuery, filter]);
|
|
79
80
|
|
|
80
81
|
useEffect(() => {
|
|
81
|
-
setTimeout(() => {
|
|
82
|
+
const tmr = setTimeout(() => {
|
|
82
83
|
inputRef.current?.focus();
|
|
83
84
|
}, 100);
|
|
85
|
+
return () => {
|
|
86
|
+
clearTimeout(tmr);
|
|
87
|
+
};
|
|
84
88
|
}, []);
|
|
85
89
|
|
|
86
90
|
const handleSubmit = useCallback(
|
|
@@ -93,59 +97,38 @@ export const QueryForm = ({
|
|
|
93
97
|
onChange?.(filter);
|
|
94
98
|
tree?.events.emit("close");
|
|
95
99
|
},
|
|
100
|
+
// eslint-disable-next-line @eslint-react/exhaustive-deps
|
|
96
101
|
[onChange],
|
|
97
102
|
);
|
|
98
103
|
|
|
99
104
|
return (
|
|
100
|
-
<Form<QuerySchemaType>
|
|
101
|
-
schema={QuerySchema}
|
|
102
|
-
defaultValues={filterValue}
|
|
103
|
-
onSubmit={handleSubmit}
|
|
104
|
-
>
|
|
105
|
+
<Form<QuerySchemaType> resolver={yupResolver(QuerySchema)} defaultValues={filterValue} onSubmit={handleSubmit}>
|
|
105
106
|
<Callout color="warning">For advanced users only!</Callout>
|
|
106
107
|
<Controller name="label">
|
|
107
|
-
<Input
|
|
108
|
-
required
|
|
109
|
-
ref={inputRef}
|
|
110
|
-
label={t("label.label")}
|
|
111
|
-
placeholder={t("label.label")}
|
|
112
|
-
/>
|
|
108
|
+
<Input required ref={inputRef} label={t("label.label")} placeholder={t("label.label")} />
|
|
113
109
|
</Controller>
|
|
114
110
|
<Controller name="query">
|
|
115
|
-
{({
|
|
111
|
+
{({ invalid, ...field }) => (
|
|
116
112
|
<div className="my-2">
|
|
117
|
-
<label
|
|
118
|
-
className={classNames("block px-2", invalid && "text-danger-600")}
|
|
119
|
-
>
|
|
120
|
-
{t("label.query")}
|
|
121
|
-
</label>
|
|
113
|
+
<label className={cn("block px-2", invalid && "text-danger-600")}>{t("label.query")}</label>
|
|
122
114
|
<div
|
|
123
|
-
className=
|
|
115
|
+
className={cn(
|
|
116
|
+
"h-96 w-xl grid outline place-content-start",
|
|
117
|
+
invalid && "[&_.fabric-codeEditor]:border-danger-500!",
|
|
118
|
+
)}
|
|
124
119
|
style={{
|
|
125
120
|
gridTemplate: '"content" 1fr/1fr',
|
|
126
121
|
}}
|
|
127
122
|
>
|
|
128
|
-
<CodeEditor
|
|
129
|
-
language="json"
|
|
130
|
-
minimal
|
|
131
|
-
required
|
|
132
|
-
{...field}
|
|
133
|
-
schema={querySchema}
|
|
134
|
-
/>
|
|
123
|
+
<CodeEditor language={queryLanguage ?? "text"} minimal required {...field} schema={querySchema} />
|
|
135
124
|
</div>
|
|
136
125
|
</div>
|
|
137
126
|
)}
|
|
138
127
|
</Controller>
|
|
139
|
-
<div className="flex justify-end gap-1">
|
|
128
|
+
<div className="flex mt-4 justify-end gap-1 sticky bottom-1 bg-default">
|
|
140
129
|
{onRemove && (
|
|
141
130
|
<div className="flex-1">
|
|
142
|
-
<Button
|
|
143
|
-
data-dropdown-dismiss="true"
|
|
144
|
-
variant="link"
|
|
145
|
-
size="sm"
|
|
146
|
-
color="danger"
|
|
147
|
-
onClick={onRemove}
|
|
148
|
-
>
|
|
131
|
+
<Button data-dropdown-dismiss="true" variant="link" size="sm" color="danger" onClick={onRemove}>
|
|
149
132
|
{t("label.remove")}
|
|
150
133
|
</Button>
|
|
151
134
|
</div>
|
|
@@ -159,4 +142,4 @@ export const QueryForm = ({
|
|
|
159
142
|
</div>
|
|
160
143
|
</Form>
|
|
161
144
|
);
|
|
162
|
-
}
|
|
145
|
+
}
|
|
@@ -1,68 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"label": {
|
|
3
|
-
"
|
|
3
|
+
"add": "إضافة عامل تصفية",
|
|
4
4
|
"all_filters": "جميع المرشحات",
|
|
5
|
+
"apply": "يتقدم",
|
|
6
|
+
"basicFilter": "الفلتر الأساسي",
|
|
7
|
+
"cancel": "يلغي",
|
|
8
|
+
"customQuery": "استعلام مخصص",
|
|
9
|
+
"delete": "يمسح",
|
|
10
|
+
"disable": "إبطال",
|
|
11
|
+
"disableAll": "تعطيل الكل",
|
|
12
|
+
"edit": "يحرر",
|
|
13
|
+
"enable": "يُمكَِن",
|
|
14
|
+
"enableAll": "تمكين الكل",
|
|
15
|
+
"exclude": "استبعاد",
|
|
16
|
+
"excludeAll": "استبعاد الكل",
|
|
5
17
|
"field": "مجال",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
18
|
+
"filters": "المرشحات",
|
|
19
|
+
"forAdvanced": "للمستخدمين المتقدمين فقط!",
|
|
20
|
+
"include": "يشمل",
|
|
21
|
+
"includeAll": "تضمين الكل",
|
|
22
|
+
"invertAll": "عكس التضمين/الاستبعاد",
|
|
8
23
|
"label": "ملصق",
|
|
24
|
+
"operator": "المشغل",
|
|
9
25
|
"optional": "خياري",
|
|
10
|
-
"add": "إضافة عامل تصفية",
|
|
11
|
-
"edit": "يحرر",
|
|
12
|
-
"view": "منظر",
|
|
13
26
|
"pin": "مثبت",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"invertAll": "عكس التضمين/الاستبعاد",
|
|
27
|
+
"query": "استفسار",
|
|
28
|
+
"refresh": "ينعش",
|
|
29
|
+
"remove": "يزيل",
|
|
18
30
|
"removeAll": "إزالة الكل",
|
|
19
|
-
"enableAll": "تمكين الكل",
|
|
20
|
-
"disableAll": "تعطيل الكل",
|
|
21
31
|
"toggleDisable": "عكس تعطيل/تمكين",
|
|
22
|
-
"
|
|
23
|
-
"enable": "يُمكَِن",
|
|
24
|
-
"disable": "إبطال",
|
|
25
|
-
"exclude": "استبعاد",
|
|
26
|
-
"include": "يشمل",
|
|
27
|
-
"refresh": "ينعش",
|
|
32
|
+
"unpin": "غير مثبت",
|
|
28
33
|
"update": "تحديث",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"basicFilter": "الفلتر الأساسي",
|
|
34
|
-
"customQuery": "استعلام مخصص",
|
|
35
|
-
"forAdvanced": "للمستخدمين المتقدمين فقط!"
|
|
34
|
+
"value": "قيمة",
|
|
35
|
+
"view": "منظر",
|
|
36
|
+
"matchAll": "تطابق كل شيء",
|
|
37
|
+
"matchAny": "تطابق أي"
|
|
36
38
|
},
|
|
37
39
|
"operator": {
|
|
40
|
+
"ALL": "كل",
|
|
41
|
+
"ANY": "أي من",
|
|
42
|
+
"BETWEEN": "بين هذا وذاك",
|
|
43
|
+
"ENDS": "ينتهي مع",
|
|
44
|
+
"EQ": "=",
|
|
38
45
|
"EXISTS": "موجود",
|
|
46
|
+
"GT": ">",
|
|
47
|
+
"GTE": "≥",
|
|
39
48
|
"IS": "يكون",
|
|
40
|
-
"
|
|
49
|
+
"LIKE": "يحب",
|
|
41
50
|
"LT": "<",
|
|
42
|
-
"GT": ">",
|
|
43
51
|
"LTE": "≤",
|
|
44
|
-
"GTE": "≥",
|
|
45
|
-
"INCLUDES": "يشمل",
|
|
46
52
|
"STARTS": "ابدا ب",
|
|
47
|
-
"
|
|
48
|
-
"WITHIN": "في غضون",
|
|
49
|
-
"BETWEEN": "بين هذا وذاك"
|
|
53
|
+
"WITHIN": "في غضون"
|
|
50
54
|
},
|
|
51
55
|
"placeholder": "مصطلح البحث...",
|
|
52
56
|
"type": {
|
|
53
|
-
"STRING": "سلسلة",
|
|
54
|
-
"NUMBER": "كثافة العمليات",
|
|
55
|
-
"DECIMAL": "يطفو",
|
|
56
57
|
"BOOLEAN": "رقم",
|
|
57
58
|
"DATE": "منطقي",
|
|
58
59
|
"DATETIME": "تاريخ",
|
|
59
|
-
"
|
|
60
|
+
"DECIMAL": "يطفو",
|
|
61
|
+
"GEO": "GeoJSON",
|
|
62
|
+
"NUMBER": "كثافة العمليات",
|
|
63
|
+
"STRING": "سلسلة"
|
|
60
64
|
},
|
|
61
65
|
"validate": {
|
|
66
|
+
"compare": "مقارنة الحقل المطلوب",
|
|
62
67
|
"field": "حقل مطلوب",
|
|
68
|
+
"label": "التصنيف مطلوب",
|
|
63
69
|
"operator": "عامل مطلوب",
|
|
64
|
-
"value": "القيمة المطلوبة"
|
|
65
|
-
"compare": "مقارنة الحقل المطلوب",
|
|
66
|
-
"label": "التصنيف مطلوب"
|
|
70
|
+
"value": "القيمة المطلوبة"
|
|
67
71
|
}
|
|
68
72
|
}
|
|
@@ -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/i18n/index.ts
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import { addTranslationBundle } from "@react-fabric/core";
|
|
25
|
-
import ar from "./ar.json";
|
|
26
|
-
import en from "./en.json";
|
|
25
|
+
import ar from "./ar/searchbar.json";
|
|
26
|
+
import en from "./en/searchbar.json";
|
|
27
27
|
|
|
28
28
|
addTranslationBundle("searchbar", { en, ar });
|
package/src/index.ts
CHANGED
|
@@ -1,28 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
2
|
* React Fabric
|
|
3
|
-
* @version
|
|
3
|
+
* @version 1.0.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2024 Adarsh Pastakia
|
|
4
6
|
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
5
13
|
*
|
|
6
|
-
* The
|
|
7
|
-
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
8
16
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* portions of the Software.
|
|
17
|
-
*
|
|
18
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
19
|
-
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
20
|
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
22
24
|
*/
|
|
23
25
|
|
|
26
|
+
export const SEARCHBAR_PACKAGE = "@react-fabric/searchbar";
|
|
27
|
+
export const SEARCHBAR_VERSION = "1.0.0";
|
|
28
|
+
|
|
24
29
|
import "./i18n";
|
|
25
30
|
|
|
26
31
|
export { FilterBar } from "./filterbar/FilterBar";
|
|
27
32
|
export { SearchBar } from "./searchbar/SearchBar";
|
|
28
|
-
export { FIELD_TYPE, OPERATOR, type FilterObject } from "./types";
|
|
33
|
+
export { FIELD_TYPE, OPERATOR, type FilterObject, type SearchObject } from "./types";
|