mirror of
https://github.com/strapi/strapi.git
synced 2025-09-27 09:25:46 +00:00
Merge pull request #5825 from strapi/fix/deselect-not-allowed-files
Allow deselect files
This commit is contained in:
commit
b10c81b339
@ -44,7 +44,7 @@ const Card = ({
|
|||||||
: getFileExtension(ext);
|
: getFileExtension(ext);
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
if (!isDisabled) {
|
if (!isDisabled || checked) {
|
||||||
onClick(id);
|
onClick(id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -57,7 +57,7 @@ const List = ({
|
|||||||
>
|
>
|
||||||
{(checked || canSelect) && (
|
{(checked || canSelect) && (
|
||||||
<>
|
<>
|
||||||
{isAllowed && (
|
{(checked || isAllowed) && (
|
||||||
<CardControlsWrapper leftAlign className="card-control-wrapper">
|
<CardControlsWrapper leftAlign className="card-control-wrapper">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
name={`${id}`}
|
name={`${id}`}
|
||||||
|
@ -276,7 +276,7 @@ const reducer = (state, action) =>
|
|||||||
allowedFiles.length;
|
allowedFiles.length;
|
||||||
|
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
draftState.selectedFiles = differenceWith(state.selectedFiles, allowedFiles, comparator);
|
draftState.selectedFiles = differenceWith(state.selectedFiles, state.files, comparator);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1088,12 +1088,12 @@ describe('UPLOAD | containers | ModalStepper | reducer', () => {
|
|||||||
};
|
};
|
||||||
expect(reducer(state, action)).toEqual(expected);
|
expect(reducer(state, action)).toEqual(expected);
|
||||||
});
|
});
|
||||||
it('should deselect all files of the current page only', () => {
|
it('should deselect all files of the current page only event if not allowed', () => {
|
||||||
const action = {
|
const action = {
|
||||||
type: 'TOGGLE_SELECT_ALL',
|
type: 'TOGGLE_SELECT_ALL',
|
||||||
};
|
};
|
||||||
const state = {
|
const state = {
|
||||||
allowedTypes: [],
|
allowedTypes: ['video'],
|
||||||
selectedFiles: [
|
selectedFiles: [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
@ -1160,7 +1160,7 @@ describe('UPLOAD | containers | ModalStepper | reducer', () => {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
const expected = {
|
const expected = {
|
||||||
allowedTypes: [],
|
allowedTypes: ['video'],
|
||||||
selectedFiles: [
|
selectedFiles: [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user