diff --git a/packages/strapi-plugin-content-type-builder/admin/src/components/CustomCheckbox/StyledCustomCheckbox.js b/packages/strapi-plugin-content-type-builder/admin/src/components/CustomCheckbox/StyledCustomCheckbox.js index eb50136ce0..273c6b2687 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/components/CustomCheckbox/StyledCustomCheckbox.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/components/CustomCheckbox/StyledCustomCheckbox.js @@ -8,10 +8,7 @@ import styled from 'styled-components'; const StyledCustomCheckbox = styled.div` width: 100%; - // padding: 0 15px; padding: 0; - // margin-top: -6px; - // margin-bottom: 16px; > label { font-weight: 500 !important; font-size: 12px; @@ -32,10 +29,11 @@ const StyledCustomCheckbox = styled.div` line-height: 10px; } } - // input[type='number'] { - // margin-top: -10px; - // margin-bottom: -4px; - // } + .no-label { + label { + display: none; + } + } `; export default StyledCustomCheckbox; diff --git a/packages/strapi-plugin-content-type-builder/admin/src/components/CustomCheckbox/index.js b/packages/strapi-plugin-content-type-builder/admin/src/components/CustomCheckbox/index.js index 5bffd5e6f1..634fdb9c43 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/components/CustomCheckbox/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/components/CustomCheckbox/index.js @@ -33,13 +33,15 @@ const CustomCheckbox = ({ label, name, onChange, value, ...rest }) => { }} /> {checked && ( - +
+ +
)} ); diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/DataManagerProvider/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/DataManagerProvider/index.js index c689c7920d..bd7e68f6ef 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/DataManagerProvider/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/DataManagerProvider/index.js @@ -175,7 +175,7 @@ const DataManagerProvider = ({ children }) => { return ; } - console.log({ components }); + console.log({ d: modifiedData }); return ( { let schema = yup.number(); - if (attributeType === 'integer' || attributeType === 'biginteger') { + if ( + attributeType === 'integer' || + attributeType === 'biginteger' || + attributeType === 'dynamiczone' + ) { schema = schema.integer(); } @@ -104,7 +108,11 @@ const forms = { min: yup.lazy(() => { let schema = yup.number(); - if (attributeType === 'integer' || attributeType === 'biginteger') { + if ( + attributeType === 'integer' || + attributeType === 'biginteger' || + attributeType === 'dynamiczone' + ) { schema = schema.integer(); } @@ -145,6 +153,11 @@ const forms = { }; switch (attributeType) { + case 'dynamiczone': + return yup.object().shape({ + ...commonShape, + ...numberTypeShape, + }); case 'enumeration': return yup.object().shape({ ...commonShape, @@ -240,7 +253,6 @@ const forms = { }, ], ]; - const defaultItems = [ [ { @@ -287,14 +299,36 @@ const forms = { }, ], ]; + const dynamiczoneItems = [ + [ + { + autoFocus: false, + name: 'max', + type: 'customCheckboxWithChildren', + label: { + id: getTrad(`form.attribute.item.maximum`), + }, + validations: {}, + }, + ], + [ + { + autoFocus: false, + name: 'min', + type: 'customCheckboxWithChildren', + label: { + id: getTrad(`form.attribute.item.minimum`), + }, + validations: {}, + }, + ], + ]; const items = defaultItems.slice(); if (type === 'media') { items.splice(0, 1); - } - - if (type === 'boolean') { + } else if (type === 'boolean') { items.splice(0, 1, [ { autoFocus: false, @@ -311,9 +345,7 @@ const forms = { validations: {}, }, ]); - } - - if (type === 'enumeration') { + } else if (type === 'enumeration') { items.splice(0, 1, [ { autoFocus: false, @@ -361,9 +393,7 @@ const forms = { }, }, ]); - } - - if (type === 'date') { + } else if (type === 'date') { items.splice(0, 1, [ { autoFocus: false, @@ -416,6 +446,12 @@ const forms = { ); } + if (type === 'dynamiczone') { + return { + items: dynamiczoneItems, + }; + } + if (type === 'relation') { return { items: relationItems,