@irontec/ivoz-ui 1.5.0 → 1.5.2
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.
|
@@ -9,9 +9,7 @@ import useFirstColumn from './hook/useFirstColumn';
|
|
|
9
9
|
import useFirstColumnCriteria from './hook/useFirstColumnCriteria';
|
|
10
10
|
const FastSearchField = (props, ref) => {
|
|
11
11
|
const { className, path, entityService, ignoreColumn } = props;
|
|
12
|
-
const
|
|
13
|
-
...state.route.queryStringCriteria,
|
|
14
|
-
]);
|
|
12
|
+
const storeQueryStringCriteria = useStoreState((state) => state.route.queryStringCriteria);
|
|
15
13
|
const setQueryStringCriteria = useStoreActions((actions) => {
|
|
16
14
|
return actions.route.setQueryStringCriteria;
|
|
17
15
|
});
|
|
@@ -43,6 +41,7 @@ const FastSearchField = (props, ref) => {
|
|
|
43
41
|
}
|
|
44
42
|
let match = false;
|
|
45
43
|
let matchIdx;
|
|
44
|
+
const queryStringCriteria = [...storeQueryStringCriteria];
|
|
46
45
|
for (const idx in queryStringCriteria) {
|
|
47
46
|
if (queryStringCriteria[idx].name !== firstColumnCriteria.name) {
|
|
48
47
|
continue;
|
|
@@ -61,7 +60,8 @@ const FastSearchField = (props, ref) => {
|
|
|
61
60
|
else if (value === '' && matchIdx) {
|
|
62
61
|
queryStringCriteria.splice(parseInt(matchIdx, 10), 1);
|
|
63
62
|
}
|
|
64
|
-
|
|
63
|
+
const queryStringCriteriaWithoutPagination = queryStringCriteria.filter((criteria) => criteria.name !== '_page');
|
|
64
|
+
setQueryStringCriteria(queryStringCriteriaWithoutPagination);
|
|
65
65
|
};
|
|
66
66
|
const changeHandler = ({ target, }) => {
|
|
67
67
|
const { value } = target;
|
|
@@ -4,9 +4,7 @@ import { getI18n } from 'react-i18next';
|
|
|
4
4
|
const useFirstColumnCriteria = (props) => {
|
|
5
5
|
const { entityService, ignoreColumn, path } = props;
|
|
6
6
|
const [firstColumnCriteria, setFirstColumnCriteria] = useState(undefined);
|
|
7
|
-
const queryStringCriteria = useStoreState((state) =>
|
|
8
|
-
...state.route.queryStringCriteria,
|
|
9
|
-
]);
|
|
7
|
+
const queryStringCriteria = useStoreState((state) => state.route.queryStringCriteria);
|
|
10
8
|
const storeState = useStoreState((state) => state, () => {
|
|
11
9
|
return true;
|
|
12
10
|
});
|
|
@@ -28,8 +28,8 @@ export default function ContentFilterSelector(props) {
|
|
|
28
28
|
const firstFilter = Object.keys(filters)[0];
|
|
29
29
|
const currentColumn = columns[firstFilter];
|
|
30
30
|
const propertyFilters = filters[firstFilter] || [];
|
|
31
|
-
let preferredFilter = currentColumn.preferredFilter || 'partial';
|
|
32
|
-
if (!currentColumn.preferredFilter) {
|
|
31
|
+
let preferredFilter = (currentColumn === null || currentColumn === void 0 ? void 0 : currentColumn.preferredFilter) || 'partial';
|
|
32
|
+
if (currentColumn && !currentColumn.preferredFilter) {
|
|
33
33
|
switch (true) {
|
|
34
34
|
case isPropertyScalar(currentColumn) &&
|
|
35
35
|
currentColumn.format === 'date-time':
|
|
@@ -67,6 +67,7 @@ export default function ContentFilterSelector(props) {
|
|
|
67
67
|
type: defaultFilter,
|
|
68
68
|
value: '',
|
|
69
69
|
}, columns: columns, fkChoices: fkChoices, fieldNames: fieldNames, isLast: true, setRow: setRow, removeRow: removeRow }, criteria.length)] })), mobile && (_jsx(Box, { children: _jsx(FilterCriteria, { entityService: entityService, fkChoices: fkChoices, removeFilter: removeRow, path: path, criteriaOverride: criteria }) })), _jsxs(Box, Object.assign({ className: 'actions' }, { children: [_jsx(Box, { children: _jsx("a", Object.assign({ href: '#', onClick: resetCriteria, className: 'link' }, { children: _('Clear all filters') })) }), _jsxs(Box, Object.assign({ className: 'buttons' }, { children: [_jsx(OutlinedButton, Object.assign({ variant: 'contained', onClick: close }, { children: _('Cancel') })), _jsx(SolidButton, Object.assign({ variant: 'contained', disabled: criteria.length < 1, onClick: () => {
|
|
70
|
-
|
|
70
|
+
const queryStringCriteriaWithoutPagination = criteria.filter((criteria) => criteria.name !== '_page');
|
|
71
|
+
commitCriteria(queryStringCriteriaWithoutPagination);
|
|
71
72
|
} }, { children: _('Apply') }))] }))] }))] })));
|
|
72
73
|
}
|