mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 17:00:55 +00:00
Merge branch 'front/dynamic-zones-ctm-ui' of github.com:strapi/strapi into front/dynamic-zones-ctm-ui
This commit is contained in:
commit
a2e6427749
@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { ButtonDropdown } from 'reactstrap';
|
import { ButtonDropdown } from 'reactstrap';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { LayoutIcon } from 'strapi-helper-plugin';
|
import { LayoutIcon, useGlobalContext } from 'strapi-helper-plugin';
|
||||||
import pluginId from '../../pluginId';
|
import pluginId from '../../pluginId';
|
||||||
import InputCheckbox from '../InputCheckbox';
|
import InputCheckbox from '../InputCheckbox';
|
||||||
import DropdownItemLink from './DropdownItemLink';
|
import DropdownItemLink from './DropdownItemLink';
|
||||||
@ -21,6 +21,8 @@ const DisplayedFieldsDropdown = ({
|
|||||||
slug,
|
slug,
|
||||||
toggle,
|
toggle,
|
||||||
}) => {
|
}) => {
|
||||||
|
const { emitEvent } = useGlobalContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownWrapper>
|
<DropdownWrapper>
|
||||||
<ButtonDropdown isOpen={isOpen} toggle={toggle} direction="down">
|
<ButtonDropdown isOpen={isOpen} toggle={toggle} direction="down">
|
||||||
@ -28,7 +30,10 @@ const DisplayedFieldsDropdown = ({
|
|||||||
<Toggle isopen={isOpen.toString()} />
|
<Toggle isopen={isOpen.toString()} />
|
||||||
<MenuDropdown isopen={isOpen.toString()}>
|
<MenuDropdown isopen={isOpen.toString()}>
|
||||||
<DropdownItemLink>
|
<DropdownItemLink>
|
||||||
<LayoutWrapper to={`${slug}/ctm-configurations/list-settings`}>
|
<LayoutWrapper
|
||||||
|
to={`${slug}/ctm-configurations/list-settings`}
|
||||||
|
onClick={() => emitEvent('willEditListLayout')}
|
||||||
|
>
|
||||||
<LayoutIcon />
|
<LayoutIcon />
|
||||||
<FormattedMessage id="app.links.configure-view" />
|
<FormattedMessage id="app.links.configure-view" />
|
||||||
</LayoutWrapper>
|
</LayoutWrapper>
|
||||||
|
@ -187,16 +187,12 @@ const EditSettingsView = ({
|
|||||||
delete body.uid;
|
delete body.uid;
|
||||||
delete body.isComponent;
|
delete body.isComponent;
|
||||||
|
|
||||||
emitEvent('willSaveContentTypeLayout');
|
|
||||||
|
|
||||||
await request(getRequestUrl(`${type}/${slug || componentSlug}`), {
|
await request(getRequestUrl(`${type}/${slug || componentSlug}`), {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body,
|
body,
|
||||||
signal,
|
signal,
|
||||||
});
|
});
|
||||||
|
|
||||||
emitEvent('didSaveContentTypeLayout');
|
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'SUBMIT_SUCCEEDED',
|
type: 'SUBMIT_SUCCEEDED',
|
||||||
});
|
});
|
||||||
@ -209,7 +205,7 @@ const EditSettingsView = ({
|
|||||||
deleteLayouts();
|
deleteLayouts();
|
||||||
}
|
}
|
||||||
|
|
||||||
emitEvent('didSaveContentTypeLayout');
|
emitEvent('didEditEditSettings');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
strapi.notification.error('notification.error');
|
strapi.notification.error('notification.error');
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,8 @@ const EditViewDataManagerProvider = ({
|
|||||||
const { signal } = abortController;
|
const { signal } = abortController;
|
||||||
const isCreatingEntry = id === 'create';
|
const isCreatingEntry = id === 'create';
|
||||||
|
|
||||||
|
const { emitEvent } = useGlobalContext();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isLoading) {
|
if (!isLoading) {
|
||||||
checkFormErrors();
|
checkFormErrors();
|
||||||
@ -111,6 +113,7 @@ const EditViewDataManagerProvider = ({
|
|||||||
componentUid,
|
componentUid,
|
||||||
shouldCheckErrors = false
|
shouldCheckErrors = false
|
||||||
) => {
|
) => {
|
||||||
|
emitEvent('addComponentToDynamicZone');
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'ADD_COMPONENT_TO_DYNAMIC_ZONE',
|
type: 'ADD_COMPONENT_TO_DYNAMIC_ZONE',
|
||||||
keys: keys.split('.'),
|
keys: keys.split('.'),
|
||||||
@ -188,8 +191,6 @@ const EditViewDataManagerProvider = ({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const { emitEvent } = useGlobalContext();
|
|
||||||
|
|
||||||
const handleSubmit = async e => {
|
const handleSubmit = async e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
@ -270,6 +271,7 @@ const EditViewDataManagerProvider = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const moveComponentDown = (dynamicZoneName, currentIndex) => {
|
const moveComponentDown = (dynamicZoneName, currentIndex) => {
|
||||||
|
emitEvent('changeComponentsOrder');
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'MOVE_COMPONENT_DOWN',
|
type: 'MOVE_COMPONENT_DOWN',
|
||||||
dynamicZoneName,
|
dynamicZoneName,
|
||||||
@ -277,6 +279,7 @@ const EditViewDataManagerProvider = ({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
const moveComponentUp = (dynamicZoneName, currentIndex) => {
|
const moveComponentUp = (dynamicZoneName, currentIndex) => {
|
||||||
|
emitEvent('changeComponentsOrder');
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'MOVE_COMPONENT_UP',
|
type: 'MOVE_COMPONENT_UP',
|
||||||
dynamicZoneName,
|
dynamicZoneName,
|
||||||
@ -309,6 +312,7 @@ const EditViewDataManagerProvider = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const removeComponentFromDynamicZone = (dynamicZoneName, index) => {
|
const removeComponentFromDynamicZone = (dynamicZoneName, index) => {
|
||||||
|
emitEvent('removeComponentFromDynamicZone');
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'REMOVE_COMPONENT_FROM_DYNAMIC_ZONE',
|
type: 'REMOVE_COMPONENT_FROM_DYNAMIC_ZONE',
|
||||||
dynamicZoneName,
|
dynamicZoneName,
|
||||||
|
@ -151,7 +151,7 @@ const ListSettingsView = ({ deleteLayout, models, slug }) => {
|
|||||||
type: 'SUBMIT_SUCCEEDED',
|
type: 'SUBMIT_SUCCEEDED',
|
||||||
});
|
});
|
||||||
deleteLayout(slug);
|
deleteLayout(slug);
|
||||||
emitEvent('didSaveContentTypeLayout');
|
emitEvent('didEditListSettings');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
strapi.notification.error('notification.error');
|
strapi.notification.error('notification.error');
|
||||||
}
|
}
|
||||||
|
@ -109,12 +109,16 @@ function ListView({
|
|||||||
|
|
||||||
const toggleLabelPickerState = () => {
|
const toggleLabelPickerState = () => {
|
||||||
if (!isLabelPickerOpen) {
|
if (!isLabelPickerOpen) {
|
||||||
emitEvent('willChangeDisplayedFields');
|
emitEvent('willChangeListFieldsSettings');
|
||||||
}
|
}
|
||||||
|
|
||||||
setLabelPickerState(prevState => !prevState);
|
setLabelPickerState(prevState => !prevState);
|
||||||
};
|
};
|
||||||
const toggleFilterPickerState = () => {
|
const toggleFilterPickerState = () => {
|
||||||
|
if (!isFilterPickerOpen) {
|
||||||
|
emitEvent('willFilterEntries');
|
||||||
|
}
|
||||||
|
|
||||||
setFilterPickerState(prevState => !prevState);
|
setFilterPickerState(prevState => !prevState);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ const getInjectedComponents = (
|
|||||||
{...compo.props}
|
{...compo.props}
|
||||||
key={compo.key}
|
key={compo.key}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
emitEvent('willEditContentTypeFromEditView');
|
emitEvent('willEditEditLayout');
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user