muffin-admin 9.1.2 → 9.2.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/buildRA.js +4 -2
- package/dist/filters/SearchFilter.d.ts +2 -0
- package/dist/filters/SearchFilter.js +34 -0
- package/dist/filters/index.d.ts +1 -0
- package/dist/filters/index.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/buildRA.tsx +4 -1
- package/src/filters/SearchFilter.tsx +40 -0
- package/src/filters/index.ts +1 -0
- package/src/index.tsx +1 -1
package/dist/buildRA.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ArrayField, ArrayInput, AutocompleteArrayInput, AutocompleteInput, BooleanField, BooleanInput, CheckboxGroupInput, ChipField, DateField, DateInput, DateTimeInput, EmailField, FileField, FileInput, ImageField, ImageInput, NullableBooleanInput, NumberField, NumberInput, PasswordInput, RadioButtonGroupInput, ReferenceArrayField, ReferenceArrayInput, ReferenceField, ReferenceInput, ReferenceManyField, required, RichTextField, SelectArrayInput, SelectField, SelectInput, TextField, TextInput, UrlField, } from "react-admin";
|
|
2
|
+
import { ArrayField, ArrayInput, AutocompleteArrayInput, AutocompleteInput, BooleanField, BooleanInput, CheckboxGroupInput, ChipField, DateField, DateInput, DateTimeInput, EmailField, FileField, FileInput, ImageField, ImageInput, NullableBooleanInput, NumberField, NumberInput, PasswordInput, RadioButtonGroupInput, ReferenceArrayField, ReferenceArrayInput, ReferenceField, ReferenceInput, ReferenceManyField, required, RichTextField, SearchInput, SelectArrayInput, SelectField, SelectInput, TextField, TextInput, UrlField, } from "react-admin";
|
|
3
3
|
import { AvatarField, CopyField, EditableBooleanField, FKField, JsonField } from "./fields";
|
|
4
|
-
import { DateRangeFilter, Filter } from "./filters";
|
|
4
|
+
import { DateRangeFilter, Filter, SearchFilter } from "./filters";
|
|
5
5
|
import { FKInput, JsonInput, TimestampInput } from "./inputs";
|
|
6
6
|
const UI = {
|
|
7
7
|
// Fields
|
|
@@ -47,9 +47,11 @@ const UI = {
|
|
|
47
47
|
SelectInput,
|
|
48
48
|
TextInput,
|
|
49
49
|
TimestampInput,
|
|
50
|
+
SearchInput,
|
|
50
51
|
// Filters
|
|
51
52
|
Filter,
|
|
52
53
|
DateRangeFilter,
|
|
54
|
+
SearchFilter,
|
|
53
55
|
};
|
|
54
56
|
export function buildRAComponent(name, props) {
|
|
55
57
|
const Item = UI[name];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import SearchIcon from "@mui/icons-material/Search";
|
|
14
|
+
import { InputAdornment } from "@mui/material";
|
|
15
|
+
import clsx from "clsx";
|
|
16
|
+
import debounce from "lodash/debounce";
|
|
17
|
+
import { useTranslate } from "ra-core";
|
|
18
|
+
import { useState } from "react";
|
|
19
|
+
import { ResettableTextField, useInput, useResourceContext } from "react-admin";
|
|
20
|
+
export function SearchFilter(_a) {
|
|
21
|
+
var { source, className } = _a, props = __rest(_a, ["source", "className"]);
|
|
22
|
+
const translate = useTranslate();
|
|
23
|
+
const { field } = useInput(Object.assign({ source }, props));
|
|
24
|
+
const [searchValue, setSearchValue] = useState(field.value || "");
|
|
25
|
+
const resource = useResourceContext();
|
|
26
|
+
const onBlur = () => field.onChange(searchValue);
|
|
27
|
+
const label = translate(`resources.${resource}.fields.${source}`);
|
|
28
|
+
return (_jsx(ResettableTextField, Object.assign({ resettable: true, ref: field.ref, value: searchValue, onBlur: debounce(onBlur, 500), onChange: (e) => { var _a; return setSearchValue(((_a = e.target) === null || _a === void 0 ? void 0 : _a.value) || e); }, onKeyUp: (e) => {
|
|
29
|
+
if (e.key === "Enter")
|
|
30
|
+
field.onChange(searchValue);
|
|
31
|
+
}, placeholder: label }, props, { className: clsx("ra-input", `ra-input-${source}`, className), InputProps: {
|
|
32
|
+
endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(SearchIcon, { color: "disabled" }) })),
|
|
33
|
+
} })));
|
|
34
|
+
}
|
package/dist/filters/index.d.ts
CHANGED
package/dist/filters/index.js
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED