@akemona-org/strapi-plugin-content-manager 3.7.0 → 3.7.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/admin/src/InjectedComponents/ContentTypeBuilder/ConfigureViewButton/index.js +2 -5
- package/admin/src/components/AddDropdown/index.js +5 -12
- package/admin/src/components/Block/index.js +2 -4
- package/admin/src/components/ComponentInitializer/index.js +1 -1
- package/admin/src/components/CustomTable/ActionCollapse/index.js +2 -2
- package/admin/src/components/CustomTable/Row/Cell.js +1 -1
- package/admin/src/components/CustomTable/Row/index.js +6 -6
- package/admin/src/components/CustomTable/index.js +5 -5
- package/admin/src/components/CustomTable/styledComponents.js +2 -2
- package/admin/src/components/DragLayer/index.js +1 -1
- package/admin/src/components/DraggedField/Wrapper.js +2 -7
- package/admin/src/components/DraggedField/index.js +3 -3
- package/admin/src/components/DraggedField/utils/getHeight.js +1 -1
- package/admin/src/components/DraggedFieldWithPreview/DynamicComponent.js +2 -2
- package/admin/src/components/DraggedFieldWithPreview/Wrapper.js +1 -2
- package/admin/src/components/DraggedFieldWithPreview/index.js +4 -4
- package/admin/src/components/DynamicComponentCard/index.js +2 -8
- package/admin/src/components/DynamicZone/Picker/index.js +3 -3
- package/admin/src/components/DynamicZone/index.js +4 -4
- package/admin/src/components/DynamicZone/utils/select.js +1 -1
- package/admin/src/components/FieldComponent/index.js +1 -1
- package/admin/src/components/FieldComponent/utils/select.js +6 -6
- package/admin/src/components/FieldsReorder/Item.js +6 -9
- package/admin/src/components/FieldsReorder/index.js +6 -17
- package/admin/src/components/FilterOptionsCTA/index.js +1 -1
- package/admin/src/components/FilterPicker/components.js +2 -2
- package/admin/src/components/FilterPicker/index.js +7 -7
- package/admin/src/components/FilterPicker/reducer.js +2 -2
- package/admin/src/components/FilterPickerOption/Input.js +1 -1
- package/admin/src/components/FilterPickerOption/Option.js +1 -3
- package/admin/src/components/FilterPickerOption/components.js +2 -2
- package/admin/src/components/FilterPickerOption/index.js +4 -4
- package/admin/src/components/FormTitle/index.js +1 -5
- package/admin/src/components/InputJSON/index.js +3 -3
- package/admin/src/components/InputJSON/jsonlint.js +639 -383
- package/admin/src/components/InputJSONWithErrors/index.js +2 -2
- package/admin/src/components/InputUID/Options/index.js +2 -2
- package/admin/src/components/InputUID/Options/wrapper.js +1 -1
- package/admin/src/components/InputUID/index.js +2 -2
- package/admin/src/components/Inputs/index.js +4 -4
- package/admin/src/components/Inputs/utils/generateOptions.js +2 -2
- package/admin/src/components/Inputs/utils/getStep.js +1 -1
- package/admin/src/components/MediaPreviewList/index.js +5 -5
- package/admin/src/components/NonRepeatableComponent/index.js +4 -4
- package/admin/src/components/PreviewWysiwyg/Wrapper.js +1 -1
- package/admin/src/components/PreviewWysiwyg/utils/satinizeHtml.js +1 -1
- package/admin/src/components/RelationPreviewList/RelationPreviewTooltip.js +3 -3
- package/admin/src/components/RelationPreviewList/index.js +1 -1
- package/admin/src/components/RepeatableComponent/Banner.js +2 -2
- package/admin/src/components/RepeatableComponent/BannerWrapper.js +1 -2
- package/admin/src/components/RepeatableComponent/DraggedItem/index.js +3 -9
- package/admin/src/components/RepeatableComponent/index.js +8 -8
- package/admin/src/components/RepeatableComponent/reducer.js +9 -9
- package/admin/src/components/Search/index.js +2 -2
- package/admin/src/components/SectionTitle/index.js +1 -3
- package/admin/src/components/SelectMany/ListItem.js +2 -2
- package/admin/src/components/SelectMany/index.js +3 -3
- package/admin/src/components/SelectOne/SingleValue.js +1 -1
- package/admin/src/components/SelectWrapper/ClearIndicator.js +1 -1
- package/admin/src/components/SelectWrapper/Option.js +1 -1
- package/admin/src/components/SelectWrapper/index.js +17 -27
- package/admin/src/components/SelectWrapper/utils/styles.js +6 -6
- package/admin/src/components/SettingsViewWrapper/index.js +9 -9
- package/admin/src/components/SortableList/Item.js +5 -11
- package/admin/src/components/Wysiwyg/MediaLib.js +1 -1
- package/admin/src/components/Wysiwyg/index.js +17 -25
- package/admin/src/components/Wysiwyg/toggleMode.js +3 -7
- package/admin/src/components/Wysiwyg/utils.js +2 -10
- package/admin/src/components/WysiwygDropUpload/index.js +1 -1
- package/admin/src/components/WysiwygInlineControls/Button.js +1 -1
- package/admin/src/components/WysiwygInlineControls/index.js +1 -1
- package/admin/src/components/WysiwygWithErrors/index.js +1 -1
- package/admin/src/containers/CollectionTypeFormWrapper/index.js +7 -12
- package/admin/src/containers/CollectionTypeFormWrapper/utils/getRequestUrl.js +1 -1
- package/admin/src/containers/CollectionTypeRecursivePath/index.js +1 -1
- package/admin/src/containers/ComponentSetttingsView/index.js +2 -2
- package/admin/src/containers/EditSettingsView/index.js +17 -17
- package/admin/src/containers/EditSettingsView/reducer.js +10 -10
- package/admin/src/containers/EditSettingsView/utils/createPossibleMainFieldsForModelsAndComponents.js +2 -2
- package/admin/src/containers/EditSettingsView/utils/getInputProps.js +1 -1
- package/admin/src/containers/EditSettingsView/utils/layout.js +9 -9
- package/admin/src/containers/EditView/DeleteLink/index.js +1 -1
- package/admin/src/containers/EditView/Header/index.js +10 -9
- package/admin/src/containers/EditView/Header/utils/getDraftRelations.js +3 -3
- package/admin/src/containers/EditView/index.js +7 -10
- package/admin/src/containers/EditView/utils/createAttributesLayout.js +4 -9
- package/admin/src/containers/EditView/utils/getFieldsActionMatchingPermissions.js +1 -1
- package/admin/src/containers/EditViewDataManagerProvider/index.js +7 -12
- package/admin/src/containers/EditViewDataManagerProvider/reducer.js +14 -14
- package/admin/src/containers/EditViewDataManagerProvider/utils/cleanData.js +4 -4
- package/admin/src/containers/EditViewDataManagerProvider/utils/getYupInnerErrors.js +2 -8
- package/admin/src/containers/EditViewDataManagerProvider/utils/schema.js +12 -12
- package/admin/src/containers/EditViewLayoutManager/Permissions.js +1 -1
- package/admin/src/containers/EditViewLayoutManager/reducer.js +1 -1
- package/admin/src/containers/EditViewLayoutManager/selectors.js +1 -1
- package/admin/src/containers/ListSettingsView/Label.js +2 -11
- package/admin/src/containers/ListSettingsView/index.js +9 -9
- package/admin/src/containers/ListSettingsView/reducer.js +2 -2
- package/admin/src/containers/ListView/FieldPicker/Fields/Wrapper.js +1 -1
- package/admin/src/containers/ListView/FieldPicker/Fields/index.js +2 -2
- package/admin/src/containers/ListView/FieldPicker/index.js +2 -2
- package/admin/src/containers/ListView/Filter.js +1 -4
- package/admin/src/containers/ListView/actions.js +2 -2
- package/admin/src/containers/ListView/index.js +8 -7
- package/admin/src/containers/ListView/reducer.js +5 -5
- package/admin/src/containers/ListView/selectors.js +2 -2
- package/admin/src/containers/ListView/utils/createPluginsFilter.js +1 -1
- package/admin/src/containers/ListView/utils/getAllAllowedHeaders.js +1 -1
- package/admin/src/containers/ListView/utils/getFirstSortableHeader.js +2 -2
- package/admin/src/containers/ListViewLayoutManager/Permissions.js +1 -1
- package/admin/src/containers/ListViewProvider/index.js +1 -3
- package/admin/src/containers/Main/index.js +2 -2
- package/admin/src/containers/Main/reducer.js +1 -1
- package/admin/src/containers/Main/selectors.js +2 -2
- package/admin/src/containers/RBACManager/reducer.js +1 -1
- package/admin/src/containers/SingleTypeFormWrapper/index.js +6 -11
- package/admin/src/containers/SingleTypeFormWrapper/utils/getRequestUrl.js +1 -1
- package/admin/src/containers/WysiwygProvider/index.js +1 -3
- package/admin/src/hooks/useContentTypeLayout/index.js +1 -1
- package/admin/src/hooks/useFetchContentTypeLayout/index.js +3 -3
- package/admin/src/hooks/useFetchContentTypeLayout/reducer.js +1 -1
- package/admin/src/hooks/useFetchContentTypeLayout/utils/formatLayouts.js +8 -8
- package/admin/src/hooks/useFindRedirectionLink/index.js +1 -1
- package/admin/src/hooks/useFindRedirectionLink/selectors.js +1 -1
- package/admin/src/icons/Cross/index.js +1 -6
- package/admin/src/icons/Na/index.js +3 -22
- package/admin/src/index.js +1 -1
- package/admin/src/pluginId.js +1 -1
- package/admin/src/selectors.js +2 -2
- package/admin/src/sharedReducers/crudReducer/actions.js +3 -3
- package/admin/src/sharedReducers/crudReducer/reducer.js +1 -1
- package/admin/src/sharedReducers/crudReducer/selectors.js +1 -1
- package/admin/src/utils/checkIfAttributeIsDisplayable.js +1 -1
- package/admin/src/utils/formatFiltersFromQuery.js +2 -2
- package/admin/src/utils/formatLayoutToApi.js +2 -2
- package/admin/src/utils/generatePermissionsObject.js +3 -2
- package/admin/src/utils/getComponents.js +3 -5
- package/admin/src/utils/getFieldName.js +2 -2
- package/admin/src/utils/getMaxTempKey.js +2 -2
- package/admin/src/utils/getRequestUrl.js +1 -1
- package/admin/src/utils/getTrad.js +1 -1
- package/admin/src/utils/mergeMetasWithSchema.js +2 -2
- package/admin/src/utils/removeKeyInObject.js +1 -1
- package/admin/src/utils/removePasswordFieldsFromData.js +2 -2
- package/controllers/content-types.js +4 -4
- package/package.json +4 -4
- package/services/components.js +1 -1
- package/services/configuration.js +9 -9
- package/services/permission-checker.js +6 -6
- package/services/uid.js +1 -1
- package/services/utils/configuration/layouts.js +14 -35
- package/services/utils/configuration/metadatas.js +1 -1
- package/services/utils/store.js +9 -9
- package/utils/index.js +1 -1
- package/utils/wrap-bad-request.js +14 -12
|
@@ -16,7 +16,7 @@ import InputJSON from '../InputJSON';
|
|
|
16
16
|
import Wrapper from './Wrapper';
|
|
17
17
|
|
|
18
18
|
class InputJSONWithErrors extends React.Component {
|
|
19
|
-
handleChange = e => {
|
|
19
|
+
handleChange = (e) => {
|
|
20
20
|
this.props.onChange(e);
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -67,7 +67,7 @@ class InputJSONWithErrors extends React.Component {
|
|
|
67
67
|
deactivateErrorHighlight={deactivateErrorHighlight}
|
|
68
68
|
name={name}
|
|
69
69
|
onBlur={isFunction(handleBlur) ? handleBlur : onBlur}
|
|
70
|
-
onChange={e => {
|
|
70
|
+
onChange={(e) => {
|
|
71
71
|
if (!canCheck) {
|
|
72
72
|
dispatch({
|
|
73
73
|
type: 'SET_CHECK',
|
|
@@ -11,11 +11,11 @@ import RightOptionLabel from './RightOptionLabel';
|
|
|
11
11
|
const Options = ({ options, title }) => (
|
|
12
12
|
<OptionsWrapper>
|
|
13
13
|
{title && <OptionsTitle>{title}</OptionsTitle>}
|
|
14
|
-
{options.map(option => (
|
|
14
|
+
{options.map((option) => (
|
|
15
15
|
<Option key={option.id} onClick={option.onClick}>
|
|
16
16
|
<div>{option.label}</div>
|
|
17
17
|
<FormattedMessage id={getTrad('components.uid.apply')}>
|
|
18
|
-
{msg => <RightOptionLabel className="right-label">{msg}</RightOptionLabel>}
|
|
18
|
+
{(msg) => <RightOptionLabel className="right-label">{msg}</RightOptionLabel>}
|
|
19
19
|
</FormattedMessage>
|
|
20
20
|
</Option>
|
|
21
21
|
))}
|
|
@@ -4,7 +4,7 @@ const wrapper = styled.div`
|
|
|
4
4
|
position: absolute;
|
|
5
5
|
width: 100%;
|
|
6
6
|
margin-top: 3px;
|
|
7
|
-
border: 1px solid ${props => props.theme.main.colors.border};
|
|
7
|
+
border: 1px solid ${(props) => props.theme.main.colors.border};
|
|
8
8
|
border-radius: 2px;
|
|
9
9
|
background-color: white;
|
|
10
10
|
z-index: 11;
|
|
@@ -237,7 +237,7 @@ const InputUID = ({
|
|
|
237
237
|
error={hasError}
|
|
238
238
|
onFocus={handleFocus}
|
|
239
239
|
name={name}
|
|
240
|
-
onChange={e => handleChange(e, canCheck, dispatch)}
|
|
240
|
+
onChange={(e) => handleChange(e, canCheck, dispatch)}
|
|
241
241
|
type="text"
|
|
242
242
|
onBlur={onBlur}
|
|
243
243
|
// eslint-disable-next-line no-irregular-whitespace
|
|
@@ -272,7 +272,7 @@ const InputUID = ({
|
|
|
272
272
|
</RightContent>
|
|
273
273
|
{availability && availability.suggestion && isSuggestionOpen && (
|
|
274
274
|
<FormattedMessage id={`${pluginId}.components.uid.suggested`}>
|
|
275
|
-
{msg => (
|
|
275
|
+
{(msg) => (
|
|
276
276
|
<Options
|
|
277
277
|
title={msg}
|
|
278
278
|
options={[
|
|
@@ -168,10 +168,10 @@ function Inputs({
|
|
|
168
168
|
return disabled;
|
|
169
169
|
}, [disabled, isCreatingEntry, isUserAllowedToEditField, isUserAllowedToReadField]);
|
|
170
170
|
|
|
171
|
-
const options = useMemo(
|
|
172
|
-
fieldSchema,
|
|
173
|
-
isRequired
|
|
174
|
-
|
|
171
|
+
const options = useMemo(
|
|
172
|
+
() => generateOptions(fieldSchema.enum || [], isRequired),
|
|
173
|
+
[fieldSchema, isRequired]
|
|
174
|
+
);
|
|
175
175
|
|
|
176
176
|
const otherFields = useMemo(() => {
|
|
177
177
|
return fieldApi.getFields();
|
|
@@ -3,13 +3,13 @@ import { FormattedMessage } from 'react-intl';
|
|
|
3
3
|
|
|
4
4
|
const generateOptions = (options, isRequired = false) => [
|
|
5
5
|
<FormattedMessage id="components.InputSelect.option.placeholder" key="__enum_option_null">
|
|
6
|
-
{msg => (
|
|
6
|
+
{(msg) => (
|
|
7
7
|
<option disabled={isRequired} hidden={isRequired} value="">
|
|
8
8
|
{msg}
|
|
9
9
|
</option>
|
|
10
10
|
)}
|
|
11
11
|
</FormattedMessage>,
|
|
12
|
-
...options.map(v => (
|
|
12
|
+
...options.map((v) => (
|
|
13
13
|
<option key={v} value={v}>
|
|
14
14
|
{v}
|
|
15
15
|
</option>
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
const IMAGE_PREVIEW_COUNT = 3;
|
|
15
15
|
|
|
16
16
|
function MediaPreviewList({ hoverable, files }) {
|
|
17
|
-
const renderImage = image => {
|
|
17
|
+
const renderImage = (image) => {
|
|
18
18
|
const { name, size, url } = image;
|
|
19
19
|
const thumbnail = get(image, ['formats', 'thumbnail', 'url'], null);
|
|
20
20
|
const fileUrl = thumbnail || url;
|
|
@@ -33,7 +33,7 @@ function MediaPreviewList({ hoverable, files }) {
|
|
|
33
33
|
);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
const renderFile = file => {
|
|
36
|
+
const renderFile = (file) => {
|
|
37
37
|
const { ext, name } = file;
|
|
38
38
|
const fileExtension = getFileExtension(ext);
|
|
39
39
|
|
|
@@ -54,7 +54,7 @@ function MediaPreviewList({ hoverable, files }) {
|
|
|
54
54
|
);
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
const renderItem = file => {
|
|
57
|
+
const renderItem = (file) => {
|
|
58
58
|
const { mime } = file;
|
|
59
59
|
|
|
60
60
|
return (
|
|
@@ -64,7 +64,7 @@ function MediaPreviewList({ hoverable, files }) {
|
|
|
64
64
|
);
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
const renderText = count => {
|
|
67
|
+
const renderText = (count) => {
|
|
68
68
|
return (
|
|
69
69
|
<MediaPreviewText>
|
|
70
70
|
<div>
|
|
@@ -74,7 +74,7 @@ function MediaPreviewList({ hoverable, files }) {
|
|
|
74
74
|
);
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
const renderMultipleItems = files => {
|
|
77
|
+
const renderMultipleItems = (files) => {
|
|
78
78
|
return files.map((file, index) => {
|
|
79
79
|
return (
|
|
80
80
|
<React.Fragment key={JSON.stringify(file)}>
|
|
@@ -10,10 +10,10 @@ import FieldComponent from '../FieldComponent';
|
|
|
10
10
|
|
|
11
11
|
const NonRepeatableComponent = ({ componentUid, isFromDynamicZone, name }) => {
|
|
12
12
|
const { getComponentLayout } = useContentTypeLayout();
|
|
13
|
-
const componentLayoutData = useMemo(
|
|
14
|
-
componentUid,
|
|
15
|
-
getComponentLayout
|
|
16
|
-
|
|
13
|
+
const componentLayoutData = useMemo(
|
|
14
|
+
() => getComponentLayout(componentUid),
|
|
15
|
+
[componentUid, getComponentLayout]
|
|
16
|
+
);
|
|
17
17
|
const fields = componentLayoutData.layouts.edit;
|
|
18
18
|
|
|
19
19
|
return (
|
|
@@ -107,7 +107,7 @@ const Wrapper = styled.div`
|
|
|
107
107
|
border-radius: 3px;
|
|
108
108
|
}
|
|
109
109
|
.tip {
|
|
110
|
-
background-color: ${props => props.theme.main.colors.darkBlue};
|
|
110
|
+
background-color: ${(props) => props.theme.main.colors.darkBlue};
|
|
111
111
|
padding: 30px;
|
|
112
112
|
border-radius: 3px;
|
|
113
113
|
}
|
|
@@ -18,7 +18,7 @@ const RelationPreviewTooltip = ({
|
|
|
18
18
|
const tooltipRef = useRef();
|
|
19
19
|
|
|
20
20
|
const fetchRelationData = useCallback(
|
|
21
|
-
async signal => {
|
|
21
|
+
async (signal) => {
|
|
22
22
|
const requestURL = getRequestUrl(`${endPoint}/${rowId}/${name}`);
|
|
23
23
|
try {
|
|
24
24
|
const { results } = await request(requestURL, {
|
|
@@ -51,7 +51,7 @@ const RelationPreviewTooltip = ({
|
|
|
51
51
|
}, [fetchRelationData]);
|
|
52
52
|
|
|
53
53
|
const getValueToDisplay = useCallback(
|
|
54
|
-
item => {
|
|
54
|
+
(item) => {
|
|
55
55
|
return getDisplayedValue(mainField.schema.type, item[mainField.name], mainField.name);
|
|
56
56
|
},
|
|
57
57
|
[mainField]
|
|
@@ -79,7 +79,7 @@ const RelationPreviewTooltip = ({
|
|
|
79
79
|
</Padded>
|
|
80
80
|
) : (
|
|
81
81
|
<>
|
|
82
|
-
{relationData.map(item => (
|
|
82
|
+
{relationData.map((item) => (
|
|
83
83
|
<Padded key={item.id} top bottom size="xs">
|
|
84
84
|
<Text ellipsis color="white">
|
|
85
85
|
{getValueToDisplay(item)}
|
|
@@ -49,7 +49,7 @@ const Banner = forwardRef(
|
|
|
49
49
|
</div>
|
|
50
50
|
|
|
51
51
|
<FormattedMessage id={`${pluginId}.containers.Edit.pluginHeader.title.new`}>
|
|
52
|
-
{msg => {
|
|
52
|
+
{(msg) => {
|
|
53
53
|
// The displayed value may be "falsey" when the main field is a number or boolean
|
|
54
54
|
return <div style={{ display }}>{displayedValue ?? msg}</div>;
|
|
55
55
|
}}
|
|
@@ -60,7 +60,7 @@ const Banner = forwardRef(
|
|
|
60
60
|
<div
|
|
61
61
|
className="trash-icon"
|
|
62
62
|
style={{ marginRight: 10, padding: '0 5px' }}
|
|
63
|
-
onClick={e => {
|
|
63
|
+
onClick={(e) => {
|
|
64
64
|
e.preventDefault();
|
|
65
65
|
e.stopPropagation();
|
|
66
66
|
onClickRemove();
|
|
@@ -105,7 +105,6 @@ const BannerWrapper = styled.button`
|
|
|
105
105
|
outline: 0;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
109
108
|
.img-wrapper {
|
|
110
109
|
width: 19px;
|
|
111
110
|
height: 19px;
|
|
@@ -136,7 +135,7 @@ const BannerWrapper = styled.button`
|
|
|
136
135
|
svg {
|
|
137
136
|
font-size: 10px;
|
|
138
137
|
path {
|
|
139
|
-
fill: #
|
|
138
|
+
fill: #4b515a;
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
141
|
}
|
|
@@ -60,14 +60,8 @@ const DraggedItem = ({
|
|
|
60
60
|
const dragPath = item.originalPath;
|
|
61
61
|
const hoverPath = componentFieldName;
|
|
62
62
|
const fullPathToComponentArray = dragPath.split('.');
|
|
63
|
-
const dragIndexString = fullPathToComponentArray
|
|
64
|
-
|
|
65
|
-
.splice(-1)
|
|
66
|
-
.join('');
|
|
67
|
-
const hoverIndexString = hoverPath
|
|
68
|
-
.split('.')
|
|
69
|
-
.splice(-1)
|
|
70
|
-
.join('');
|
|
63
|
+
const dragIndexString = fullPathToComponentArray.slice().splice(-1).join('');
|
|
64
|
+
const hoverIndexString = hoverPath.split('.').splice(-1).join('');
|
|
71
65
|
const pathToComponentArray = fullPathToComponentArray.slice(
|
|
72
66
|
0,
|
|
73
67
|
fullPathToComponentArray.length - 1
|
|
@@ -120,7 +114,7 @@ const DraggedItem = ({
|
|
|
120
114
|
// Update the errors
|
|
121
115
|
triggerFormValidation();
|
|
122
116
|
},
|
|
123
|
-
collect: monitor => ({
|
|
117
|
+
collect: (monitor) => ({
|
|
124
118
|
isDragging: monitor.isDragging(),
|
|
125
119
|
}),
|
|
126
120
|
});
|
|
@@ -30,20 +30,20 @@ const RepeatableComponent = ({
|
|
|
30
30
|
const [collapseToOpen, setCollapseToOpen] = useState('');
|
|
31
31
|
const [, drop] = useDrop({ accept: ItemTypes.COMPONENT });
|
|
32
32
|
const { getComponentLayout } = useContentTypeLayout();
|
|
33
|
-
const componentLayoutData = useMemo(
|
|
34
|
-
componentUid,
|
|
35
|
-
getComponentLayout
|
|
36
|
-
|
|
33
|
+
const componentLayoutData = useMemo(
|
|
34
|
+
() => getComponentLayout(componentUid),
|
|
35
|
+
[componentUid, getComponentLayout]
|
|
36
|
+
);
|
|
37
37
|
|
|
38
38
|
const nextTempKey = useMemo(() => {
|
|
39
39
|
return getMaxTempKey(componentValue || []) + 1;
|
|
40
40
|
}, [componentValue]);
|
|
41
41
|
|
|
42
42
|
const componentErrorKeys = Object.keys(formErrors)
|
|
43
|
-
.filter(errorKey => {
|
|
43
|
+
.filter((errorKey) => {
|
|
44
44
|
return take(errorKey.split('.'), isNested ? 3 : 1).join('.') === name;
|
|
45
45
|
})
|
|
46
|
-
.map(errorKey => {
|
|
46
|
+
.map((errorKey) => {
|
|
47
47
|
return errorKey
|
|
48
48
|
.split('.')
|
|
49
49
|
.slice(0, name.split('.').length + 1)
|
|
@@ -54,7 +54,7 @@ const RepeatableComponent = ({
|
|
|
54
54
|
setCollapseToOpen('');
|
|
55
55
|
};
|
|
56
56
|
const missingComponentsValue = min - componentValueLength;
|
|
57
|
-
const errorsArray = componentErrorKeys.map(key => get(formErrors, [key, 'id'], ''));
|
|
57
|
+
const errorsArray = componentErrorKeys.map((key) => get(formErrors, [key, 'id'], ''));
|
|
58
58
|
|
|
59
59
|
const hasMinError = get(errorsArray, [0], '').includes('min');
|
|
60
60
|
|
|
@@ -86,7 +86,7 @@ const RepeatableComponent = ({
|
|
|
86
86
|
{componentValueLength === 0 && (
|
|
87
87
|
<EmptyComponent hasMinError={hasMinError}>
|
|
88
88
|
<FormattedMessage id={`${pluginId}.components.empty-repeatable`}>
|
|
89
|
-
{msg => <p>{msg}</p>}
|
|
89
|
+
{(msg) => <p>{msg}</p>}
|
|
90
90
|
</FormattedMessage>
|
|
91
91
|
</EmptyComponent>
|
|
92
92
|
)}
|
|
@@ -3,27 +3,27 @@ import getTrad from '../../utils/getTrad';
|
|
|
3
3
|
|
|
4
4
|
const initialState = fromJS({ collapses: [] });
|
|
5
5
|
|
|
6
|
-
const getMax = arr => {
|
|
6
|
+
const getMax = (arr) => {
|
|
7
7
|
if (arr.size === 0) {
|
|
8
8
|
return -1;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
return Math.max.apply(
|
|
12
12
|
Math,
|
|
13
|
-
arr.toJS().map(o => o._temp__id)
|
|
13
|
+
arr.toJS().map((o) => o._temp__id)
|
|
14
14
|
);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const reducer = (state, action) => {
|
|
18
18
|
switch (action.type) {
|
|
19
19
|
case 'ADD_NEW_FIELD':
|
|
20
|
-
return state.update('collapses', list => {
|
|
20
|
+
return state.update('collapses', (list) => {
|
|
21
21
|
return list
|
|
22
|
-
.map(obj => obj.update('isOpen', () => false))
|
|
22
|
+
.map((obj) => obj.update('isOpen', () => false))
|
|
23
23
|
.push(fromJS({ isOpen: true, _temp__id: getMax(list) + 1 }));
|
|
24
24
|
});
|
|
25
25
|
case 'MOVE_COLLAPSE':
|
|
26
|
-
return state.updateIn(['collapses'], list => {
|
|
26
|
+
return state.updateIn(['collapses'], (list) => {
|
|
27
27
|
const oldList = list;
|
|
28
28
|
const newList = list
|
|
29
29
|
.delete(action.dragIndex)
|
|
@@ -44,10 +44,10 @@ const reducer = (state, action) => {
|
|
|
44
44
|
return newList;
|
|
45
45
|
});
|
|
46
46
|
case 'TOGGLE_COLLAPSE':
|
|
47
|
-
return state.update('collapses', list => {
|
|
47
|
+
return state.update('collapses', (list) => {
|
|
48
48
|
return list.map((obj, index) => {
|
|
49
49
|
if (index === action.index) {
|
|
50
|
-
return obj.update('isOpen', v => !v);
|
|
50
|
+
return obj.update('isOpen', (v) => !v);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
return obj.update('isOpen', () => false);
|
|
@@ -56,8 +56,8 @@ const reducer = (state, action) => {
|
|
|
56
56
|
case 'REMOVE_COLLAPSE':
|
|
57
57
|
return state
|
|
58
58
|
.removeIn(['collapses', action.index])
|
|
59
|
-
.update('collapses', list => list.map(obj => obj.set('isOpen', false)))
|
|
60
|
-
.update('collapses', list => {
|
|
59
|
+
.update('collapses', (list) => list.map((obj) => obj.set('isOpen', false)))
|
|
60
|
+
.update('collapses', (list) => {
|
|
61
61
|
if (action.shouldAddEmptyField) {
|
|
62
62
|
return list.push(fromJS({ isOpen: true }));
|
|
63
63
|
}
|
|
@@ -45,7 +45,7 @@ class Search extends React.Component {
|
|
|
45
45
|
this.triggerChange('');
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
triggerChange = value => {
|
|
48
|
+
triggerChange = (value) => {
|
|
49
49
|
const method = value ? 'push' : 'remove';
|
|
50
50
|
const params = method === 'push' ? { _q: value, page: 1 } : { _q: '' };
|
|
51
51
|
|
|
@@ -58,7 +58,7 @@ class Search extends React.Component {
|
|
|
58
58
|
|
|
59
59
|
return (
|
|
60
60
|
<FormattedMessage id={getTrad('components.Search.placeholder')}>
|
|
61
|
-
{placeholder => (
|
|
61
|
+
{(placeholder) => (
|
|
62
62
|
<HeaderSearch
|
|
63
63
|
label={upperFirst(model)}
|
|
64
64
|
onChange={this.handleChange}
|
|
@@ -11,9 +11,7 @@ const SectionTitle = ({ isSettings }) => {
|
|
|
11
11
|
|
|
12
12
|
return (
|
|
13
13
|
<div style={{ marginBottom: '18px' }}>
|
|
14
|
-
<FormattedMessage id={msgId}>
|
|
15
|
-
{msg => <Title>{msg}</Title>}
|
|
16
|
-
</FormattedMessage>
|
|
14
|
+
<FormattedMessage id={msgId}>{(msg) => <Title>{msg}</Title>}</FormattedMessage>
|
|
17
15
|
</div>
|
|
18
16
|
);
|
|
19
17
|
};
|
|
@@ -35,7 +35,7 @@ function ListItem({
|
|
|
35
35
|
hasDraftAndPublish,
|
|
36
36
|
mainField,
|
|
37
37
|
},
|
|
38
|
-
collect: monitor => ({
|
|
38
|
+
collect: (monitor) => ({
|
|
39
39
|
isDragging: monitor.isDragging(),
|
|
40
40
|
}),
|
|
41
41
|
});
|
|
@@ -58,7 +58,7 @@ function ListItem({
|
|
|
58
58
|
|
|
59
59
|
return (
|
|
60
60
|
<Li
|
|
61
|
-
ref={node => {
|
|
61
|
+
ref={(node) => {
|
|
62
62
|
if (!isDisabled) {
|
|
63
63
|
drag(drop(node));
|
|
64
64
|
}
|
|
@@ -29,8 +29,8 @@ function SelectMany({
|
|
|
29
29
|
value,
|
|
30
30
|
}) {
|
|
31
31
|
const [, drop] = useDrop({ accept: ItemTypes.RELATION });
|
|
32
|
-
const findRelation = id => {
|
|
33
|
-
const relation = value.filter(c => {
|
|
32
|
+
const findRelation = (id) => {
|
|
33
|
+
const relation = value.filter((c) => {
|
|
34
34
|
return `${c.id}` === `${id}`;
|
|
35
35
|
})[0];
|
|
36
36
|
|
|
@@ -65,7 +65,7 @@ function SelectMany({
|
|
|
65
65
|
id={name}
|
|
66
66
|
filterOption={(candidate, input) => {
|
|
67
67
|
if (!isEmpty(value)) {
|
|
68
|
-
const isSelected = value.findIndex(item => item.id === candidate.value.id) !== -1;
|
|
68
|
+
const isSelected = value.findIndex((item) => item.id === candidate.value.id) !== -1;
|
|
69
69
|
|
|
70
70
|
if (isSelected) {
|
|
71
71
|
return false;
|
|
@@ -6,7 +6,7 @@ import { Flex, Padded, Text } from '@buffetjs/core';
|
|
|
6
6
|
import { RelationDPState } from 'strapi-helper-plugin';
|
|
7
7
|
import { getDisplayedValue } from '../../utils';
|
|
8
8
|
|
|
9
|
-
const SingleValue = props => {
|
|
9
|
+
const SingleValue = (props) => {
|
|
10
10
|
const Component = components.SingleValue;
|
|
11
11
|
const hasDraftAndPublish = has(get(props, 'data.value'), 'published_at');
|
|
12
12
|
const isDraft = isEmpty(get(props, 'data.value.published_at'));
|
|
@@ -12,7 +12,7 @@ const TextGrow = styled(Text)`
|
|
|
12
12
|
flex-grow: 2;
|
|
13
13
|
`;
|
|
14
14
|
|
|
15
|
-
const Option = props => {
|
|
15
|
+
const Option = (props) => {
|
|
16
16
|
const { formatMessage } = useIntl();
|
|
17
17
|
const Component = components.Option;
|
|
18
18
|
const hasDraftAndPublish = has(get(props, 'data.value'), 'published_at');
|
|
@@ -62,13 +62,8 @@ function SelectWrapper({
|
|
|
62
62
|
const [{ query }] = useQueryParams();
|
|
63
63
|
// Disable the input in case of a polymorphic relation
|
|
64
64
|
const isMorph = useMemo(() => relationType.toLowerCase().includes('morph'), [relationType]);
|
|
65
|
-
const {
|
|
66
|
-
|
|
67
|
-
modifiedData,
|
|
68
|
-
moveRelation,
|
|
69
|
-
onChange,
|
|
70
|
-
onRemoveRelation,
|
|
71
|
-
} = useContentManagerEditViewDataManager();
|
|
65
|
+
const { addRelation, modifiedData, moveRelation, onChange, onRemoveRelation } =
|
|
66
|
+
useContentManagerEditViewDataManager();
|
|
72
67
|
const { pathname } = useLocation();
|
|
73
68
|
|
|
74
69
|
const value = get(modifiedData, name, null);
|
|
@@ -78,11 +73,11 @@ function SelectWrapper({
|
|
|
78
73
|
const [isOpen, setIsOpen] = useState(false);
|
|
79
74
|
|
|
80
75
|
const filteredOptions = useMemo(() => {
|
|
81
|
-
return options.filter(option => {
|
|
76
|
+
return options.filter((option) => {
|
|
82
77
|
if (!isEmpty(value)) {
|
|
83
78
|
// SelectMany
|
|
84
79
|
if (Array.isArray(value)) {
|
|
85
|
-
return findIndex(value, o => o.id === option.value.id) === -1;
|
|
80
|
+
return findIndex(value, (o) => o.id === option.value.id) === -1;
|
|
86
81
|
}
|
|
87
82
|
|
|
88
83
|
// SelectOne
|
|
@@ -93,13 +88,8 @@ function SelectWrapper({
|
|
|
93
88
|
});
|
|
94
89
|
}, [options, value]);
|
|
95
90
|
|
|
96
|
-
const {
|
|
97
|
-
|
|
98
|
-
containsKey,
|
|
99
|
-
defaultParams,
|
|
100
|
-
shouldDisplayRelationLink,
|
|
101
|
-
paramsToKeep,
|
|
102
|
-
} = queryInfos;
|
|
91
|
+
const { endPoint, containsKey, defaultParams, shouldDisplayRelationLink, paramsToKeep } =
|
|
92
|
+
queryInfos;
|
|
103
93
|
|
|
104
94
|
const isSingle = ['oneWay', 'oneToOne', 'manyToOne', 'oneToManyMorph', 'oneToOneMorph'].includes(
|
|
105
95
|
relationType
|
|
@@ -114,11 +104,11 @@ function SelectWrapper({
|
|
|
114
104
|
return [value.id];
|
|
115
105
|
}
|
|
116
106
|
|
|
117
|
-
return value.map(val => val.id);
|
|
107
|
+
return value.map((val) => val.id);
|
|
118
108
|
}, [isSingle, value]);
|
|
119
109
|
|
|
120
110
|
const getData = useCallback(
|
|
121
|
-
async signal => {
|
|
111
|
+
async (signal) => {
|
|
122
112
|
// Currently polymorphic relations are not handled
|
|
123
113
|
if (isMorph) {
|
|
124
114
|
setIsLoading(false);
|
|
@@ -148,19 +138,19 @@ function SelectWrapper({
|
|
|
148
138
|
body: { idsToOmit },
|
|
149
139
|
});
|
|
150
140
|
|
|
151
|
-
const formattedData = data.map(obj => {
|
|
141
|
+
const formattedData = data.map((obj) => {
|
|
152
142
|
return { value: obj, label: obj[mainField.name] };
|
|
153
143
|
});
|
|
154
144
|
|
|
155
|
-
setOptions(prevState =>
|
|
145
|
+
setOptions((prevState) =>
|
|
156
146
|
prevState.concat(formattedData).filter((obj, index) => {
|
|
157
|
-
const objIndex = prevState.findIndex(el => el.value.id === obj.value.id);
|
|
147
|
+
const objIndex = prevState.findIndex((el) => el.value.id === obj.value.id);
|
|
158
148
|
|
|
159
149
|
if (objIndex === -1) {
|
|
160
150
|
return true;
|
|
161
151
|
}
|
|
162
152
|
|
|
163
|
-
return prevState.findIndex(el => el.value.id === obj.value.id) === index;
|
|
153
|
+
return prevState.findIndex((el) => el.value.id === obj.value.id) === index;
|
|
164
154
|
})
|
|
165
155
|
);
|
|
166
156
|
setIsLoading(false);
|
|
@@ -194,7 +184,7 @@ function SelectWrapper({
|
|
|
194
184
|
|
|
195
185
|
const handleInputChange = (inputValue, { action }) => {
|
|
196
186
|
if (action === 'input-change') {
|
|
197
|
-
setState(prevState => {
|
|
187
|
+
setState((prevState) => {
|
|
198
188
|
if (prevState._contains === inputValue) {
|
|
199
189
|
return prevState;
|
|
200
190
|
}
|
|
@@ -207,7 +197,7 @@ function SelectWrapper({
|
|
|
207
197
|
};
|
|
208
198
|
|
|
209
199
|
const handleMenuScrollToBottom = () => {
|
|
210
|
-
setState(prevState => ({ ...prevState, _limit: prevState._limit + 20 }));
|
|
200
|
+
setState((prevState) => ({ ...prevState, _limit: prevState._limit + 20 }));
|
|
211
201
|
};
|
|
212
202
|
|
|
213
203
|
const handleMenuClose = () => {
|
|
@@ -215,11 +205,11 @@ function SelectWrapper({
|
|
|
215
205
|
setIsOpen(false);
|
|
216
206
|
};
|
|
217
207
|
|
|
218
|
-
const handleChange = value => {
|
|
208
|
+
const handleChange = (value) => {
|
|
219
209
|
onChange({ target: { name, value: value ? value.value : value } });
|
|
220
210
|
};
|
|
221
211
|
|
|
222
|
-
const handleAddRelation = value => {
|
|
212
|
+
const handleAddRelation = (value) => {
|
|
223
213
|
if (!isEmpty(value)) {
|
|
224
214
|
addRelation({ target: { name, value } });
|
|
225
215
|
}
|
|
@@ -245,7 +235,7 @@ function SelectWrapper({
|
|
|
245
235
|
return (
|
|
246
236
|
<Link to={{ pathname: to, state: { from: pathname }, search: searchToPersist }}>
|
|
247
237
|
<FormattedMessage id="content-manager.containers.Edit.seeDetails">
|
|
248
|
-
{msg => <A color="mediumBlue">{msg}</A>}
|
|
238
|
+
{(msg) => <A color="mediumBlue">{msg}</A>}
|
|
249
239
|
</FormattedMessage>
|
|
250
240
|
</Link>
|
|
251
241
|
);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable no-nested-ternary */
|
|
3
3
|
|
|
4
4
|
const styles = {
|
|
5
|
-
container: base => ({ ...base, background: '#ffffff' }),
|
|
5
|
+
container: (base) => ({ ...base, background: '#ffffff' }),
|
|
6
6
|
control: (base, state) => {
|
|
7
7
|
const borderRadiusStyle = state.selectProps.menuIsOpen
|
|
8
8
|
? {
|
|
@@ -49,8 +49,8 @@ const styles = {
|
|
|
49
49
|
backgroundColor,
|
|
50
50
|
};
|
|
51
51
|
},
|
|
52
|
-
input: base => ({ ...base, marginLeft: 10 }),
|
|
53
|
-
menu: base => {
|
|
52
|
+
input: (base) => ({ ...base, marginLeft: 10 }),
|
|
53
|
+
menu: (base) => {
|
|
54
54
|
return {
|
|
55
55
|
...base,
|
|
56
56
|
width: '100%',
|
|
@@ -65,7 +65,7 @@ const styles = {
|
|
|
65
65
|
fontSize: '13px',
|
|
66
66
|
};
|
|
67
67
|
},
|
|
68
|
-
menuList: base => ({
|
|
68
|
+
menuList: (base) => ({
|
|
69
69
|
...base,
|
|
70
70
|
maxHeight: '112px',
|
|
71
71
|
paddingTop: 2,
|
|
@@ -85,7 +85,7 @@ const styles = {
|
|
|
85
85
|
WebkitFontSmoothing: 'antialiased',
|
|
86
86
|
};
|
|
87
87
|
},
|
|
88
|
-
placeholder: base => ({
|
|
88
|
+
placeholder: (base) => ({
|
|
89
89
|
...base,
|
|
90
90
|
marginTop: 0,
|
|
91
91
|
marginLeft: 10,
|
|
@@ -95,7 +95,7 @@ const styles = {
|
|
|
95
95
|
textOverflow: 'ellipsis',
|
|
96
96
|
maxWidth: 'calc(100% - 32px)',
|
|
97
97
|
}),
|
|
98
|
-
valueContainer: base => ({
|
|
98
|
+
valueContainer: (base) => ({
|
|
99
99
|
...base,
|
|
100
100
|
padding: '2px 0px 4px 0px',
|
|
101
101
|
lineHeight: '18px',
|