muffin-admin 9.1.1 → 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.
@@ -20,6 +20,7 @@ export function MuffinDashboard() {
20
20
  }
21
21
  setupAdmin(["dashboard"], MuffinDashboard);
22
22
  setupAdmin(["dashboard-actions"], () => null);
23
+ setupAdmin(["dashboard-content"], () => null);
23
24
  function AdminCards({ src }) {
24
25
  if (Array.isArray(src))
25
26
  return (_jsx(Grid, { container: true, item: true, spacing: 2, children: src.map((card, idx) => (_jsx(AdminCards, { src: card }, idx))) }));
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,2 @@
1
+ import { SearchInputProps } from "react-admin";
2
+ export declare function SearchFilter({ source, className, ...props }: SearchInputProps): import("react/jsx-runtime").JSX.Element;
@@ -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
+ }
@@ -1,2 +1,3 @@
1
1
  export * from "./DateRangeFilter";
2
2
  export * from "./Filter";
3
+ export * from "./SearchFilter";
@@ -1,2 +1,3 @@
1
1
  export * from "./DateRangeFilter";
2
2
  export * from "./Filter";
3
+ export * from "./SearchFilter";
package/dist/index.d.ts CHANGED
@@ -18,4 +18,4 @@ export * from "./fields";
18
18
  export * from "./hooks";
19
19
  export * from "./types";
20
20
  export declare function initAdmin(prefix?: string, containerId?: string): Promise<void>;
21
- export declare const VERSION = "9.1.1";
21
+ export declare const VERSION = "9.2.1";
package/dist/index.js CHANGED
@@ -41,4 +41,4 @@ export function initAdmin() {
41
41
  root.render(_jsx(MuffinAdminContext.Provider, { value: adminOpts, children: _jsx(MuffinAdmin, {}) }));
42
42
  });
43
43
  }
44
- export const VERSION = "9.1.1";
44
+ export const VERSION = "9.2.1";