@dilicorp/ui 0.2.41 → 0.2.42
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/components/page-list/filter-components/filter-form.d.ts +5 -4
- package/dist/components/page-list/filter-components/filter-form.js +6 -2
- package/dist/components/page-list/filters/filter-async-select-group/filter-group.js +6 -1
- package/dist/components/page-list/page-list-filters.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
export declare type FilterProps = {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
};
|
|
2
5
|
declare type Props = {
|
|
3
6
|
children: React.ReactNode;
|
|
4
|
-
search?:
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
submitFunction?: (submit: Function) => void;
|
|
7
|
+
search?: FilterProps;
|
|
8
|
+
submitFunction?: (submit: Function, filters: FilterProps, event: any) => void;
|
|
8
9
|
};
|
|
9
10
|
export declare const FilterForm: React.FC<Props>;
|
|
10
11
|
export {};
|
|
@@ -4,7 +4,7 @@ import uriHelper from '../../../utils/uri-helper';
|
|
|
4
4
|
export const FilterForm = (props) => {
|
|
5
5
|
const { children, search, submitFunction } = props;
|
|
6
6
|
const navigate = useNavigate();
|
|
7
|
-
const
|
|
7
|
+
const getFilters = (e) => {
|
|
8
8
|
const count = e.target.length;
|
|
9
9
|
const fields = e.target;
|
|
10
10
|
const whiteList = ['input', 'select', 'textarea'];
|
|
@@ -18,6 +18,10 @@ export const FilterForm = (props) => {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
+
return elements || {};
|
|
22
|
+
};
|
|
23
|
+
const submit = (e) => {
|
|
24
|
+
const elements = getFilters(e);
|
|
21
25
|
navigate({
|
|
22
26
|
search: uriHelper.stringify({ ...elements, page: 1 })
|
|
23
27
|
});
|
|
@@ -25,7 +29,7 @@ export const FilterForm = (props) => {
|
|
|
25
29
|
return (React.createElement("form", { className: "filter-form", onSubmit: (e) => {
|
|
26
30
|
e.preventDefault();
|
|
27
31
|
if (submitFunction) {
|
|
28
|
-
submitFunction(() => submit(e));
|
|
32
|
+
submitFunction(() => submit(e), getFilters(e), e);
|
|
29
33
|
}
|
|
30
34
|
else {
|
|
31
35
|
submit(e);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import { Col } from '../../../../atoms/col';
|
|
3
3
|
import { Row } from '../../../../atoms/row';
|
|
4
4
|
export const FilterGroupSelect = (props) => {
|
|
@@ -37,6 +37,11 @@ export const FilterGroupSelect = (props) => {
|
|
|
37
37
|
});
|
|
38
38
|
return clone;
|
|
39
39
|
}, [inputRef]);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
var _a;
|
|
42
|
+
if (value && inputRef)
|
|
43
|
+
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.setAttribute('value', value);
|
|
44
|
+
}, []);
|
|
40
45
|
return (React.createElement("div", { className: "form-input-group label-margin" },
|
|
41
46
|
Boolean(label) && React.createElement("label", { className: "form-label new-label", htmlFor: name }, label),
|
|
42
47
|
React.createElement("input", { name: name, type: "text", ref: inputRef, hidden: true }),
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { columns } from '../../atoms/col';
|
|
3
|
+
import { FilterProps } from './filter-components/filter-form';
|
|
3
4
|
export declare type PageListFiltersProps = {
|
|
4
5
|
children: React.ReactNode;
|
|
5
6
|
filterSize?: columns;
|
|
6
7
|
filterClassName?: string;
|
|
7
8
|
numFiltersVisible?: number;
|
|
8
9
|
filterLabel?: boolean;
|
|
9
|
-
submitFunction?: (submit: Function) => void;
|
|
10
|
+
submitFunction?: (submit: Function, filters: FilterProps, event: any) => void;
|
|
10
11
|
clearFunction?: (clear: Function) => void;
|
|
11
12
|
};
|
|
12
13
|
export declare const PageListFilters: {
|