Merge branch 'v4/ds-migration' of github.com:strapi/strapi into chore/remove-plugins

This commit is contained in:
soupette 2021-08-23 10:57:25 +02:00
commit 4b6341aa18
215 changed files with 4387 additions and 271 deletions

View File

@ -7,6 +7,7 @@ stats.json
package-lock.json
yarn-error.log
# Cruft
.DS_Store
npm-debug.log

View File

@ -0,0 +1,11 @@
module.exports = {
stories: [
'../*.stories.mdx',
'../lib/src/**/*.stories.mdx',
'../lib/src/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
core: {
builder: 'webpack5',
},
};

View File

@ -0,0 +1,9 @@
export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
};

View File

@ -0,0 +1,7 @@
import { Meta } from '@storybook/addon-docs';
<Meta title="Introduction" />
# Welcome to the Helper plugin documentation
Here you will find the documentation related to the complex components that are used in the Strapi admin panel.

View File

@ -0,0 +1,25 @@
import { Meta } from '@storybook/addon-docs';
<Meta title="components/CheckPagePermissions" />
# CheckPagePermissions
This component is used in order to apply RBAC to a view. If the user does not have the permissions to access the view he will be redirect to the homepage:
## Usage
```
import { CheckPagePermissions } from '@strapi/helper-plugin';
const permissions = [{ action: 'plugins::my-plugin.access', subject: null }];
const HomePage = () => {
return (
<CheckPagePermissions permissions={permissions}>
<main>
<h1>This is the homepage</h1>
</main>
</CheckPagePermissions>
);
};
```

View File

@ -2,10 +2,9 @@ import React, { useEffect, useRef, useState } from 'react';
import { Redirect } from 'react-router-dom';
import PropTypes from 'prop-types';
import useNotification from '../../hooks/useNotification';
import hasPermissions from '../../utils/hasPermissions';
import LoadingIndicatorPage from '../LoadingIndicatorPage';
import useRBACProvider from '../../hooks/useRBACProvider';
import hasPermissions from '../../utils/hasPermissions';
import LoadingIndicatorPage from '../../old/components/LoadingIndicatorPage';
const CheckPagePermissions = ({ permissions, children }) => {
const abortController = new AbortController();

View File

@ -0,0 +1,26 @@
import { Meta } from '@storybook/addon-docs';
<Meta title="components/CheckPermissions" />
# CheckPermissions
This component is used in order to apply RBAC to a component. If the user does not have the permissions to view a component it will be hidden.
## Usage
```
import { CheckPermissions } from '@strapi/helper-plugin';
const permissions = [{ action: 'plugins::my-plugin.read', subject: null }];
const HomePage = () => {
return (
<main>
<h1>This is the homepage</h1>
<CheckPermissions permissions={permissions}>
You can all see this if you have the right to.
</CheckPermissions>
</main>
);
};
```

View File

@ -0,0 +1,54 @@
import { Meta } from '@storybook/addon-docs';
<Meta title="components/InjectionZone" />
# InjectionZone
This component is used in order to define an injection zone that other plugins can use to add components in a dedicated area.
## Usage
```
// Use the injection zone in a view
import { InjectionZone } from '@strapi/helper-plugin';
const HomePage = () => {
return (
<main>
<h1>This is the homepage</h1>
</main>
<InjectionZone area="my-plugin.homePage.right" />
);
};
// Define this injection zone
// path: 'my-plugin/admin/src/index.js
export default {
register() {
app.registerPlugin({
// ...
injectionZones: {
homepage: {
right: []
}
}
});
},
}
// Inject from a plugin
// path: 'my-other-plugin/admin/src/index.js'
export default {
register() {
// ...
},
bootstrap(app) {
app.getPlugin('my-plugin').injectComponent('homePage', 'right', {
name: 'my-other-plugin-component',
Component: () => 'This component is injected',
});
}
};
```

View File

@ -1,4 +1,4 @@
import testData from '../../../testUtils/testData';
import testData from '../../../old/testUtils/testData';
import contentManagementUtilRemoveFieldsFromData from '../contentManagementUtilRemoveFieldsFromData';
describe('STRAPI_HELPER_PLUGIN | utils', () => {

View File

@ -1,4 +1,4 @@
import testData from '../../../testUtils/testData';
import testData from '../../../old/testUtils/testData';
import formatComponentData from '../formatComponentData';
const { contentType, components, modifiedData } = testData;

View File

@ -1,110 +1,108 @@
import { getType, getOtherInfos } from './content-manager/utils/getAttributeInfos';
// Assets
export { default as colors } from './assets/styles/colors';
export { default as sizes } from './assets/styles/sizes';
export { default as colors } from './old/assets/styles/colors';
export { default as sizes } from './old/assets/styles/sizes';
// Components
export { default as BackHeader } from './components/BackHeader';
export { default as BaselineAlignment } from './components/BaselineAlignment';
export { default as BlockerComponent } from './components/BlockerComponent';
export { default as Button } from './components/Button';
export { default as ButtonModal } from './components/ButtonModal';
export { default as Carret } from './components/Carret';
export { default as CircleButton } from './components/CircleButton';
export { default as ContainerFluid } from './components/ContainerFluid';
export { default as ErrorBoundary } from './components/ErrorBoundary';
export { default as ErrorFallback } from './components/ErrorFallback';
export { default as FilterButton } from './components/FilterButton';
export { default as GlobalPagination } from './components/GlobalPagination';
export { default as HeaderNav } from './components/HeaderNav';
export { default as HeaderModal } from './components/HeaderModal';
export { default as HeaderModalTitle } from './components/HeaderModalTitle';
export { default as HeaderSearch } from './components/HeaderSearch';
export { default as IcoContainer } from './components/IcoContainer';
export { default as InputAddon } from './components/InputAddon';
export { default as EmptyState } from './components/EmptyState';
export { default as Form } from './components/Form';
export * from './components/Tabs';
export * from './components/Select';
export { default as BackHeader } from './old/components/BackHeader';
export { default as BaselineAlignment } from './old/components/BaselineAlignment';
export { default as BlockerComponent } from './old/components/BlockerComponent';
export { default as Button } from './old/components/Button';
export { default as ButtonModal } from './old/components/ButtonModal';
export { default as Carret } from './old/components/Carret';
export { default as CircleButton } from './old/components/CircleButton';
export { default as ContainerFluid } from './old/components/ContainerFluid';
export { default as ErrorBoundary } from './old/components/ErrorBoundary';
export { default as ErrorFallback } from './old/components/ErrorFallback';
export { default as FilterButton } from './old/components/FilterButton';
export { default as GlobalPagination } from './old/components/GlobalPagination';
export { default as HeaderNav } from './old/components/HeaderNav';
export { default as HeaderModal } from './old/components/HeaderModal';
export { default as HeaderModalTitle } from './old/components/HeaderModalTitle';
export { default as HeaderSearch } from './old/components/HeaderSearch';
export { default as IcoContainer } from './old/components/IcoContainer';
export { default as InputAddon } from './old/components/InputAddon';
export { default as EmptyState } from './old/components/EmptyState';
export { default as Form } from './old/components/Form';
export * from './old/components/Tabs';
export * from './old/components/Select';
export { default as DropdownIndicator } from './components/Select/DropdownIndicator';
export * from './components/InjectionZone';
export { default as DropdownIndicator } from './old/components/Select/DropdownIndicator';
export { default as InputAddonWithErrors } from './components/InputAddonWithErrors';
export { default as InputCheckbox } from './components/InputCheckbox';
export { default as InputCheckboxWithErrors } from './components/InputCheckboxWithErrors';
export { default as InputDescription } from './components/InputDescription';
export { default as InputEmail } from './components/InputEmail';
export { default as InputEmailWithErrors } from './components/InputEmailWithErrors';
export { default as InputErrors } from './components/InputErrors';
export { default as InputNumber } from './components/InputNumber';
export { default as InputNumberWithErrors } from './components/InputNumberWithErrors';
export { default as InputPassword } from './components/InputPassword';
export { default as InputPasswordWithErrors } from './components/InputPasswordWithErrors';
export { default as InputSearch } from './components/InputSearch';
export { default as InputSearchWithErrors } from './components/InputSearchWithErrors';
export { default as InputSelect } from './components/InputSelect';
export { default as InputSelectWithErrors } from './components/InputSelectWithErrors';
export { default as InputsIndex } from './components/InputsIndex';
export { default as InputSpacer } from './components/InputSpacer';
export { default as InputText } from './components/InputText';
export { default as InputTextWithErrors } from './components/InputTextWithErrors';
export { default as InputTextArea } from './components/InputTextArea';
export { default as InputTextAreaWithErrors } from './components/InputTextAreaWithErrors';
export { default as InputToggle } from './components/InputToggle';
export { default as InputToggleWithErrors } from './components/InputToggleWithErrors';
export { default as InputAddonWithErrors } from './old/components/InputAddonWithErrors';
export { default as InputCheckbox } from './old/components/InputCheckbox';
export { default as InputCheckboxWithErrors } from './old/components/InputCheckboxWithErrors';
export { default as InputDescription } from './old/components/InputDescription';
export { default as InputEmail } from './old/components/InputEmail';
export { default as InputEmailWithErrors } from './old/components/InputEmailWithErrors';
export { default as InputErrors } from './old/components/InputErrors';
export { default as InputNumber } from './old/components/InputNumber';
export { default as InputNumberWithErrors } from './old/components/InputNumberWithErrors';
export { default as InputPassword } from './old/components/InputPassword';
export { default as InputPasswordWithErrors } from './old/components/InputPasswordWithErrors';
export { default as InputSearch } from './old/components/InputSearch';
export { default as InputSearchWithErrors } from './old/components/InputSearchWithErrors';
export { default as InputSelect } from './old/components/InputSelect';
export { default as InputSelectWithErrors } from './old/components/InputSelectWithErrors';
export { default as InputsIndex } from './old/components/InputsIndex';
export { default as InputSpacer } from './old/components/InputSpacer';
export { default as InputText } from './old/components/InputText';
export { default as InputTextWithErrors } from './old/components/InputTextWithErrors';
export { default as InputTextArea } from './old/components/InputTextArea';
export { default as InputTextAreaWithErrors } from './old/components/InputTextAreaWithErrors';
export { default as InputToggle } from './old/components/InputToggle';
export { default as InputToggleWithErrors } from './old/components/InputToggleWithErrors';
export { default as Label } from './components/Label';
export { default as LabelIconWrapper } from './components/LabelIconWrapper';
export { default as LeftMenu } from './components/LeftMenu';
export { default as LeftMenuList } from './components/LeftMenuList';
export { default as LiLink } from './components/LiLink';
export { default as List } from './components/List';
export { default as ListButton } from './components/ListButton';
export { default as ListRow } from './components/ListRow';
export { default as ListWrapper } from './components/ListWrapper';
export { default as ListHeader } from './components/ListHeader';
export { default as ListTitle } from './components/ListTitle';
export { default as Label } from './old/components/Label';
export { default as LabelIconWrapper } from './old/components/LabelIconWrapper';
export { default as LeftMenu } from './old/components/LeftMenu';
export { default as LeftMenuList } from './old/components/LeftMenuList';
export { default as LiLink } from './old/components/LiLink';
export { default as List } from './old/components/List';
export { default as ListButton } from './old/components/ListButton';
export { default as ListRow } from './old/components/ListRow';
export { default as ListWrapper } from './old/components/ListWrapper';
export { default as ListHeader } from './old/components/ListHeader';
export { default as ListTitle } from './old/components/ListTitle';
export { default as LoadingBar } from './components/LoadingBar';
export { default as LoadingIndicator } from './components/LoadingIndicator';
export { default as LoadingIndicatorPage } from './components/LoadingIndicatorPage';
export { default as LoadingBar } from './old/components/LoadingBar';
export { default as LoadingIndicator } from './old/components/LoadingIndicator';
export { default as LoadingIndicatorPage } from './old/components/LoadingIndicatorPage';
export { default as ModalConfirm } from './components/ModalConfirm';
export { default as Modal } from './components/Modal';
export { default as ModalBody } from './components/BodyModal';
export { default as ModalHeader } from './components/ModalHeader';
export { default as ModalFooter } from './components/FooterModal';
export { default as ModalForm } from './components/FormModal';
export { default as ModalSection } from './components/ModalSection';
export { default as NotAllowedInput } from './components/NotAllowedInput';
export { default as NotFound } from './components/NotFound';
export { default as ModalConfirm } from './old/components/ModalConfirm';
export { default as Modal } from './old/components/Modal';
export { default as ModalBody } from './old/components/BodyModal';
export { default as ModalHeader } from './old/components/ModalHeader';
export { default as ModalFooter } from './old/components/FooterModal';
export { default as ModalForm } from './old/components/FormModal';
export { default as ModalSection } from './old/components/ModalSection';
export { default as NotAllowedInput } from './old/components/NotAllowedInput';
export { default as NotFound } from './old/components/NotFound';
export { default as PageFooter } from './components/PageFooter';
export { default as PluginHeader } from './components/PluginHeader';
export { default as RelationDPState } from './components/RelationDPState';
export { default as PopUpWarning } from './components/PopUpWarning';
export { default as Row } from './components/Row';
export { default as SearchInfo } from './components/SearchInfo';
export { default as SelectNav } from './components/SelectNav';
export { default as SelectWrapper } from './components/SelectWrapper';
export { default as PageFooter } from './old/components/PageFooter';
export { default as PluginHeader } from './old/components/PluginHeader';
export { default as RelationDPState } from './old/components/RelationDPState';
export { default as PopUpWarning } from './old/components/PopUpWarning';
export { default as Row } from './old/components/Row';
export { default as SearchInfo } from './old/components/SearchInfo';
export { default as SelectNav } from './old/components/SelectNav';
export { default as SelectWrapper } from './old/components/SelectWrapper';
export { default as ViewContainer } from './components/ViewContainer';
export { default as CheckPagePermissions } from './components/CheckPagePermissions';
export { default as CheckPermissions } from './components/CheckPermissions';
export { default as SettingsPageTitle } from './components/SettingsPageTitle';
export { default as FormBloc } from './components/FormBloc';
export { default as IntlInput } from './components/IntlInput';
export { default as SizedInput } from './components/SizedInput';
export { default as ViewContainer } from './old/components/ViewContainer';
export * from './components/Permissions';
export { default as SettingsPageTitle } from './old/components/SettingsPageTitle';
export { default as FormBloc } from './old/components/FormBloc';
export { default as IntlInput } from './old/components/IntlInput';
export { default as SizedInput } from './old/components/SizedInput';
export * from './old/components/Permissions';
// PopUpWarning
export { default as PopUpWarningBody } from './components/PopUpWarning/Body';
export { default as PopUpWarningFooter } from './components/PopUpWarning/StyledFooter';
export { default as PopUpWarningHeader } from './components/PopUpWarning/Header';
export { default as PopUpWarningIcon } from './components/PopUpWarning/Icon';
export { default as PopUpWarningModal } from './components/PopUpWarning/StyledModal';
export { default as PopUpWarningBody } from './old/components/PopUpWarning/Body';
export { default as PopUpWarningFooter } from './old/components/PopUpWarning/StyledFooter';
export { default as PopUpWarningHeader } from './old/components/PopUpWarning/Header';
export { default as PopUpWarningIcon } from './old/components/PopUpWarning/Icon';
export { default as PopUpWarningModal } from './old/components/PopUpWarning/StyledModal';
// Contexts
export { default as AppInfosContext } from './contexts/AppInfosContext';
@ -166,9 +164,14 @@ export { default as prefixFileUrlWithBackendUrl } from './utils/prefixFileUrlWit
export { default as prefixPluginTranslations } from './utils/prefixPluginTranslations';
// SVGS
export { default as LayoutIcon } from './svgs/Layout';
export { default as ClearIcon } from './svgs/Clear';
export { default as Close } from './svgs/Close';
export { default as EyeSlashed } from './svgs/EyeSlashed';
export { default as FilterIcon } from './svgs/Filter';
export { default as SearchIcon } from './svgs/Search';
export { default as LayoutIcon } from './old/svgs/Layout';
export { default as ClearIcon } from './old/svgs/Clear';
export { default as Close } from './old/svgs/Close';
export { default as EyeSlashed } from './old/svgs/EyeSlashed';
export { default as FilterIcon } from './old/svgs/Filter';
export { default as SearchIcon } from './old/svgs/Search';
// New components
export { default as CheckPagePermissions } from './components/CheckPagePermissions';
export { default as CheckPermissions } from './components/CheckPermissions';
export * from './components/InjectionZone';

View File

Before

Width:  |  Height:  |  Size: 670 B

After

Width:  |  Height:  |  Size: 670 B

View File

Before

Width:  |  Height:  |  Size: 791 B

After

Width:  |  Height:  |  Size: 791 B

View File

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 246 B

View File

Before

Width:  |  Height:  |  Size: 543 B

After

Width:  |  Height:  |  Size: 543 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 859 B

After

Width:  |  Height:  |  Size: 859 B

View File

@ -9,7 +9,7 @@ import React from 'react';
import { get } from 'lodash';
import { useRouteMatch } from 'react-router-dom';
import PropTypes from 'prop-types';
import useTracking from '../../hooks/useTracking';
import useTracking from '../../../hooks/useTracking';
import StyledBackHeader from './StyledBackHeader';
const BackHeader = props => {

View File

@ -11,7 +11,7 @@ import { map } from 'lodash';
import PropTypes from 'prop-types';
// Utils
import { darken } from '../../utils/colors';
import { darken } from '../../../utils/colors';
import Wrapper from './Wrapper';
function HeaderNav({ links, style }) {

View File

@ -10,7 +10,7 @@ import { isEmpty, isFunction } from 'lodash';
import cn from 'classnames';
// Utils
import validateInput from '../../utils/inputsValidations';
import validateInput from '../../../utils/inputsValidations';
// Design
import Label from '../Label';

View File

@ -10,7 +10,7 @@ import { isEmpty, isFunction } from 'lodash';
import cn from 'classnames';
// Utils
import validateInput from '../../utils/inputsValidations';
import validateInput from '../../../utils/inputsValidations';
// Design
import Label from '../Label';

View File

@ -4,7 +4,7 @@ import { isEmpty, isFunction } from 'lodash';
import cn from 'classnames';
// Utils
import validateInput from '../../utils/inputsValidations';
import validateInput from '../../../utils/inputsValidations';
// Design
import Label from '../Label';

View File

@ -10,7 +10,7 @@ import { isEmpty, isFunction } from 'lodash';
import cn from 'classnames';
// Utils
import validateInput from '../../utils/inputsValidations';
import validateInput from '../../../utils/inputsValidations';
// Design
import Label from '../Label';

View File

@ -10,7 +10,7 @@ import { isEmpty, isFunction } from 'lodash';
import cn from 'classnames';
// Utils
import validateInput from '../../utils/inputsValidations';
import validateInput from '../../../utils/inputsValidations';
// Design
import Label from '../Label';

Some files were not shown because too many files have changed in this diff Show More