@meta-1/design 0.0.192 → 0.0.194
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/package.json
CHANGED
|
@@ -21,6 +21,7 @@ export interface FiltersProps extends PropsWithChildren {
|
|
|
21
21
|
query?: any;
|
|
22
22
|
loading?: boolean;
|
|
23
23
|
load?: (params?: unknown) => Promise<unknown> | unknown;
|
|
24
|
+
reset?: () => void;
|
|
24
25
|
searchText?: string;
|
|
25
26
|
resetText?: string;
|
|
26
27
|
}
|
|
@@ -51,9 +52,13 @@ const renderItem = (item: FilterItemProps, form: { control: Control }) => {
|
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
export const Filters: FC<FiltersProps> = (props) => {
|
|
54
|
-
const { items = [], defaultValues = null, loading, load, query } = props;
|
|
55
|
+
const { items = [], defaultValues = null, loading, load, query, reset } = props;
|
|
55
56
|
const fields = items.map((item) => item.field);
|
|
56
|
-
const {
|
|
57
|
+
const {
|
|
58
|
+
reset: resetForm,
|
|
59
|
+
control,
|
|
60
|
+
handleSubmit,
|
|
61
|
+
} = useForm({
|
|
57
62
|
defaultValues: pick(query, fields),
|
|
58
63
|
});
|
|
59
64
|
|
|
@@ -84,11 +89,13 @@ export const Filters: FC<FiltersProps> = (props) => {
|
|
|
84
89
|
disabled={loading}
|
|
85
90
|
onClick={() => {
|
|
86
91
|
const filteredDefaultValues = pick(defaultValues, fields);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
reset
|
|
93
|
+
? reset()
|
|
94
|
+
: load?.({
|
|
95
|
+
...filteredDefaultValues,
|
|
96
|
+
page: 1,
|
|
97
|
+
});
|
|
98
|
+
resetForm(filteredDefaultValues);
|
|
92
99
|
}}
|
|
93
100
|
type="reset"
|
|
94
101
|
variant="secondary"
|
package/src/index.ts
CHANGED
|
@@ -100,7 +100,7 @@ export type { ConfirmProps } from "./components/uix/alert-dialog";
|
|
|
100
100
|
export { useAlert } from "./components/uix/alert-dialog";
|
|
101
101
|
export type { AvatarProps } from "./components/uix/avatar";
|
|
102
102
|
export { Avatar } from "./components/uix/avatar";
|
|
103
|
-
export type { BadgeProps } from "./components/uix/badge";
|
|
103
|
+
export type { BadgeProps, BadgeVariant } from "./components/uix/badge";
|
|
104
104
|
export { Badge } from "./components/uix/badge";
|
|
105
105
|
export type { BreadcrumbsItemProps, BreadcrumbsProps } from "./components/uix/breadcrumbs";
|
|
106
106
|
export { Breadcrumbs, BreadcrumbsItem } from "./components/uix/breadcrumbs";
|