mirror of
https://github.com/strapi/strapi.git
synced 2025-10-29 17:04:13 +00:00
Created utils for relations
This commit is contained in:
parent
789e67fe11
commit
4d1dd0d083
@ -14,7 +14,7 @@ const MultipleMenuList = ({
|
||||
}) => {
|
||||
const { componentsGroupedByCategory } = useDataManager();
|
||||
const Component = components.MenuList;
|
||||
console.log({ menu: value.value });
|
||||
|
||||
const allComponentsCategory = Object.keys(componentsGroupedByCategory).reduce(
|
||||
(acc, current) => {
|
||||
const categoryCompos = componentsGroupedByCategory[current].map(compo => {
|
||||
|
||||
@ -24,7 +24,7 @@ const Value = ({ children, ...props }) => {
|
||||
isMultiple,
|
||||
},
|
||||
} = props;
|
||||
console.log({ value });
|
||||
|
||||
const displayedCategory = isCreatingComponent ? componentCategory : category;
|
||||
const displayedName = isCreatingComponent ? componentName : name;
|
||||
const style = { color: '#333740' };
|
||||
|
||||
@ -2,6 +2,10 @@ import { fromJS } from 'immutable';
|
||||
import pluralize from 'pluralize';
|
||||
import makeUnique from '../../utils/makeUnique';
|
||||
import { createComponentUid } from './utils/createUid';
|
||||
import {
|
||||
shouldPluralizeName,
|
||||
shouldPluralizeTargetAttribute,
|
||||
} from './utils/relations';
|
||||
|
||||
const initialState = fromJS({
|
||||
formErrors: {},
|
||||
@ -11,11 +15,6 @@ const initialState = fromJS({
|
||||
isCreatingComponentWhileAddingAField: false,
|
||||
});
|
||||
|
||||
export const shouldPluralizeTargetAttribute = nature =>
|
||||
['manyToMany', 'manyToOne'].includes(nature) ? 2 : 1;
|
||||
export const shouldPluralizeName = nature =>
|
||||
['manyToMany', 'oneToMany', 'manyWay'].includes(nature) ? 2 : 1;
|
||||
|
||||
const reducer = (state, action) => {
|
||||
switch (action.type) {
|
||||
case 'ADD_COMPONENTS_TO_DYNAMIC_ZONE': {
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
const shouldPluralizeName = nature =>
|
||||
['manyToMany', 'oneToMany', 'manyWay'].includes(nature) ? 2 : 1;
|
||||
|
||||
const shouldPluralizeTargetAttribute = nature =>
|
||||
['manyToMany', 'manyToOne'].includes(nature) ? 2 : 1;
|
||||
|
||||
export { shouldPluralizeName, shouldPluralizeTargetAttribute };
|
||||
Loading…
x
Reference in New Issue
Block a user