mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 11:25:17 +00:00
listview dropdown filter fix
This commit is contained in:
parent
83048b38d8
commit
4551c2f383
@ -121,6 +121,7 @@ function ListView({
|
||||
// Helpers
|
||||
const getMetaDatas = (path = []) =>
|
||||
get(layouts, [...contentTypePath, 'metadatas', ...path], {});
|
||||
|
||||
const getListLayout = () =>
|
||||
get(layouts, [...contentTypePath, 'layouts', 'list'], []);
|
||||
|
||||
@ -190,7 +191,11 @@ function ListView({
|
||||
});
|
||||
}
|
||||
onChangeListLabels({
|
||||
target: { name: `${slug}.${name}`, value: !value },
|
||||
target: {
|
||||
name,
|
||||
slug,
|
||||
value: !value,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -53,10 +53,11 @@ export function getLayoutSucceeded(layout, uid) {
|
||||
};
|
||||
}
|
||||
|
||||
export function onChangeListLabels({ target: { name, value } }) {
|
||||
export function onChangeListLabels({ target: { name, slug, value } }) {
|
||||
return {
|
||||
type: ON_CHANGE_LIST_LABELS,
|
||||
keys: name.split('.'),
|
||||
name,
|
||||
slug,
|
||||
value,
|
||||
};
|
||||
}
|
||||
|
||||
@ -42,18 +42,17 @@ function mainReducer(state = initialState, action) {
|
||||
.updateIn(['layouts', action.uid], () => fromJS(action.layout))
|
||||
.updateIn(['initialLayouts', action.uid], () => fromJS(action.layout));
|
||||
case ON_CHANGE_LIST_LABELS: {
|
||||
const {
|
||||
keys: [slug, label],
|
||||
value,
|
||||
} = action;
|
||||
const { name, slug, value } = action;
|
||||
|
||||
return state.updateIn(['layouts', slug, 'layouts', 'list'], list => {
|
||||
if (value) {
|
||||
return list.push(label);
|
||||
return state.updateIn(
|
||||
['layouts', slug, 'contentType', 'layouts', 'list'],
|
||||
list => {
|
||||
if (value) {
|
||||
return list.push(name);
|
||||
}
|
||||
return list.filter(l => l !== name);
|
||||
}
|
||||
|
||||
return list.filter(l => l !== label);
|
||||
});
|
||||
);
|
||||
}
|
||||
case RESET_LIST_LABELS:
|
||||
return state.updateIn(['layouts', action.slug], () =>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user