strapi-plugin-navigation 1.0.4 → 2.0.0-beta.1
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 +1 -1
- 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 +19 -19
- package/admin/src/pluginId.js +4 -3
- 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 +13 -5
- package/{config/functions → server}/bootstrap.js +10 -11
- 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/server/content-types/navigation-item/lifecycle.js +34 -0
- package/{models/navigationItem.settings.json → server/content-types/navigation-item/schema.json} +29 -14
- package/server/content-types/navigations-items-related/index.js +9 -0
- package/server/content-types/navigations-items-related/lifecycle.js +19 -0
- package/server/content-types/navigations-items-related/schema.json +47 -0
- package/server/controllers/index.js +7 -0
- package/server/controllers/navigation.js +51 -0
- package/server/routes/admin.js +38 -0
- package/server/routes/index.js +3 -0
- package/server/services/__tests__/navigation.test.js +84 -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 -89
- 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/routes.json +0 -60
- package/config/schema.graphql.js +0 -205
- package/controllers/navigation.js +0 -85
- package/examples/audit-log-integrations.js.md +0 -38
- package/models/navigation.settings.json +0 -43
- package/models/navigationItem.js +0 -16
- package/public/assets/preview.png +0 -0
- package/services/__tests__/navigation.test.js +0 -85
- package/services/navigation.js +0 -638
- package/services/utils/functions.js +0 -186
|
@@ -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;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
-
import { Flex } from '@buffetjs/core';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
|
|
7
|
-
const Wrapper = styled(Flex)`
|
|
8
|
-
height: 100%;
|
|
9
|
-
width: 32px;
|
|
10
|
-
background: #fafafb;
|
|
11
|
-
> svg {
|
|
12
|
-
align-self: center;
|
|
13
|
-
font-size: 11px;
|
|
14
|
-
color: #b3b5b9;
|
|
15
|
-
}
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
|
-
const DropdownIndicator = ({ selectProps: { menuIsOpen } }) => {
|
|
19
|
-
const icon = menuIsOpen ? 'caret-up' : 'caret-down';
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<Wrapper>
|
|
23
|
-
<FontAwesomeIcon icon={icon} />
|
|
24
|
-
</Wrapper>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
DropdownIndicator.propTypes = {
|
|
29
|
-
selectProps: PropTypes.shape({
|
|
30
|
-
menuIsOpen: PropTypes.bool.isRequired,
|
|
31
|
-
}).isRequired,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
Wrapper.defaultProps = {
|
|
35
|
-
flexDirection: 'column',
|
|
36
|
-
justifyContent: 'center',
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export default DropdownIndicator;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { components } from 'react-select';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import StyledOption from './StyledOption';
|
|
5
|
-
|
|
6
|
-
const MultiValueContainer = ({ data, selectProps }) => {
|
|
7
|
-
const Component = components.MultiValueContainer;
|
|
8
|
-
|
|
9
|
-
const handleClick = () => {
|
|
10
|
-
const newValue = selectProps.value.filter(option => option.value !== data.value);
|
|
11
|
-
|
|
12
|
-
selectProps.onChange(newValue);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<Component {...data} {...selectProps}>
|
|
17
|
-
<StyledOption
|
|
18
|
-
label={data.label || data.name}
|
|
19
|
-
height="24px"
|
|
20
|
-
lineHeight="26px"
|
|
21
|
-
margin="2px 5px 0px 0"
|
|
22
|
-
onClick={handleClick}
|
|
23
|
-
/>
|
|
24
|
-
</Component>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
MultiValueContainer.defaultProps = {
|
|
29
|
-
data: {},
|
|
30
|
-
selectProps: {
|
|
31
|
-
value: [],
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
MultiValueContainer.propTypes = {
|
|
36
|
-
data: PropTypes.object,
|
|
37
|
-
selectProps: PropTypes.shape({
|
|
38
|
-
onChange: PropTypes.func.isRequired,
|
|
39
|
-
value: PropTypes.array,
|
|
40
|
-
}),
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export default MultiValueContainer;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import ReactSelect from 'react-select';
|
|
4
|
-
import { Padded } from '@buffetjs/core';
|
|
5
|
-
import styles from './utils/styles';
|
|
6
|
-
import ClearIndicator from './ClearIndicator';
|
|
7
|
-
import DropdownIndicator from './DropdownIndicator';
|
|
8
|
-
import ErrorMessage from './ErrorMessage';
|
|
9
|
-
import IndicatorSeparator from './IndicatorSeparator';
|
|
10
|
-
import MultiValueContainer from './MultiValueContainer';
|
|
11
|
-
import { useIntl } from 'react-intl';
|
|
12
|
-
|
|
13
|
-
const Select = ({ error, isDisabled, isMulti, isLoading, name, onChange, onInputChange, value, inputValue, defaultValue, options }) => {
|
|
14
|
-
const { formatMessage } = useIntl();
|
|
15
|
-
const translatedError = error && error.id ? formatMessage(error) : null;
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<>
|
|
19
|
-
<ReactSelect
|
|
20
|
-
components={{
|
|
21
|
-
ClearIndicator,
|
|
22
|
-
DropdownIndicator,
|
|
23
|
-
IndicatorSeparator,
|
|
24
|
-
MultiValueContainer,
|
|
25
|
-
}}
|
|
26
|
-
error={error}
|
|
27
|
-
getOptionLabel={option => option ? option.label : undefined}
|
|
28
|
-
getOptionValue={option => option ? option.value : undefined}
|
|
29
|
-
onChange={data => {
|
|
30
|
-
onChange({ target: { name, value: data } });
|
|
31
|
-
}}
|
|
32
|
-
onInputChange={onInputChange}
|
|
33
|
-
isClearable
|
|
34
|
-
isDisabled={isDisabled}
|
|
35
|
-
isLoading={isLoading}
|
|
36
|
-
isMulti={isMulti}
|
|
37
|
-
options={isLoading ? [] : options}
|
|
38
|
-
styles={styles}
|
|
39
|
-
defaultValue={defaultValue}
|
|
40
|
-
inputValue={inputValue}
|
|
41
|
-
value={isLoading ? undefined : value}
|
|
42
|
-
/>
|
|
43
|
-
{error && (!value || value.length === 0) ? (
|
|
44
|
-
<ErrorMessage>{translatedError}</ErrorMessage>
|
|
45
|
-
) : (
|
|
46
|
-
<Padded top size="11px" />
|
|
47
|
-
)}
|
|
48
|
-
</>
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
Select.defaultProps = {
|
|
53
|
-
error: null,
|
|
54
|
-
isDisabled: false,
|
|
55
|
-
value: [],
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
Select.propTypes = {
|
|
59
|
-
error: PropTypes.shape({
|
|
60
|
-
id: PropTypes.string,
|
|
61
|
-
}),
|
|
62
|
-
isDisabled: PropTypes.bool,
|
|
63
|
-
name: PropTypes.string.isRequired,
|
|
64
|
-
onChange: PropTypes.func.isRequired,
|
|
65
|
-
value: PropTypes.array,
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export default Select;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/* eslint-disable indent */
|
|
2
|
-
/* eslint-disable no-nested-ternary */
|
|
3
|
-
|
|
4
|
-
const styles = {
|
|
5
|
-
control: (base, state) => {
|
|
6
|
-
const borderRadiusStyle = state.selectProps.menuIsOpen
|
|
7
|
-
? {
|
|
8
|
-
borderBottomLeftRadius: '0 !important',
|
|
9
|
-
borderBottomRightRadius: '0 !important',
|
|
10
|
-
}
|
|
11
|
-
: {};
|
|
12
|
-
|
|
13
|
-
const {
|
|
14
|
-
selectProps: { error, value },
|
|
15
|
-
} = state;
|
|
16
|
-
|
|
17
|
-
let border;
|
|
18
|
-
let borderBottom;
|
|
19
|
-
let backgroundColor;
|
|
20
|
-
|
|
21
|
-
if (state.isFocused) {
|
|
22
|
-
border = '1px solid #78caff !important';
|
|
23
|
-
} else if (error && (!value || value.length === 0)) {
|
|
24
|
-
border = '1px solid #f64d0a !important';
|
|
25
|
-
} else {
|
|
26
|
-
border = '1px solid #e3e9f3 !important';
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (state.menuIsOpen === true) {
|
|
30
|
-
borderBottom = '1px solid #e3e9f3 !important';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (state.isDisabled) {
|
|
34
|
-
backgroundColor = '#fafafb !important';
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
...base,
|
|
39
|
-
fontSize: 13,
|
|
40
|
-
minHeight: 34,
|
|
41
|
-
border,
|
|
42
|
-
outline: 0,
|
|
43
|
-
boxShadow: 0,
|
|
44
|
-
borderRadius: '2px !important',
|
|
45
|
-
...borderRadiusStyle,
|
|
46
|
-
borderBottom,
|
|
47
|
-
backgroundColor,
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
menu: base => {
|
|
51
|
-
return {
|
|
52
|
-
...base,
|
|
53
|
-
width: 'calc(100% - 0px)',
|
|
54
|
-
margin: '0',
|
|
55
|
-
paddingTop: 0,
|
|
56
|
-
borderRadius: '2px !important',
|
|
57
|
-
borderTopLeftRadius: '0 !important',
|
|
58
|
-
borderTopRightRadius: '0 !important',
|
|
59
|
-
border: '1px solid #78caff !important',
|
|
60
|
-
boxShadow: 0,
|
|
61
|
-
borderTop: '0 !important',
|
|
62
|
-
fontSize: '13px',
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
menuList: base => ({
|
|
66
|
-
...base,
|
|
67
|
-
maxHeight: '112px',
|
|
68
|
-
paddingTop: 2,
|
|
69
|
-
}),
|
|
70
|
-
option: (base, state) => {
|
|
71
|
-
return {
|
|
72
|
-
...base,
|
|
73
|
-
height: 36,
|
|
74
|
-
backgroundColor: state.isSelected ? '#fff' : base.backgroundColor,
|
|
75
|
-
color: state.isSelected ? '#007eff' : '#333740',
|
|
76
|
-
fontWeight: state.isSelected ? '600' : '400',
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
|
-
placeholder: base => ({
|
|
80
|
-
...base,
|
|
81
|
-
marginTop: 0,
|
|
82
|
-
marginLeft: 8,
|
|
83
|
-
color: '#aaa',
|
|
84
|
-
}),
|
|
85
|
-
valueContainer: base => ({
|
|
86
|
-
...base,
|
|
87
|
-
padding: '2px 4px 4px 4px',
|
|
88
|
-
lineHeight: '18px',
|
|
89
|
-
}),
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export default styles;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
import { sizes } from "strapi-helper-plugin";
|
|
4
|
-
|
|
5
|
-
const Wrapper = styled.div`
|
|
6
|
-
min-height: calc(100vh - ${sizes.header.height});
|
|
7
|
-
.centered {
|
|
8
|
-
position: fixed;
|
|
9
|
-
top: calc(50% - 13px);
|
|
10
|
-
right: calc(50% - 13px);
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
export default Wrapper;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* This component is the skeleton around the actual pages, and should only
|
|
4
|
-
* contain code that should be seen on all pages. (e.g. navigation bar)
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React, { Suspense, lazy } from "react";
|
|
9
|
-
import { Switch, Route } from "react-router-dom";
|
|
10
|
-
import { NotFound, LoadingIndicatorPage } from "strapi-helper-plugin";
|
|
11
|
-
import Wrapper from "./Wrapper";
|
|
12
|
-
// Utils
|
|
13
|
-
import pluginId from "../../pluginId";
|
|
14
|
-
import DataManagerProvider from "../DataManagerProvider";
|
|
15
|
-
// Containers
|
|
16
|
-
|
|
17
|
-
const View = lazy(() => import("../View"));
|
|
18
|
-
|
|
19
|
-
const App = () => {
|
|
20
|
-
return (
|
|
21
|
-
<Wrapper>
|
|
22
|
-
<DataManagerProvider>
|
|
23
|
-
<Suspense fallback={<LoadingIndicatorPage />}>
|
|
24
|
-
<Switch>
|
|
25
|
-
<Route path={`/plugins/${pluginId}`} component={View} exact />
|
|
26
|
-
<Route component={NotFound} />
|
|
27
|
-
</Switch>
|
|
28
|
-
</Suspense>
|
|
29
|
-
</DataManagerProvider>
|
|
30
|
-
</Wrapper>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default App;
|