mirror of
https://github.com/strapi/strapi.git
synced 2025-08-15 12:18:38 +00:00
ListView UI ip
This commit is contained in:
parent
995ad2643f
commit
c0ece9ff84
@ -94,7 +94,7 @@ const TableRow = styled.tr`
|
|||||||
|
|
||||||
const Icon = styled.i`
|
const Icon = styled.i`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 3px;
|
top: 6px;
|
||||||
right: -12px;
|
right: -12px;
|
||||||
|
|
||||||
${({ isAsc }) => {
|
${({ isAsc }) => {
|
||||||
|
@ -70,7 +70,7 @@ const Toggle = styled(DropdownToggle)`
|
|||||||
content: '\f0d7';
|
content: '\f0d7';
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-top: -1px;
|
margin-top: -1px;
|
||||||
margin-left: 10px;
|
margin-left: 11px;
|
||||||
font-family: FontAwesome;
|
font-family: FontAwesome;
|
||||||
color: #323740;
|
color: #323740;
|
||||||
transition: transform 0.3s ease-out;
|
transition: transform 0.3s ease-out;
|
||||||
|
@ -16,7 +16,7 @@ import RoundCTA from './RoundCTA';
|
|||||||
import Wrapper from './Wrapper';
|
import Wrapper from './Wrapper';
|
||||||
|
|
||||||
const DynamicZone = ({ max, min, name }) => {
|
const DynamicZone = ({ max, min, name }) => {
|
||||||
const [isOpen, setIsOpen] = useState(true);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const {
|
const {
|
||||||
addComponentToDynamicZone,
|
addComponentToDynamicZone,
|
||||||
formErrors,
|
formErrors,
|
||||||
@ -67,8 +67,12 @@ const DynamicZone = ({ max, min, name }) => {
|
|||||||
const hasError = dynamicZoneErrors.length > 0;
|
const hasError = dynamicZoneErrors.length > 0;
|
||||||
const hasMinError =
|
const hasMinError =
|
||||||
dynamicZoneErrors.length > 0 &&
|
dynamicZoneErrors.length > 0 &&
|
||||||
get(dynamicZoneErrors, [0, 'id'], '').includes('min') &&
|
get(dynamicZoneErrors, [0, 'id'], '').includes('min');
|
||||||
!isOpen;
|
|
||||||
|
const hasRequiredError = hasError && !hasMinError;
|
||||||
|
|
||||||
|
console.log('error', name, hasError, dynamicZoneErrors);
|
||||||
|
console.log('min', hasMinError);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -137,14 +141,14 @@ const DynamicZone = ({ max, min, name }) => {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
{hasRequiredError && <div>Component is required</div>}
|
||||||
|
{hasMinError && <div> {missingComponentNumber} missing components</div>}
|
||||||
<div className="info">
|
<div className="info">
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id={`${pluginId}.components.DynamicZone.add-compo`}
|
id={`${pluginId}.components.DynamicZone.add-compo`}
|
||||||
values={{ componentName: name }}
|
values={{ componentName: name }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{hasMinError && <div> {missingComponentNumber} missing components</div>}
|
|
||||||
<ComponentsPicker isOpen={isOpen}>
|
<ComponentsPicker isOpen={isOpen}>
|
||||||
<div>
|
<div>
|
||||||
<p className="componentPickerTitle">
|
<p className="componentPickerTitle">
|
||||||
|
@ -48,6 +48,13 @@ const createDefaultForm = (attributes, allComponentsSchema) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type === 'dynamiczone') {
|
||||||
|
console.log('dynamic', attribute, acc);
|
||||||
|
if (required === true) {
|
||||||
|
acc[current] = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
};
|
};
|
||||||
|
@ -127,7 +127,13 @@ function ListView({
|
|||||||
Object.keys(getMetaDatas())
|
Object.keys(getMetaDatas())
|
||||||
.filter(
|
.filter(
|
||||||
key =>
|
key =>
|
||||||
!['json', 'component', 'relation', 'richtext'].includes(
|
![
|
||||||
|
'json',
|
||||||
|
'component',
|
||||||
|
'dynamiczone',
|
||||||
|
'relation',
|
||||||
|
'richtext',
|
||||||
|
].includes(
|
||||||
get(
|
get(
|
||||||
layouts,
|
layouts,
|
||||||
[...contentTypePath, 'schema', 'attributes', key, 'type'],
|
[...contentTypePath, 'schema', 'attributes', key, 'type'],
|
||||||
@ -142,6 +148,7 @@ function ListView({
|
|||||||
['label', 'name']
|
['label', 'name']
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getFirstSortableElement = (name = '') => {
|
const getFirstSortableElement = (name = '') => {
|
||||||
return get(
|
return get(
|
||||||
getListLayout().filter(h => {
|
getListLayout().filter(h => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user