strapi-plugin-navigation 1.1.0 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/admin/src/components/EmptyView/index.js +7 -16
- package/admin/src/components/Item/ItemCardBadge/index.js +8 -0
- package/admin/src/components/Item/ItemCardHeader/Wrapper.js +21 -0
- package/admin/src/components/Item/ItemCardHeader/index.js +59 -0
- package/admin/src/components/Item/Wrapper.js +39 -0
- package/admin/src/components/Item/index.js +76 -124
- package/admin/src/components/NavigationItemList/Wrapper.js +22 -0
- package/admin/src/components/NavigationItemList/index.js +54 -0
- package/admin/src/components/PluginIcon/index.js +6 -0
- package/admin/src/index.js +49 -45
- package/admin/src/pages/App/index.js +31 -0
- package/admin/src/{containers → pages}/DataManagerProvider/actions.js +0 -0
- package/admin/src/{containers → pages}/DataManagerProvider/index.js +81 -85
- package/admin/src/{containers → pages}/DataManagerProvider/init.js +0 -0
- package/admin/src/{containers → pages}/DataManagerProvider/reducer.js +0 -0
- package/admin/src/pages/View/components/NavigationContentHeader/index.js +18 -0
- package/admin/src/pages/View/components/NavigationHeader/index.js +60 -0
- package/admin/src/pages/View/components/NavigationItemForm/index.js +403 -0
- package/admin/src/{containers → pages}/View/components/NavigationItemForm/utils/form.js +2 -2
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupFooter.js +40 -0
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupHeader.js +20 -0
- package/admin/src/{containers → pages}/View/components/NavigationItemPopup/index.js +16 -16
- package/admin/src/pages/View/index.js +209 -0
- package/admin/src/{containers → pages}/View/utils/enums.js +0 -0
- package/admin/src/{containers → pages}/View/utils/form.js +1 -1
- package/admin/src/{containers → pages}/View/utils/index.js +0 -0
- package/admin/src/{containers → pages}/View/utils/parsers.js +13 -12
- package/admin/src/pluginId.js +3 -2
- package/admin/src/translations/en.json +47 -38
- package/admin/src/translations/fr.json +7 -1
- package/admin/src/utils/getTrad.js +2 -2
- package/package.json +14 -6
- package/server/bootstrap.js +41 -0
- package/server/config.js +8 -0
- package/server/content-types/audience/index.js +9 -0
- package/{models/audience.js → server/content-types/audience/lifecycle.js} +0 -0
- package/{models/audience.settings.json → server/content-types/audience/schema.json} +4 -2
- package/server/content-types/index.js +13 -0
- package/server/content-types/navigation/index.js +9 -0
- package/{models/navigation.js → server/content-types/navigation/lifecycle.js} +0 -0
- package/server/content-types/navigation/schema.js +45 -0
- package/server/content-types/navigation-item/index.js +9 -0
- package/{models/navigationItem.js → server/content-types/navigation-item/lifecycle.js} +0 -0
- package/{models/navigationItem.settings.json → server/content-types/navigation-item/schema.json} +16 -12
- package/server/content-types/navigations-items-related/index.js +9 -0
- package/{models/navigations_items_related.js → server/content-types/navigations-items-related/lifecycle.js} +0 -0
- package/{models/navigations_items_related.settings.json → server/content-types/navigations-items-related/schema.json} +4 -2
- package/server/controllers/index.js +7 -0
- package/{controllers → server/controllers}/navigation.js +7 -39
- package/server/routes/admin.js +38 -0
- package/server/routes/index.js +3 -0
- package/{services → server/services}/__tests__/navigation.test.js +0 -0
- package/server/services/index.js +7 -0
- package/server/services/navigation.js +463 -0
- package/{services → server/services}/utils/constant.js +3 -1
- package/server/services/utils/functions.js +103 -0
- package/strapi-admin.js +1 -0
- package/strapi-server.js +18 -0
- package/__mocks__/helpers/another-plugin/blog-post.settings.json +0 -31
- package/__mocks__/helpers/another-plugin/pages.settings.json +0 -28
- package/__mocks__/helpers/blog-post.settings.json +0 -31
- package/__mocks__/helpers/home-page.settings.json +0 -4
- package/__mocks__/helpers/my-homepage.settings.json +0 -27
- package/__mocks__/helpers/pages.settings.json +0 -27
- package/__mocks__/helpers/strapi.js +0 -101
- package/admin/src/assets/images/icon-cross-blue.svg +0 -1
- package/admin/src/assets/images/icon_remove.svg +0 -19
- package/admin/src/components/Container/index.js +0 -7
- package/admin/src/components/Input/index.js +0 -41
- package/admin/src/components/Item/CardItem.js +0 -46
- package/admin/src/components/Item/CardItemLevelAdd.js +0 -41
- package/admin/src/components/Item/CardItemLevelWrapper.js +0 -27
- package/admin/src/components/Item/CardItemPath.js +0 -9
- package/admin/src/components/Item/CardItemRestore.js +0 -19
- package/admin/src/components/Item/CardItemTitle.js +0 -5
- package/admin/src/components/Item/CardWrapper.js +0 -78
- package/admin/src/components/ItemFooter/CardItemError.js +0 -11
- package/admin/src/components/ItemFooter/CardItemRelation.js +0 -18
- package/admin/src/components/ItemFooter/CardItemRelationStatus.js +0 -17
- package/admin/src/components/ItemFooter/CardItemType.js +0 -18
- package/admin/src/components/ItemFooter/Wrapper.js +0 -26
- package/admin/src/components/ItemFooter/index.js +0 -66
- package/admin/src/components/ItemOrdering/CardOrderingButton.js +0 -24
- package/admin/src/components/ItemOrdering/Wrapper.js +0 -24
- package/admin/src/components/ItemOrdering/index.js +0 -36
- package/admin/src/components/List/Container.js +0 -34
- package/admin/src/components/List/ListLevelRoot.js +0 -18
- package/admin/src/components/List/index.js +0 -81
- package/admin/src/components/Option/OptionButton.js +0 -18
- package/admin/src/components/Option/OptionSet.js +0 -14
- package/admin/src/components/Option/Wrapper.js +0 -15
- package/admin/src/components/Option/index.js +0 -47
- package/admin/src/components/Search/index.js +0 -86
- package/admin/src/components/Select/ClearIndicator.js +0 -15
- package/admin/src/components/Select/DropdownIndicator.js +0 -39
- package/admin/src/components/Select/ErrorMessage.js +0 -10
- package/admin/src/components/Select/IndicatorSeparator.js +0 -3
- package/admin/src/components/Select/MultiValueContainer.js +0 -43
- package/admin/src/components/Select/StyledOption.js +0 -11
- package/admin/src/components/Select/index.js +0 -68
- package/admin/src/components/Select/utils/styles.js +0 -92
- package/admin/src/containers/App/Wrapper.js +0 -14
- package/admin/src/containers/App/index.js +0 -34
- package/admin/src/containers/DetailsView/Wrapper.js +0 -21
- package/admin/src/containers/DetailsView/index.js +0 -111
- package/admin/src/containers/Initializer/index.js +0 -26
- package/admin/src/containers/ListView/Footer.js +0 -56
- package/admin/src/containers/ListView/components.js +0 -138
- package/admin/src/containers/ListView/index.js +0 -54
- package/admin/src/containers/View/FadedWrapper.js +0 -51
- package/admin/src/containers/View/HeaderForm.js +0 -9
- package/admin/src/containers/View/HeaderFormCell.js +0 -25
- package/admin/src/containers/View/Wrapper.js +0 -17
- package/admin/src/containers/View/components/NavigationItemForm/ModalFooter.js +0 -45
- package/admin/src/containers/View/components/NavigationItemForm/index.js +0 -427
- package/admin/src/containers/View/components/NavigationItemPopup/MediumPopup.js +0 -6
- package/admin/src/containers/View/index.js +0 -240
- package/admin/src/lifecycles.js +0 -3
- package/admin/src/permissions.js +0 -14
- package/config/functions/bootstrap.js +0 -138
- package/config/routes.json +0 -60
- package/config/schema.graphql.js +0 -205
- package/examples/audit-log-integrations.js.md +0 -38
- package/models/navigation.settings.json +0 -43
- package/public/assets/preview.png +0 -0
- package/services/navigation.js +0 -730
- package/services/utils/functions.js +0 -186
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
|
|
3
|
-
import { colors } from 'strapi-helper-plugin';
|
|
4
|
-
import CardItem from './CardItem';
|
|
5
|
-
|
|
6
|
-
const backgroundColor = ({ error, theme }) => {
|
|
7
|
-
if (error) {
|
|
8
|
-
return theme.main.colors.red;
|
|
9
|
-
}
|
|
10
|
-
return colors.relations.boxShadow;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const CardWrapper = styled.li`
|
|
14
|
-
padding: 0;
|
|
15
|
-
margin: 0;
|
|
16
|
-
|
|
17
|
-
position: relative;
|
|
18
|
-
z-index: 1;
|
|
19
|
-
|
|
20
|
-
${CardItem} {
|
|
21
|
-
&:before {
|
|
22
|
-
display: block;
|
|
23
|
-
content: "";
|
|
24
|
-
margin-top: -1px;
|
|
25
|
-
|
|
26
|
-
height: 2px;
|
|
27
|
-
width: 2.5rem;
|
|
28
|
-
|
|
29
|
-
position: absolute;
|
|
30
|
-
top: 50%;
|
|
31
|
-
left: -2rem;
|
|
32
|
-
z-index: -1;
|
|
33
|
-
|
|
34
|
-
background-color: ${backgroundColor};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
&:last-child {
|
|
39
|
-
&:before {
|
|
40
|
-
display: ${(props) => (props.level < 2 ? 'none' : 'block')};
|
|
41
|
-
content: "";
|
|
42
|
-
width: 6px;
|
|
43
|
-
height: 6px;
|
|
44
|
-
margin-left: -3px;
|
|
45
|
-
|
|
46
|
-
position: absolute;
|
|
47
|
-
bottom: -2.5rem;
|
|
48
|
-
left: -2rem;
|
|
49
|
-
z-index: -1;
|
|
50
|
-
|
|
51
|
-
border-radius: 3px;
|
|
52
|
-
|
|
53
|
-
background-color: ${colors.relations.boxShadow};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
${CardItem} {
|
|
57
|
-
margin-bottom: 20px;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
&:after {
|
|
62
|
-
display: block;
|
|
63
|
-
content: "";
|
|
64
|
-
margin-left: -1px;
|
|
65
|
-
|
|
66
|
-
width: 2px;
|
|
67
|
-
|
|
68
|
-
position: absolute;
|
|
69
|
-
top: -2rem;
|
|
70
|
-
bottom: -2.5rem;
|
|
71
|
-
left: -2rem;
|
|
72
|
-
z-index: -1;
|
|
73
|
-
|
|
74
|
-
background-color: ${colors.relations.boxShadow};
|
|
75
|
-
}
|
|
76
|
-
`;
|
|
77
|
-
|
|
78
|
-
export default CardWrapper;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
import { sizes } from "strapi-helper-plugin";
|
|
4
|
-
import CardItemRelation from "./CardItemRelation";
|
|
5
|
-
|
|
6
|
-
const CardItemError = styled(CardItemRelation)`
|
|
7
|
-
color: red;
|
|
8
|
-
font-weight: bold;
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
export default CardItemError;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
import { sizes } from "strapi-helper-plugin";
|
|
4
|
-
|
|
5
|
-
const CardItemRelation = styled.span`
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-grow: 1;
|
|
8
|
-
flex-direction: row;
|
|
9
|
-
|
|
10
|
-
align-items: center;
|
|
11
|
-
justify-content: flex-end;
|
|
12
|
-
|
|
13
|
-
svg {
|
|
14
|
-
margin-right: ${sizes.margin / 2}px;
|
|
15
|
-
}
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
|
-
export default CardItemRelation;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
import { colors, sizes } from "strapi-helper-plugin";
|
|
4
|
-
|
|
5
|
-
const CardItemRelationStatus = styled.small`
|
|
6
|
-
display: inline-block;
|
|
7
|
-
padding: ${`${sizes.margin * .1}px ${sizes.margin * .5}px`};
|
|
8
|
-
margin-left: ${`${sizes.margin / 2}px`};
|
|
9
|
-
|
|
10
|
-
color: #ffffff;
|
|
11
|
-
font-weight: bold;
|
|
12
|
-
|
|
13
|
-
background: orange;
|
|
14
|
-
border-radius: ${`${sizes.margin * .3}px`};
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
export default CardItemRelationStatus;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
import { sizes } from "strapi-helper-plugin";
|
|
4
|
-
|
|
5
|
-
const CardItemType = styled.span`
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-grow: 1;
|
|
8
|
-
flex-direction: row;
|
|
9
|
-
|
|
10
|
-
align-items: center;
|
|
11
|
-
justify-content: flex-start;
|
|
12
|
-
|
|
13
|
-
svg {
|
|
14
|
-
margin-right: ${sizes.margin / 2}px;
|
|
15
|
-
}
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
|
-
export default CardItemType;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
import { colors } from "strapi-helper-plugin";
|
|
4
|
-
|
|
5
|
-
const Wrapper = styled.div`
|
|
6
|
-
display: flex;
|
|
7
|
-
padding-top: 1rem;
|
|
8
|
-
margin-top: 1rem;
|
|
9
|
-
margin-bottom: ${ props => props.attachButtons ? 1 : 0 }rem;
|
|
10
|
-
|
|
11
|
-
flex-wrap: wrap;
|
|
12
|
-
justify-items: center;
|
|
13
|
-
align-items: stretch;
|
|
14
|
-
|
|
15
|
-
color: ${colors.leftMenu.darkGrey};
|
|
16
|
-
font-size: 1.25rem;
|
|
17
|
-
|
|
18
|
-
border-top: 1px ${colors.leftMenu.lightGrey} solid;
|
|
19
|
-
|
|
20
|
-
${ props => props.removed && `
|
|
21
|
-
filter: blur(.25rem);
|
|
22
|
-
-webkit-filter: blur(.25rem);
|
|
23
|
-
`}
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
export default Wrapper;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
|
-
import { faLink, faGlobe, faSitemap, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
|
|
6
|
-
import CardItemRelation from './CardItemRelation';
|
|
7
|
-
import CardItemType from './CardItemType';
|
|
8
|
-
import Wrapper from './Wrapper';
|
|
9
|
-
import { isNil, get, find, upperFirst } from 'lodash';
|
|
10
|
-
import { navigationItemType } from '../../containers/View/utils/enums';
|
|
11
|
-
import { isRelationCorrect, isRelationPublished } from '../../containers/View/utils/parsers';
|
|
12
|
-
import CardItemError from './CardItemError';
|
|
13
|
-
import CardItemRelationStatus from './CardItemRelationStatus';
|
|
14
|
-
import { getTrad } from '../../translations';
|
|
15
|
-
|
|
16
|
-
const ItemFooter = ({ type, removed, relatedRef, relatedType, attachButtons, contentTypes, formatRelationName }) => {
|
|
17
|
-
const { formatMessage } = useIntl();
|
|
18
|
-
|
|
19
|
-
const isRelationDefined = !isNil(relatedRef);
|
|
20
|
-
|
|
21
|
-
const formatRelationType = () =>
|
|
22
|
-
isRelationDefined ? get(relatedRef, 'labelSingular', get(relatedRef, '__contentType')) : '';
|
|
23
|
-
|
|
24
|
-
const isSingle = get(relatedRef, 'isSingle', false);
|
|
25
|
-
const isExternal = type === navigationItemType.EXTERNAL;
|
|
26
|
-
const relatedContentType = isRelationDefined && isSingle ? find(contentTypes, cnt => cnt.uid === relatedType) : undefined;
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<Wrapper removed={removed} attachButtons={attachButtons}>
|
|
30
|
-
<CardItemType>
|
|
31
|
-
<FontAwesomeIcon
|
|
32
|
-
icon={type === navigationItemType.EXTERNAL ? faGlobe : faSitemap}
|
|
33
|
-
/>{' '}
|
|
34
|
-
{upperFirst(type.toLowerCase())}
|
|
35
|
-
</CardItemType>
|
|
36
|
-
{isRelationCorrect({ type, related: relatedRef }) && !isExternal && (
|
|
37
|
-
<CardItemRelation title={formatRelationName()}>
|
|
38
|
-
<FontAwesomeIcon icon={faLink} />{' '}
|
|
39
|
-
{isSingle ? formatRelationType() : `(${formatRelationType()}) ${formatRelationName()}`}
|
|
40
|
-
{ !isRelationPublished({ relatedRef, relatedType: relatedContentType, type, isCollection: !isNil(relatedContentType) }) && (
|
|
41
|
-
<CardItemRelationStatus>
|
|
42
|
-
{ `${formatMessage(getTrad('notification.navigation.item.relation.status.draft'))}` }
|
|
43
|
-
</CardItemRelationStatus>
|
|
44
|
-
) }
|
|
45
|
-
</CardItemRelation>
|
|
46
|
-
)}
|
|
47
|
-
{ !isRelationCorrect({ type, related: relatedRef }) && (
|
|
48
|
-
<CardItemError title={formatRelationName()}>
|
|
49
|
-
<FontAwesomeIcon icon={faExclamationTriangle} />{' '}
|
|
50
|
-
{ formatMessage(getTrad('notification.navigation.item.relation')) }
|
|
51
|
-
</CardItemError>
|
|
52
|
-
)}
|
|
53
|
-
</Wrapper>
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
ItemFooter.propTypes = {
|
|
58
|
-
type: PropTypes.string.isRequired,
|
|
59
|
-
contentTypesNameFields: PropTypes.object.isRequired,
|
|
60
|
-
menuAttached: PropTypes.bool,
|
|
61
|
-
removed: PropTypes.bool,
|
|
62
|
-
relatedRef: PropTypes.object,
|
|
63
|
-
attachButtons: PropTypes.bool,
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export default ItemFooter;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
import { Button } from "@buffetjs/core";
|
|
4
|
-
import { sizes } from "strapi-helper-plugin";
|
|
5
|
-
|
|
6
|
-
const CardOrderingButton = styled(Button)`
|
|
7
|
-
display: flex;
|
|
8
|
-
width: ${ props => props.size }px;
|
|
9
|
-
height: ${ props => props.size }px;
|
|
10
|
-
padding: 0;
|
|
11
|
-
margin-left: ${ sizes.margin / 2 }px;
|
|
12
|
-
align-items: center;
|
|
13
|
-
justify-content: center;
|
|
14
|
-
|
|
15
|
-
border-radius: ${ props => props.size / 2 }px;
|
|
16
|
-
|
|
17
|
-
background: #ffffff;
|
|
18
|
-
|
|
19
|
-
svg {
|
|
20
|
-
margin-right: 0;
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
export default CardOrderingButton;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
import CardOrderingButton from "./CardOrderingButton";
|
|
3
|
-
|
|
4
|
-
const Wrapper = styled.div`
|
|
5
|
-
display: flex;
|
|
6
|
-
|
|
7
|
-
flex-direction: row;
|
|
8
|
-
justify-content: center;
|
|
9
|
-
align-items: center;
|
|
10
|
-
|
|
11
|
-
position: absolute;
|
|
12
|
-
left: 0;
|
|
13
|
-
right: 0;
|
|
14
|
-
bottom: ${ props => -1 * (props.fixBy || 0) }px;
|
|
15
|
-
z-index: 1;
|
|
16
|
-
|
|
17
|
-
${ CardOrderingButton } {
|
|
18
|
-
&:first {
|
|
19
|
-
margin-left: 0;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
export default Wrapper;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
4
|
-
import { faArrowUp, faArrowDown } from "@fortawesome/free-solid-svg-icons";
|
|
5
|
-
import Wrapper from "./Wrapper";
|
|
6
|
-
import CardOrderingButton from "./CardOrderingButton";
|
|
7
|
-
import { sizes } from "strapi-helper-plugin";
|
|
8
|
-
|
|
9
|
-
const BUTTON_SIZE = 2.4 * sizes.margin;
|
|
10
|
-
|
|
11
|
-
const ItemOrdering = ({ isFirst, isLast, onChangeOrder }) => {
|
|
12
|
-
return (
|
|
13
|
-
<Wrapper fixBy={ BUTTON_SIZE / 2 }>
|
|
14
|
-
{ !isFirst && (<CardOrderingButton
|
|
15
|
-
size={BUTTON_SIZE}
|
|
16
|
-
color="secondary"
|
|
17
|
-
icon={<FontAwesomeIcon icon={faArrowUp} size="1x" />}
|
|
18
|
-
onClick={(e) => onChangeOrder(e, -1)}
|
|
19
|
-
/>) }
|
|
20
|
-
{ !isLast && (<CardOrderingButton
|
|
21
|
-
size={BUTTON_SIZE}
|
|
22
|
-
color="secondary"
|
|
23
|
-
icon={<FontAwesomeIcon icon={faArrowDown} size="1x" />}
|
|
24
|
-
onClick={(e) => onChangeOrder(e, 1)}
|
|
25
|
-
/>) }
|
|
26
|
-
</Wrapper>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
ItemOrdering.propTypes = {
|
|
31
|
-
isFirst: PropTypes.bool,
|
|
32
|
-
isLast: PropTypes.bool,
|
|
33
|
-
onChangeOrder: PropTypes.func.isRequired,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export default ItemOrdering;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { colors, sizes } from "strapi-helper-plugin";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
|
|
4
|
-
const Container = styled.ul`
|
|
5
|
-
display: flex;
|
|
6
|
-
padding: 0;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
flex-grow: 1;
|
|
9
|
-
margin: 0;
|
|
10
|
-
padding: ${ 2 * sizes.margin}px 0 ${ 4 * sizes.margin}px 0;
|
|
11
|
-
|
|
12
|
-
position: relative;
|
|
13
|
-
z-index: 0;
|
|
14
|
-
|
|
15
|
-
overflow-x: hidden;
|
|
16
|
-
overflow-y: auto;
|
|
17
|
-
|
|
18
|
-
list-style: none;
|
|
19
|
-
|
|
20
|
-
&:before {
|
|
21
|
-
display: block;
|
|
22
|
-
content: "";
|
|
23
|
-
width: 2px;
|
|
24
|
-
|
|
25
|
-
position: absolute;
|
|
26
|
-
top: 0;
|
|
27
|
-
bottom: 0;
|
|
28
|
-
left: calc(2rem - 1px);
|
|
29
|
-
|
|
30
|
-
background-color: ${colors.relations.boxShadow};
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
33
|
-
|
|
34
|
-
export default Container;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
import CardItemLevelAdd, { buttonRadius } from "../Item/CardItemLevelAdd";
|
|
4
|
-
|
|
5
|
-
const ListLevelRoot = styled.li`
|
|
6
|
-
position: relative;
|
|
7
|
-
|
|
8
|
-
${CardItemLevelAdd} {
|
|
9
|
-
margin-left: ${`calc(2rem - ${buttonRadius}px)`};
|
|
10
|
-
|
|
11
|
-
position: relative;
|
|
12
|
-
top: auto;
|
|
13
|
-
left: auto;
|
|
14
|
-
bottom: auto;
|
|
15
|
-
}
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
|
-
export default ListLevelRoot;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
4
|
-
import { faPlus } from "@fortawesome/free-solid-svg-icons";
|
|
5
|
-
import Item from "../Item";
|
|
6
|
-
import Container from "./Container";
|
|
7
|
-
import CardItemLevelAdd from "../Item/CardItemLevelAdd";
|
|
8
|
-
import ListLevelRoot from "./ListLevelRoot";
|
|
9
|
-
|
|
10
|
-
const List = ({
|
|
11
|
-
root,
|
|
12
|
-
items,
|
|
13
|
-
onItemClick,
|
|
14
|
-
onItemReOrder,
|
|
15
|
-
onItemRestoreClick,
|
|
16
|
-
onItemLevelAddClick,
|
|
17
|
-
as,
|
|
18
|
-
level = 0,
|
|
19
|
-
levelPath = '',
|
|
20
|
-
allowedLevels,
|
|
21
|
-
isParentAttachedToMenu = false,
|
|
22
|
-
contentTypes,
|
|
23
|
-
contentTypesNameFields,
|
|
24
|
-
error,
|
|
25
|
-
}) => {
|
|
26
|
-
const Component = as || Container;
|
|
27
|
-
return (
|
|
28
|
-
<Component>
|
|
29
|
-
{items.map((item, n) => {
|
|
30
|
-
const { relatedRef, ...itemProps } = item
|
|
31
|
-
return (
|
|
32
|
-
<Item
|
|
33
|
-
key={`list-item-${item.viewId || n}`}
|
|
34
|
-
item={itemProps}
|
|
35
|
-
relatedRef={relatedRef}
|
|
36
|
-
level={level}
|
|
37
|
-
levelPath={levelPath}
|
|
38
|
-
isFirst={n === 0}
|
|
39
|
-
isLast={n === items.length - 1}
|
|
40
|
-
isParentAttachedToMenu={isParentAttachedToMenu}
|
|
41
|
-
allowedLevels={allowedLevels}
|
|
42
|
-
contentTypesNameFields={contentTypesNameFields}
|
|
43
|
-
onItemClick={onItemClick}
|
|
44
|
-
onItemReOrder={onItemReOrder}
|
|
45
|
-
onItemRestoreClick={onItemRestoreClick}
|
|
46
|
-
onItemLevelAddClick={onItemLevelAddClick}
|
|
47
|
-
contentTypes={contentTypes}
|
|
48
|
-
error={error}
|
|
49
|
-
/>
|
|
50
|
-
);
|
|
51
|
-
})}
|
|
52
|
-
{root && (
|
|
53
|
-
<ListLevelRoot>
|
|
54
|
-
<CardItemLevelAdd
|
|
55
|
-
root
|
|
56
|
-
menuLevel
|
|
57
|
-
color="primary"
|
|
58
|
-
icon={<FontAwesomeIcon icon={faPlus} />}
|
|
59
|
-
onClick={e => onItemLevelAddClick(e, null, true, levelPath, true)}
|
|
60
|
-
/>
|
|
61
|
-
</ListLevelRoot>
|
|
62
|
-
)}
|
|
63
|
-
</Component>
|
|
64
|
-
);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
List.propTypes = {
|
|
68
|
-
root: PropTypes.bool,
|
|
69
|
-
items: PropTypes.array,
|
|
70
|
-
level: PropTypes.number,
|
|
71
|
-
allowedLevels: PropTypes.number,
|
|
72
|
-
isParentAttachedToMenu: PropTypes.bool,
|
|
73
|
-
contentTypes: PropTypes.array,
|
|
74
|
-
contentTypesNameFields: PropTypes.object.isRequired,
|
|
75
|
-
onItemClick: PropTypes.func.isRequired,
|
|
76
|
-
onItemReOrder: PropTypes.func.isRequired,
|
|
77
|
-
onItemRestoreClick: PropTypes.func.isRequired,
|
|
78
|
-
onItemLevelAddClick: PropTypes.func.isRequired,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export default List;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
const OptionButton = styled.button`
|
|
4
|
-
display: flex;
|
|
5
|
-
justify-items: center;
|
|
6
|
-
height: 13px;
|
|
7
|
-
padding-left: 10px;
|
|
8
|
-
padding-right: 10px;
|
|
9
|
-
margin-left: 10px;
|
|
10
|
-
background-color: transparent;
|
|
11
|
-
border: 0;
|
|
12
|
-
border-left: 1px solid rgba(0, 126, 255, 0.1);
|
|
13
|
-
&:focus {
|
|
14
|
-
outline: 0;
|
|
15
|
-
}
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
|
-
export default OptionButton;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
import { Option } from "@buffetjs/styles";
|
|
4
|
-
import { sizes } from "strapi-helper-plugin";
|
|
5
|
-
|
|
6
|
-
const Wrapper = styled(Option)`
|
|
7
|
-
display: inline-flex;
|
|
8
|
-
margin: 0 0 ${sizes.margin / 2}px ${sizes.margin / 2}px;
|
|
9
|
-
|
|
10
|
-
&:first-child {
|
|
11
|
-
margin-left: 0;
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
export default Wrapper;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import { Plus, Remove } from "@buffetjs/icons";
|
|
4
|
-
import { upperFirst } from "lodash";
|
|
5
|
-
import OptionButton from "./OptionButton";
|
|
6
|
-
import Wrapper from "./Wrapper";
|
|
7
|
-
|
|
8
|
-
function Option({ label, icon = Option.icons.REMOVE, onClick, ...rest }) {
|
|
9
|
-
const content =
|
|
10
|
-
typeof label === "string" ? <span>{upperFirst(label)}</span> : label;
|
|
11
|
-
|
|
12
|
-
let OptionIcon = Remove;
|
|
13
|
-
switch (icon) {
|
|
14
|
-
case Option.icons.PLUS:
|
|
15
|
-
OptionIcon = Plus;
|
|
16
|
-
break;
|
|
17
|
-
default:
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<Wrapper {...rest}>
|
|
23
|
-
{content}
|
|
24
|
-
<OptionButton type="button" onClick={onClick}>
|
|
25
|
-
<OptionIcon width="11px" height="11px" fill="#007eff" />
|
|
26
|
-
</OptionButton>
|
|
27
|
-
</Wrapper>
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
Option.icons = {
|
|
32
|
-
PLUS: "plus",
|
|
33
|
-
REMOVE: "remove",
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
Option.defaultProps = {
|
|
37
|
-
label: "",
|
|
38
|
-
onClick: () => {},
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
Option.propTypes = {
|
|
42
|
-
label: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
|
43
|
-
icon: PropTypes.oneOf([Option.icons.PLUS, Option.icons.REMOVE]),
|
|
44
|
-
onClick: PropTypes.func,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export default Option;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* Search
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { memo } from "react";
|
|
8
|
-
import { isEmpty, upperFirst } from "lodash";
|
|
9
|
-
import PropTypes from "prop-types";
|
|
10
|
-
import { FormattedMessage } from "react-intl";
|
|
11
|
-
import { HeaderSearch } from "strapi-helper-plugin";
|
|
12
|
-
import getTrad from "../../utils/getTrad";
|
|
13
|
-
|
|
14
|
-
const WAIT = 400;
|
|
15
|
-
|
|
16
|
-
class Search extends React.Component {
|
|
17
|
-
state = { value: this.props.initValue };
|
|
18
|
-
|
|
19
|
-
timer = null;
|
|
20
|
-
|
|
21
|
-
componentDidUpdate(prevProps) {
|
|
22
|
-
const { model, value } = this.props;
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
prevProps.model !== model ||
|
|
26
|
-
(!isEmpty(prevProps.value) && isEmpty(value))
|
|
27
|
-
) {
|
|
28
|
-
this.resetState();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
resetState = () => this.setState({ value: "" });
|
|
33
|
-
|
|
34
|
-
handleChange = ({ target }) => {
|
|
35
|
-
clearTimeout(this.timer);
|
|
36
|
-
this.setState({ value: target.value });
|
|
37
|
-
this.timer = setTimeout(() => this.triggerChange(target.value), WAIT);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
handleClick = () => {
|
|
41
|
-
this.setState({ value: "" });
|
|
42
|
-
this.triggerChange("");
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
triggerChange = (value) =>
|
|
46
|
-
this.props.changeParams({
|
|
47
|
-
target: {
|
|
48
|
-
name: "_q",
|
|
49
|
-
value,
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
render() {
|
|
54
|
-
const { model } = this.props;
|
|
55
|
-
const { value } = this.state;
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<FormattedMessage id={getTrad("components.Search.placeholder")}>
|
|
59
|
-
{(placeholder) => (
|
|
60
|
-
<HeaderSearch
|
|
61
|
-
label={upperFirst(model)}
|
|
62
|
-
onChange={this.handleChange}
|
|
63
|
-
onClear={this.handleClick}
|
|
64
|
-
placeholder={placeholder}
|
|
65
|
-
value={value}
|
|
66
|
-
/>
|
|
67
|
-
)}
|
|
68
|
-
</FormattedMessage>
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
Search.defaultProps = {
|
|
74
|
-
changeParams: () => {},
|
|
75
|
-
model: "",
|
|
76
|
-
value: "",
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
Search.propTypes = {
|
|
80
|
-
changeParams: PropTypes.func,
|
|
81
|
-
initValue: PropTypes.string.isRequired,
|
|
82
|
-
model: PropTypes.string,
|
|
83
|
-
value: PropTypes.string,
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export default memo(Search);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Remove } from '@buffetjs/icons';
|
|
3
|
-
import { components } from 'react-select';
|
|
4
|
-
|
|
5
|
-
const ClearIndicator = props => {
|
|
6
|
-
const Component = components.ClearIndicator;
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<Component {...props}>
|
|
10
|
-
<Remove width="11px" height="11px" fill="#9EA7B8" />
|
|
11
|
-
</Component>
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default ClearIndicator;
|