Merge remote-tracking branch 'origin/main' into feature/review-workflow-assignee

This commit is contained in:
Jamie Howard 2023-06-21 11:43:16 +01:00
commit 040bd3fe42
1250 changed files with 9439 additions and 9605 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "check-pr-status",
"version": "4.11.0",
"version": "4.11.1",
"main": "dist/index.js",
"license": "MIT",
"private": true,

View File

@ -0,0 +1,306 @@
'use strict';
const { prop } = require('lodash/fp');
const { createTestBuilder } = require('api-tests/builder');
const { createStrapiInstance } = require('api-tests/strapi');
const { createRequest, createAuthRequest } = require('api-tests/request');
const { createUtils } = require('api-tests/utils');
describe('Admin Permissions - Conditions', () => {
let strapi;
let utils;
const builder = createTestBuilder();
const requests = {
public: null,
admin: null,
};
const localTestData = {
models: {
article: {
singularName: 'article',
pluralName: 'articles',
displayName: 'Article',
draftAndPublish: true,
attributes: {
title: {
type: 'string',
},
price: {
type: 'integer',
},
category: {
type: 'relation',
relation: 'manyToOne',
target: 'api::category.category',
},
},
},
category: {
singularName: 'category',
pluralName: 'categories',
displayName: 'Category',
draftAndPublish: true,
attributes: {
name: {
type: 'string',
},
},
},
},
cheapArticle: {
title: 'Cheap Article',
price: 999,
},
expensiveArticle: {
title: 'Expensive Article',
price: 1001,
},
categories: [{ name: 'Cheap' }, { name: 'Expensive' }],
role: {
name: 'foobar',
description: 'A dummy test role',
},
permissions: [
{
action: 'plugin::content-manager.explorer.create',
subject: 'api::article.article',
fields: null,
conditions: [],
},
{
action: 'plugin::content-manager.explorer.update',
subject: 'api::article.article',
fields: null,
conditions: ['plugin::test.cheap-article'],
},
{
action: 'plugin::content-manager.explorer.read',
subject: 'api::article.article',
fields: null,
conditions: ['plugin::test.cheap-article'],
},
{
action: 'plugin::content-manager.explorer.delete',
subject: 'api::article.article',
fields: null,
conditions: ['plugin::test.cheap-article'],
},
{
action: 'plugin::content-manager.explorer.publish',
subject: 'api::article.article',
fields: null,
conditions: ['plugin::test.cheap-article'],
},
],
customConditions: [
{
displayName: 'Custom Condition',
name: 'cheap-article',
plugin: 'test',
handler: () => ({
'category.name': { $eq: 'Cheap' },
}),
},
],
userPassword: 'fooBar42',
users: [{ firstname: 'Alice', lastname: 'Foo', email: 'alice.foo@test.com' }],
};
const createFixtures = async () => {
// Login with admin and init admin tools
requests.admin = await createAuthRequest({ strapi });
requests.public = createRequest({ strapi });
// Create the foobar role
const role = await utils.createRole(localTestData.role);
// Assign permissions to the foobar role
const permissions = await utils.assignPermissionsToRole(role.id, localTestData.permissions);
Object.assign(role, { permissions });
// Create users with the new role & create associated auth requests
const users = [];
for (let i = 0; i < localTestData.users.length; i += 1) {
const userFixture = localTestData.users[i];
const userAttributes = {
...userFixture,
password: localTestData.userPassword,
roles: [role.id],
};
const createdUser = await utils.createUser(userAttributes);
requests[createdUser.id] = await createAuthRequest({ strapi, userInfo: createdUser });
users.push(createdUser);
}
// Create categories
for (const category of localTestData.categories) {
const { body } = await requests.admin({
method: 'POST',
url: `/content-manager/collection-types/api::category.category`,
body: category,
});
category.id = body.id;
}
// Update the local data store
Object.assign(localTestData, { role, permissions, users });
};
const getUserRequest = (idx) => requests[localTestData.users[idx].id];
const deleteFixtures = async () => {
// Delete users
const usersId = localTestData.users.map(prop('id'));
await utils.deleteUsersById(usersId);
// Delete the foobar role
await utils.deleteRolesById([localTestData.role.id]);
};
beforeAll(async () => {
await builder
.addContentType(localTestData.models.category)
.addContentType(localTestData.models.article)
.build();
strapi = await createStrapiInstance({
bootstrap: ({ strapi }) => {
// Create custom conditions
return strapi.admin.services.permission.conditionProvider.registerMany(
localTestData.customConditions
);
},
});
utils = createUtils(strapi);
await createFixtures();
});
afterAll(async () => {
await deleteFixtures();
await strapi.destroy();
await builder.cleanup();
});
test('User can create articles', async () => {
const rq = getUserRequest(0);
const res = await rq({
method: 'POST',
url: `/content-manager/collection-types/api::article.article`,
body: { ...localTestData.cheapArticle, category: localTestData.categories[0].id },
});
const resExpensive = await rq({
method: 'POST',
url: `/content-manager/collection-types/api::article.article`,
body: { ...localTestData.expensiveArticle, category: localTestData.categories[1].id },
});
expect(res.statusCode).toBe(200);
expect(resExpensive.statusCode).toBe(200);
localTestData.cheapArticle.id = res.body.id;
localTestData.expensiveArticle.id = resExpensive.body.id;
});
test('User can read cheap articles', async () => {
const { id } = localTestData.cheapArticle;
const rq = getUserRequest(0);
const res = await rq({
method: 'GET',
url: `/content-manager/collection-types/api::article.article/${id}`,
});
expect(res.statusCode).toBe(200);
expect(res.body).toMatchObject(localTestData.cheapArticle);
});
test('User cannot read expensive articles', async () => {
const { id } = localTestData.expensiveArticle;
const rq = getUserRequest(0);
const res = await rq({
method: 'GET',
url: `/content-manager/collection-types/api::article.article/${id}`,
});
expect(res.statusCode).toBe(403);
});
test('User can update cheap articles', async () => {
const { id } = localTestData.cheapArticle;
const rq = getUserRequest(0);
const res = await rq({
method: 'PUT',
url: `/content-manager/collection-types/api::article.article/${id}`,
body: { ...localTestData.cheapArticle, title: 'New title' },
});
expect(res.statusCode).toBe(200);
expect(res.body).toMatchObject({ ...localTestData.cheapArticle, title: 'New title' });
localTestData.cheapArticle.title = 'New title';
});
test('User cannot update expensive articles', async () => {
const { id } = localTestData.expensiveArticle;
const rq = getUserRequest(0);
const res = await rq({
method: 'PUT',
url: `/content-manager/collection-types/api::article.article/${id}`,
body: { ...localTestData.expensiveArticle, title: 'New title' },
});
expect(res.statusCode).toBe(403);
});
test('User can publish cheap articles', async () => {
const { id } = localTestData.cheapArticle;
const rq = getUserRequest(0);
const res = await rq({
method: 'POST',
url: `/content-manager/collection-types/api::article.article/${id}/actions/publish`,
});
expect(res.statusCode).toBe(200);
expect(res.body).toMatchObject(localTestData.cheapArticle);
});
test('User cannot publish expensive articles', async () => {
const { id } = localTestData.expensiveArticle;
const rq = getUserRequest(0);
const res = await rq({
method: 'POST',
url: `/content-manager/collection-types/api::article.article/${id}/actions/publish`,
});
expect(res.statusCode).toBe(403);
});
test('User can delete cheap articles', async () => {
const { id } = localTestData.cheapArticle;
const rq = getUserRequest(0);
const res = await rq({
method: 'DELETE',
url: `/content-manager/collection-types/api::article.article/${id}`,
});
expect(res.statusCode).toBe(200);
});
test('User cannot delete expensive articles', async () => {
const { id } = localTestData.expensiveArticle;
const rq = getUserRequest(0);
const res = await rq({
method: 'DELETE',
url: `/content-manager/collection-types/api::article.article/${id}`,
});
expect(res.statusCode).toBe(403);
});
});

View File

@ -0,0 +1,56 @@
---
title: useEnterprise
description: API reference for the useEnterprise hook
tags:
- admin
- hooks
- users
---
A hook that returns either community or enterprise-edition data-structures based on the global `window.strapi.isEE` flag.
## Usage
```
import { CE_DATA } from './data';
function Component() {
const data = useEnterprise(CE_DATA, async () => (await import('./ee/data')).default);
}
```
It accepts an optional third argument to pass in options customizing the hook behavior:
### `combine()`
THe `combine` callback can be used as a custom "merge" function for the ce and ee arguments:
```
const data = useEnterprise({ a: 1 }, () => { b: 1 }, { combine(ce, ee) { return { ...ce, ...ee } } });
console.log(data); // { a: 1, b: 1 }
```
### `defaultValue`
By default the hook returns `null` if `window.strapi.isEE` is true and the enterprise data structure is not yet loaded. Customizing
this value can help implementing various loading scenarios:
```
// display a loading state while an EE component is loading
const Component = useEnterprise(() => <p>CE</p>, () => <p>EE</p>, {
defaultValue: () => <div>loading ...</div>
})
// display nothing while an EE component is loading, but don't block the overall rendering
const Component = useEnterprise(() => <p>CE</p>, () => <p>EE</p>, {
defaultValue: () => null
})
// display nothing while an EE component is loading
const Component = useEnterprise(() => <p>CE</p>, () => <p>EE</p>)
if (!Component) {
return;
}
```

View File

@ -1,7 +1,7 @@
{
"name": "getstarted",
"private": true,
"version": "4.11.0",
"version": "4.11.1",
"description": "A Strapi application.",
"scripts": {
"develop": "strapi develop",
@ -13,16 +13,16 @@
},
"dependencies": {
"@strapi/icons": "1.8.0",
"@strapi/plugin-color-picker": "4.11.0",
"@strapi/plugin-documentation": "4.11.0",
"@strapi/plugin-graphql": "4.11.0",
"@strapi/plugin-i18n": "4.11.0",
"@strapi/plugin-sentry": "4.11.0",
"@strapi/plugin-users-permissions": "4.11.0",
"@strapi/provider-email-mailgun": "4.11.0",
"@strapi/provider-upload-aws-s3": "4.11.0",
"@strapi/provider-upload-cloudinary": "4.11.0",
"@strapi/strapi": "4.11.0",
"@strapi/plugin-color-picker": "4.11.1",
"@strapi/plugin-documentation": "4.11.1",
"@strapi/plugin-graphql": "4.11.1",
"@strapi/plugin-i18n": "4.11.1",
"@strapi/plugin-sentry": "4.11.1",
"@strapi/plugin-users-permissions": "4.11.1",
"@strapi/provider-email-mailgun": "4.11.1",
"@strapi/provider-upload-aws-s3": "4.11.1",
"@strapi/provider-upload-cloudinary": "4.11.1",
"@strapi/strapi": "4.11.1",
"better-sqlite3": "8.3.0",
"lodash": "4.17.21",
"mysql": "2.18.1",

View File

@ -1,7 +1,7 @@
{
"name": "kitchensink-ts",
"private": true,
"version": "4.11.0",
"version": "4.11.1",
"description": "A Strapi application",
"scripts": {
"develop": "strapi develop",
@ -10,9 +10,9 @@
"strapi": "strapi"
},
"dependencies": {
"@strapi/plugin-i18n": "4.11.0",
"@strapi/plugin-users-permissions": "4.11.0",
"@strapi/strapi": "4.11.0",
"@strapi/plugin-i18n": "4.11.1",
"@strapi/plugin-users-permissions": "4.11.1",
"@strapi/strapi": "4.11.1",
"better-sqlite3": "8.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",

View File

@ -1,7 +1,7 @@
{
"name": "kitchensink",
"private": true,
"version": "4.11.0",
"version": "4.11.1",
"description": "A Strapi application.",
"scripts": {
"develop": "strapi develop",
@ -12,10 +12,10 @@
"strapi": "strapi"
},
"dependencies": {
"@strapi/provider-email-mailgun": "4.11.0",
"@strapi/provider-upload-aws-s3": "4.11.0",
"@strapi/provider-upload-cloudinary": "4.11.0",
"@strapi/strapi": "4.11.0",
"@strapi/provider-email-mailgun": "4.11.1",
"@strapi/provider-upload-aws-s3": "4.11.1",
"@strapi/provider-upload-cloudinary": "4.11.1",
"@strapi/strapi": "4.11.1",
"lodash": "4.17.21",
"mysql": "2.18.1",
"passport-google-oauth2": "0.2.0",

View File

@ -1,5 +1,5 @@
{
"version": "4.11.0",
"version": "4.11.1",
"packages": ["packages/*", "examples/*"],
"npmClient": "yarn",
"useWorkspaces": true,

View File

@ -104,7 +104,7 @@
"lerna": "6.5.1",
"lint-staged": "13.2.2",
"lodash": "4.17.21",
"nx": "15.9.4",
"nx": "16.3.2",
"plop": "2.7.6",
"prettier": "2.8.4",
"qs": "6.11.1",

View File

@ -1,6 +1,6 @@
{
"name": "@strapi/admin-test-utils",
"version": "4.11.0",
"version": "4.11.1",
"private": true,
"description": "Test utilities for the Strapi administration panel",
"license": "MIT",
@ -42,9 +42,9 @@
"whatwg-fetch": "3.6.2"
},
"devDependencies": {
"eslint-config-custom": "4.11.0",
"eslint-config-custom": "4.11.1",
"redux": "^4.2.1",
"tsconfig": "4.11.0"
"tsconfig": "4.11.1"
},
"peerDependencies": {
"redux": "^4.2.1"

View File

@ -1,9 +1,9 @@
{
"name": "create-strapi-app",
"version": "4.11.0",
"version": "4.11.1",
"description": "Generate a new Strapi application.",
"dependencies": {
"@strapi/generate-new": "4.11.0",
"@strapi/generate-new": "4.11.1",
"commander": "8.3.0",
"inquirer": "8.2.5"
},
@ -49,8 +49,8 @@
"lint": "run -T eslint ."
},
"devDependencies": {
"eslint-config-custom": "4.11.0",
"tsconfig": "4.11.0"
"eslint-config-custom": "4.11.1",
"tsconfig": "4.11.1"
},
"engines": {
"node": ">=14.19.1 <=18.x.x",

View File

@ -1,6 +1,6 @@
{
"name": "create-strapi-starter",
"version": "4.11.0",
"version": "4.11.1",
"description": "Generate a new Strapi application.",
"keywords": [
"create-strapi-starter",
@ -44,7 +44,7 @@
"lint": "run -T eslint ."
},
"dependencies": {
"@strapi/generate-new": "4.11.0",
"@strapi/generate-new": "4.11.1",
"chalk": "4.1.2",
"ci-info": "3.8.0",
"commander": "8.3.0",
@ -54,8 +54,8 @@
"ora": "5.4.1"
},
"devDependencies": {
"eslint-config-custom": "4.11.0",
"tsconfig": "4.11.0"
"eslint-config-custom": "4.11.1",
"tsconfig": "4.11.1"
},
"engines": {
"node": ">=14.19.1 <=18.x.x",

View File

@ -1,27 +1,29 @@
import React from 'react';
import { BrowserRouter } from 'react-router-dom';
import { lightTheme, darkTheme } from '@strapi/design-system';
import { darkTheme, lightTheme } from '@strapi/design-system';
import invariant from 'invariant';
import isFunction from 'lodash/isFunction';
import merge from 'lodash/merge';
import pick from 'lodash/pick';
import isFunction from 'lodash/isFunction';
import invariant from 'invariant';
import { Helmet } from 'react-helmet';
import { basename, createHook } from './core/utils';
import configureStore from './core/store/configureStore';
import { customFields, Plugin } from './core/apis';
import App from './pages/App';
import { BrowserRouter } from 'react-router-dom';
import Logo from './assets/images/logo-strapi-2022.svg';
import localStorageKey from './components/LanguageProvider/utils/localStorageKey';
import Providers from './components/Providers';
import languageNativeNames from './translations/languageNativeNames';
import { customFields, Plugin } from './core/apis';
import configureStore from './core/store/configureStore';
import { basename, createHook } from './core/utils';
import {
INJECT_COLUMN_IN_TABLE,
MUTATE_COLLECTION_TYPES_LINKS,
MUTATE_EDIT_VIEW_LAYOUT,
MUTATE_SINGLE_TYPES_LINKS,
} from './exposedHooks';
import injectionZones from './injectionZones';
import favicon from './favicon.png';
import localStorageKey from './components/LanguageProvider/utils/localStorageKey';
import injectionZones from './injectionZones';
import App from './pages/App';
import languageNativeNames from './translations/languageNativeNames';
class StrapiApp {
constructor({ adminConfig, appPlugins, library, middlewares, reducers }) {

View File

@ -1,18 +1,22 @@
import React, { useState, useEffect } from 'react';
// TODO: DS add loader
import React, { useEffect, useState } from 'react';
import {
AppInfoProvider,
auth,
LoadingIndicatorPage,
AppInfoProvider,
useGuidedTour,
useNotification,
} from '@strapi/helper-plugin';
import { useQueries } from 'react-query';
import get from 'lodash/get';
import { useQueries } from 'react-query';
// TODO: DS add loader
import packageJSON from '../../../../package.json';
import { useConfigurations } from '../../hooks';
import { getFullName, hashAdminUserEmail } from '../../utils';
import PluginsInitializer from '../PluginsInitializer';
import RBACProvider from '../RBACProvider';
import {
fetchAppInfo,
fetchCurrentUserPermissions,
@ -20,7 +24,6 @@ import {
fetchUserRoles,
} from './utils/api';
import checkLatestStrapiVersion from './utils/checkLatestStrapiVersion';
import { getFullName, hashAdminUserEmail } from '../../utils';
const strapiVersion = packageJSON.version;

View File

@ -1,21 +1,23 @@
import React from 'react';
import PropTypes from 'prop-types';
import { render, waitFor } from '@testing-library/react';
import { QueryClientProvider, QueryClient } from 'react-query';
import { darkTheme, lightTheme } from '@strapi/design-system';
import { useGuidedTour } from '@strapi/helper-plugin';
import { lightTheme, darkTheme } from '@strapi/design-system';
import { render, waitFor } from '@testing-library/react';
import PropTypes from 'prop-types';
import { IntlProvider } from 'react-intl';
import { QueryClient, QueryClientProvider } from 'react-query';
import AuthenticatedApp from '..';
import packageJSON from '../../../../../package.json';
import { ConfigurationsContext } from '../../../contexts';
import Theme from '../../Theme';
import ThemeToggleProvider from '../../ThemeToggleProvider';
import {
fetchAppInfo,
fetchCurrentUserPermissions,
fetchStrapiLatestRelease,
fetchUserRoles,
} from '../utils/api';
import packageJSON from '../../../../../package.json';
import Theme from '../../Theme';
import ThemeToggleProvider from '../../ThemeToggleProvider';
import AuthenticatedApp from '..';
const strapiVersion = packageJSON.version;

View File

@ -1,7 +1,9 @@
import { getFetchClient } from '@strapi/helper-plugin';
import checkLatestStrapiVersion from './checkLatestStrapiVersion';
import packageJSON from '../../../../../package.json';
import checkLatestStrapiVersion from './checkLatestStrapiVersion';
const strapiVersion = packageJSON.version;
const showUpdateNotif = !JSON.parse(localStorage.getItem('STRAPI_UPDATE_NOTIF'));
const { get } = getFetchClient();

View File

@ -1,6 +1,9 @@
import React, { useCallback, useMemo, useReducer } from 'react';
import PropTypes from 'prop-types';
import { ConfigurationsContext } from '../../contexts';
import reducer, { initialState } from './reducer';
const ConfigurationsProvider = ({

View File

@ -1,7 +1,9 @@
import React from 'react';
import { render, fireEvent, screen } from '@testing-library/react';
import ConfigurationsProvider from '../index';
import { fireEvent, render, screen } from '@testing-library/react';
import { useConfigurations } from '../../../hooks';
import ConfigurationsProvider from '../index';
describe('ConfigurationsProvider', () => {
it('should not crash', () => {

View File

@ -1,7 +1,8 @@
import * as React from 'react';
import { Box } from '@strapi/design-system';
import PropTypes from 'prop-types';
import { useDragLayer } from 'react-dnd';
import { Box } from '@strapi/design-system';
function getStyle(initialOffset, currentOffset, mouseOffset) {
if (!initialOffset || !currentOffset) {

View File

@ -1,11 +1,13 @@
import React from 'react';
import { useIntl } from 'react-intl';
import PropTypes from 'prop-types';
import { Box, Flex, Typography } from '@strapi/design-system';
import { pxToRem } from '@strapi/helper-plugin';
import { Typography, Box, Flex } from '@strapi/design-system';
import StepNumber from '../../Stepper/StepNumber';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { IS_ACTIVE, IS_DONE, IS_NOT_DONE } from '../../constants';
import StepLine from '../../Stepper/StepLine';
import { IS_DONE, IS_ACTIVE, IS_NOT_DONE } from '../../constants';
import StepNumber from '../../Stepper/StepNumber';
const StepHomepage = ({ type, title, number, content, hasLine }) => {
const { formatMessage } = useIntl();

View File

@ -1,8 +1,11 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Box } from '@strapi/design-system';
import PropTypes from 'prop-types';
import { IS_ACTIVE, IS_DONE, IS_NOT_DONE } from '../../constants';
import StepHomepage from './Step';
import { IS_DONE, IS_ACTIVE, IS_NOT_DONE } from '../../constants';
const getType = (activeSectionIndex, index) => {
if (activeSectionIndex === -1) {

View File

@ -1,7 +1,9 @@
import React from 'react';
import { lightTheme, ThemeProvider } from '@strapi/design-system';
import { render } from '@testing-library/react';
import { IntlProvider } from 'react-intl';
import { ThemeProvider, lightTheme } from '@strapi/design-system';
import Stepper from '../Stepper';
const sections = [

View File

@ -1,11 +1,14 @@
import React from 'react';
import { useGuidedTour, useTracking, LinkButton } from '@strapi/helper-plugin';
import { useIntl } from 'react-intl';
import { Flex, Box, Typography, Button } from '@strapi/design-system';
import { Box, Button, Flex, Typography } from '@strapi/design-system';
import { LinkButton, useGuidedTour, useTracking } from '@strapi/helper-plugin';
import { ArrowRight } from '@strapi/icons';
import StepperHomepage from './components/Stepper';
import { useIntl } from 'react-intl';
import layout from '../layout';
import StepperHomepage from './components/Stepper';
const GuidedTourHomepage = () => {
const { guidedTourState, setSkipped } = useGuidedTour();
const { formatMessage } = useIntl();

View File

@ -1,10 +1,12 @@
import React from 'react';
import { lightTheme, ThemeProvider } from '@strapi/design-system';
import { TrackingProvider, useGuidedTour } from '@strapi/helper-plugin';
import { render, screen } from '@testing-library/react';
import { Router } from 'react-router-dom';
import { createMemoryHistory } from 'history';
import { IntlProvider } from 'react-intl';
import { useGuidedTour, TrackingProvider } from '@strapi/helper-plugin';
import { ThemeProvider, lightTheme } from '@strapi/design-system';
import { Router } from 'react-router-dom';
import GuidedTourHomepage from '../index';
jest.mock('@strapi/helper-plugin', () => ({

View File

@ -1,8 +1,9 @@
import React from 'react';
import { Box, Flex, Typography } from '@strapi/design-system';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { Flex, Box, Typography } from '@strapi/design-system';
import { useIntl } from 'react-intl';
import styled from 'styled-components';
const LiStyled = styled.li`
list-style: disc;

View File

@ -1,10 +1,11 @@
import React from 'react';
import styled from 'styled-components';
import { Box, Button, Flex, FocusTrap, IconButton, Portal } from '@strapi/design-system';
import { pxToRem } from '@strapi/helper-plugin';
import { Cross } from '@strapi/icons';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { pxToRem } from '@strapi/helper-plugin';
import { Portal, FocusTrap, Flex, Box, IconButton, Button } from '@strapi/design-system';
import { Cross } from '@strapi/icons';
import styled from 'styled-components';
const ModalWrapper = styled(Flex)`
position: fixed;

View File

@ -1,6 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Box } from '@strapi/design-system';
import PropTypes from 'prop-types';
import StepNumber from '../../Stepper/StepNumber';
const StepNumberWithPadding = ({ number, last, type }) => (

View File

@ -1,13 +1,16 @@
import React from 'react';
import { Box, Button, Flex, Typography } from '@strapi/design-system';
import { LinkButton, pxToRem } from '@strapi/helper-plugin';
import { ArrowRight } from '@strapi/icons';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { pxToRem, LinkButton } from '@strapi/helper-plugin';
import { Typography, Button, Box, Flex } from '@strapi/design-system';
import { ArrowRight } from '@strapi/icons';
import Content from './Content';
import { IS_ACTIVE, IS_DONE } from '../../constants';
import StepLine from '../../Stepper/StepLine';
import Content from './Content';
import StepNumberWithPadding from './StepNumberWithPadding';
import { IS_DONE, IS_ACTIVE } from '../../constants';
const StepperModal = ({
title,

View File

@ -1,10 +1,13 @@
import React, { useEffect, useState, useReducer } from 'react';
import at from 'lodash/at';
import React, { useEffect, useReducer, useState } from 'react';
import { useGuidedTour, useTracking } from '@strapi/helper-plugin';
import at from 'lodash/at';
import layout from '../layout';
import Modal from './components/Modal';
import reducer, { initialState } from './reducer';
import StepperModal from './components/Stepper';
import reducer, { initialState } from './reducer';
const GuidedTourModal = () => {
const {

View File

@ -1,8 +1,10 @@
import React from 'react';
import { darkTheme, lightTheme } from '@strapi/design-system';
import { useGuidedTour } from '@strapi/helper-plugin';
import { render, screen } from '@testing-library/react';
import { IntlProvider } from 'react-intl';
import { useGuidedTour } from '@strapi/helper-plugin';
import { lightTheme, darkTheme } from '@strapi/design-system';
import Theme from '../../../Theme';
import ThemeToggleProvider from '../../../ThemeToggleProvider';
import GuidedTourModal from '../index';

View File

@ -1,8 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';
import { pxToRem } from '@strapi/helper-plugin';
import { Box } from '@strapi/design-system';
import { IS_DONE, IS_ACTIVE, IS_NOT_DONE } from '../constants';
import { pxToRem } from '@strapi/helper-plugin';
import PropTypes from 'prop-types';
import { IS_ACTIVE, IS_DONE, IS_NOT_DONE } from '../constants';
const StepLine = ({ type, ...props }) => {
return (

View File

@ -1,9 +1,11 @@
import React from 'react';
import PropTypes from 'prop-types';
import { pxToRem } from '@strapi/helper-plugin';
import { Flex, Icon, Typography } from '@strapi/design-system';
import { pxToRem } from '@strapi/helper-plugin';
import { Check } from '@strapi/icons';
import { IS_DONE, IS_ACTIVE, IS_NOT_DONE } from '../constants';
import PropTypes from 'prop-types';
import { IS_ACTIVE, IS_DONE, IS_NOT_DONE } from '../constants';
const StepNumber = ({ type, number }) => {
if (type === IS_DONE) {

View File

@ -1,12 +1,14 @@
import React, { useReducer } from 'react';
import PropTypes from 'prop-types';
import get from 'lodash/get';
import { GuidedTourProvider } from '@strapi/helper-plugin';
import persistStateToLocaleStorage from './utils/persistStateToLocaleStorage';
import get from 'lodash/get';
import PropTypes from 'prop-types';
import init from './init';
import reducer, { initialState } from './reducer';
import arePreviousSectionsDone from './utils/arePreviousSectionsDone';
import arePreviousStepsDone from './utils/arePreviousStepsDone';
import reducer, { initialState } from './reducer';
import init from './init';
import persistStateToLocaleStorage from './utils/persistStateToLocaleStorage';
const GuidedTour = ({ children }) => {
const [{ currentStep, guidedTourState, isGuidedTourVisible, isSkipped }, dispatch] = useReducer(

View File

@ -1,4 +1,5 @@
import set from 'lodash/set';
import persistStateToLocaleStorage, {
COMPLETED_STEPS,
CURRENT_STEP,

View File

@ -1,6 +1,8 @@
import React, { useEffect } from 'react';
import { render, screen, fireEvent } from '@testing-library/react';
import { useGuidedTour } from '@strapi/helper-plugin/';
import { fireEvent, render, screen } from '@testing-library/react';
import GuidedTour from '../index';
describe('GuidedTour', () => {

View File

@ -1,4 +1,5 @@
import cloneDeep from 'lodash/cloneDeep';
import init from '../init';
import { initialState } from '../reducer';

View File

@ -7,13 +7,16 @@
*/
import React, { useEffect, useReducer } from 'react';
import defaultsDeep from 'lodash/defaultsDeep';
import PropTypes from 'prop-types';
import { IntlProvider } from 'react-intl';
import defaultsDeep from 'lodash/defaultsDeep';
import LocalesProvider from '../LocalesProvider';
import localStorageKey from './utils/localStorageKey';
import init from './init';
import reducer, { initialState } from './reducer';
import localStorageKey from './utils/localStorageKey';
const LanguageProvider = ({ children, localeNames, messages }) => {
const [{ locale }, dispatch] = useReducer(reducer, initialState, () => init(localeNames));

View File

@ -1,10 +1,12 @@
import React from 'react';
import { render, screen, fireEvent } from '@testing-library/react';
import { fireEvent, render, screen } from '@testing-library/react';
import { useIntl } from 'react-intl';
import useLocalesProvider from '../../LocalesProvider/useLocalesProvider';
import LanguageProvider from '../index';
import en from '../../../translations/en.json';
import fr from '../../../translations/fr.json';
import useLocalesProvider from '../../LocalesProvider/useLocalesProvider';
import LanguageProvider from '../index';
const messages = { en, fr };
const localeNames = { en: 'English', fr: 'Français' };

View File

@ -1,27 +1,29 @@
import React, { useRef, useState } from 'react';
import styled from 'styled-components';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { NavLink as RouterNavLink, useLocation, useHistory } from 'react-router-dom';
import { Divider, FocusTrap, Box, Typography, Flex } from '@strapi/design-system';
import { Box, Divider, Flex, FocusTrap, Typography } from '@strapi/design-system';
import {
MainNav,
NavBrand,
NavSections,
NavLink,
NavSection,
NavUser,
NavCondense,
NavFooter,
NavLink,
NavSection,
NavSections,
NavUser,
} from '@strapi/design-system/v2';
import { Write, Exit } from '@strapi/icons';
import {
auth,
usePersistentState,
useAppInfo,
useTracking,
getFetchClient,
useAppInfo,
usePersistentState,
useTracking,
} from '@strapi/helper-plugin';
import { Exit, Write } from '@strapi/icons';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { NavLink as RouterNavLink, useHistory, useLocation } from 'react-router-dom';
import styled from 'styled-components';
import { useConfigurations } from '../../hooks';
const LinkUserWrapper = styled(Box)`

View File

@ -1,5 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import LocalesProviderContext from './context';
const LocalesProvider = ({ changeLocale, children, localeNames }) => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import { render } from '@testing-library/react';
import LocalesProvider from '../index';
describe('LocalesProvider', () => {

View File

@ -1,4 +1,5 @@
import { useContext } from 'react';
import LocalesProviderContext from './context';
const useLocalesProvider = () => {

View File

@ -1,5 +1,7 @@
import React, { useReducer, useRef } from 'react';
import { LoadingIndicatorPage, useStrapiApp } from '@strapi/helper-plugin';
import Admin from '../../pages/Admin';
import init from './init';

View File

@ -1,6 +1,8 @@
import React from 'react';
import { StrapiAppProvider } from '@strapi/helper-plugin';
import { render } from '@testing-library/react';
import PluginsInitializer from '../index';
jest.mock('../../../pages/Admin', () => () => {

View File

@ -8,9 +8,10 @@
*/
import React, { memo } from 'react';
import { Redirect, Route, useLocation } from 'react-router-dom';
import PropTypes from 'prop-types';
import { auth } from '@strapi/helper-plugin';
import PropTypes from 'prop-types';
import { Redirect, Route, useLocation } from 'react-router-dom';
/* eslint-disable react/jsx-curly-newline */

View File

@ -1,9 +1,10 @@
import React from 'react';
import { Router, Route, Switch } from 'react-router-dom';
import { createMemoryHistory } from 'history';
import { act, render, screen, waitFor } from '@testing-library/react';
import { auth } from '@strapi/helper-plugin';
import { act, render, screen, waitFor } from '@testing-library/react';
import { createMemoryHistory } from 'history';
import { Route, Router, Switch } from 'react-router-dom';
import PrivateRoute from '..';
const ProtectedPage = () => {

View File

@ -1,21 +1,23 @@
import React from 'react';
import PropTypes from 'prop-types';
import { QueryClientProvider, QueryClient } from 'react-query';
import {
LibraryProvider,
CustomFieldsProvider,
StrapiAppProvider,
AutoReloadOverlayBlockerProvider,
OverlayBlockerProvider,
CustomFieldsProvider,
LibraryProvider,
NotificationsProvider,
OverlayBlockerProvider,
StrapiAppProvider,
} from '@strapi/helper-plugin';
import PropTypes from 'prop-types';
import { QueryClient, QueryClientProvider } from 'react-query';
import { Provider } from 'react-redux';
import { AdminContext } from '../../contexts';
import ConfigurationsProvider from '../ConfigurationsProvider';
import LanguageProvider from '../LanguageProvider';
import GuidedTour from '../GuidedTour';
import ThemeToggleProvider from '../ThemeToggleProvider';
import LanguageProvider from '../LanguageProvider';
import Theme from '../Theme';
import ThemeToggleProvider from '../ThemeToggleProvider';
const queryClient = new QueryClient({
defaultOptions: {

View File

@ -1,7 +1,9 @@
import React, { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { LoadingIndicatorPage, RBACProviderContext } from '@strapi/helper-plugin';
import PropTypes from 'prop-types';
import { useDispatch, useSelector } from 'react-redux';
import { resetStore, setPermissions } from './actions';
const RBACProvider = ({ children, permissions, refetchPermissions }) => {

View File

@ -1,6 +1,6 @@
import { fixtures } from '@strapi/admin-test-utils';
import { setPermissions, resetStore } from '../actions';
import { resetStore, setPermissions } from '../actions';
import rbacProviderReducer, { initialState } from '../reducer';
describe('rbacProviderReducer', () => {

View File

@ -1,7 +1,9 @@
import React from 'react';
import { DesignSystemProvider } from '@strapi/design-system';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { useThemeToggle } from '../../hooks';
import GlobalStyle from '../GlobalStyle';

View File

@ -4,8 +4,10 @@
*
*/
import React, { useState, useMemo, useCallback } from 'react';
import React, { useCallback, useMemo, useState } from 'react';
import PropTypes from 'prop-types';
import { ThemeToggleContext } from '../../contexts';
const THEME_KEY = 'STRAPI_THEME';

View File

@ -1,5 +1,7 @@
import React from 'react';
import styled from 'styled-components';
import { useConfigurations } from '../../hooks';
const Img = styled.img`

View File

@ -1,9 +1,10 @@
import React, { useRef, useState } from 'react';
import { Box, Button } from '@strapi/design-system';
import { FilterListURLQuery, FilterPopoverURLQuery, useTracking } from '@strapi/helper-plugin';
import { Filter } from '@strapi/icons';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { Box, Button } from '@strapi/design-system';
import { Filter } from '@strapi/icons';
import { FilterListURLQuery, FilterPopoverURLQuery, useTracking } from '@strapi/helper-plugin';
const Filters = ({ displayedFilters }) => {
const [isVisible, setIsVisible] = useState(false);

View File

@ -1,5 +1,5 @@
import { findMatchingPermissions, useRBACProvider } from '@strapi/helper-plugin';
import get from 'lodash/get';
import { useRBACProvider, findMatchingPermissions } from '@strapi/helper-plugin';
const NOT_ALLOWED_FILTERS = ['json', 'component', 'media', 'richtext', 'dynamiczone', 'password'];
const TIMESTAMPS = ['createdAt', 'updatedAt'];

View File

@ -1,8 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import useAllowedAttributes from './hooks/useAllowedAttributes';
import Filters from './Filters';
import useAllowedAttributes from './hooks/useAllowedAttributes';
const AttributeFilter = ({ contentType, slug, metadatas }) => {
const { formatMessage } = useIntl();

View File

@ -1,27 +1,23 @@
import { memo, useCallback, useEffect, useMemo, useRef } from 'react';
import { useQueryClient } from 'react-query';
import { useHistory } from 'react-router-dom';
import axios from 'axios';
import get from 'lodash/get';
import {
useTracking,
useNotification,
useQueryParams,
formatContentTypeData,
contentManagementUtilRemoveFieldsFromData,
useGuidedTour,
formatContentTypeData,
useAPIErrorHandler,
useFetchClient,
useGuidedTour,
useNotification,
useQueryParams,
useTracking,
} from '@strapi/helper-plugin';
import { useSelector, useDispatch } from 'react-redux';
import PropTypes from 'prop-types';
import axios from 'axios';
import get from 'lodash/get';
import isEqual from 'lodash/isEqual';
import {
createDefaultForm,
getTrad,
getRequestUrl,
removePasswordFieldsFromData,
} from '../../utils';
import PropTypes from 'prop-types';
import { useQueryClient } from 'react-query';
import { useDispatch, useSelector } from 'react-redux';
import { useHistory } from 'react-router-dom';
import { useFindRedirectionLink } from '../../hooks';
import {
getData,
@ -33,6 +29,12 @@ import {
submitSucceeded,
} from '../../sharedReducers/crudReducer/actions';
import selectCrudReducer from '../../sharedReducers/crudReducer/selectors';
import {
createDefaultForm,
getRequestUrl,
getTrad,
removePasswordFieldsFromData,
} from '../../utils';
// This container is used to handle the CRUD
const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }) => {

View File

@ -1,7 +1,8 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Flex, Icon } from '@strapi/design-system';
import PropTypes from 'prop-types';
import { COMPONENT_ICONS } from './constants';
export function ComponentIcon({ showBackground = true, size = 'M', icon }) {

View File

@ -1,10 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { useIntl } from 'react-intl';
import { PlusCircle } from '@strapi/icons';
import { Box, Flex, Typography } from '@strapi/design-system';
import { pxToRem } from '@strapi/helper-plugin';
import { PlusCircle } from '@strapi/icons';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import styled from 'styled-components';
import { getTrad } from '../../utils';
const IconWrapper = styled.span`

View File

@ -1,13 +1,15 @@
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { Button, Dialog, DialogBody, DialogFooter, Flex, Typography } from '@strapi/design-system';
import { useTracking } from '@strapi/helper-plugin';
import { Check, ExclamationMarkCircle, Trash } from '@strapi/icons';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { useSelector } from 'react-redux';
import { useTracking } from '@strapi/helper-plugin';
import { listViewDomain } from '../../../pages/ListView/selectors';
import { getTrad } from '../../../utils';
import InjectionZoneList from '../../InjectionZoneList';
import { listViewDomain } from '../../../pages/ListView/selectors';
const ConfirmBulkActionDialog = ({ onToggleDialog, isOpen, dialogBody, endAction }) => {
const { formatMessage } = useIntl();

View File

@ -1,8 +1,10 @@
import React from 'react';
import { lightTheme, ThemeProvider } from '@strapi/design-system';
import { render, screen, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { ThemeProvider, lightTheme } from '@strapi/design-system';
import { IntlProvider } from 'react-intl';
import BulkActionsBar from '../index';
jest.mock('@strapi/helper-plugin', () => ({

View File

@ -1,7 +1,7 @@
import parseISO from 'date-fns/parseISO';
import toString from 'lodash/toString';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import toString from 'lodash/toString';
import parseISO from 'date-fns/parseISO';
const CellValue = ({ type, value }) => {
const { formatDate, formatTime, formatNumber } = useIntl();

View File

@ -1,7 +1,8 @@
import React from 'react';
import { Flex, Typography } from '@strapi/design-system';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { Flex, Typography } from '@strapi/design-system';
const Wrapper = styled(Flex)`
position: relative;

View File

@ -1,7 +1,8 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Avatar, Tooltip } from '@strapi/design-system';
import { getFileExtension, prefixFileUrlWithBackendUrl } from '@strapi/helper-plugin';
import PropTypes from 'prop-types';
import FileWrapper from './FileWrapper';

View File

@ -1,6 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import { AvatarGroup } from '@strapi/design-system';
import PropTypes from 'prop-types';
import Media from './Media';
import FileWrapper from './Media/FileWrapper';

View File

@ -1,7 +1,8 @@
import React from 'react';
import { Status, Typography } from '@strapi/design-system';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { Status, Typography } from '@strapi/design-system';
import { getTrad } from '../../../../utils';

View File

@ -1,6 +1,7 @@
import React from 'react';
import { lightTheme, ThemeProvider } from '@strapi/design-system';
import { render } from '@testing-library/react';
import { ThemeProvider, lightTheme } from '@strapi/design-system';
import { IntlProvider } from 'react-intl';
import { PublicationState } from '..';

View File

@ -1,3 +1,5 @@
import React, { useMemo, useState } from 'react';
import {
Badge,
Box,
@ -10,10 +12,10 @@ import {
} from '@strapi/design-system';
import { stopPropagation, useFetchClient } from '@strapi/helper-plugin';
import PropTypes from 'prop-types';
import React, { useMemo, useState } from 'react';
import { useIntl } from 'react-intl';
import { useQuery } from 'react-query';
import styled from 'styled-components';
import { getRequestUrl, getTrad } from '../../../../utils';
import CellValue from '../CellValue';

View File

@ -1,10 +1,11 @@
import React from 'react';
import { render, fireEvent, screen, waitFor } from '@testing-library/react';
import { ThemeProvider, lightTheme } from '@strapi/design-system';
import { IntlProvider } from 'react-intl';
import { QueryClientProvider, QueryClient } from 'react-query';
import { lightTheme, ThemeProvider } from '@strapi/design-system';
import { useFetchClient } from '@strapi/helper-plugin';
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import { IntlProvider } from 'react-intl';
import { QueryClient, QueryClientProvider } from 'react-query';
import RelationMultiple from '../index';
jest.mock('@strapi/helper-plugin', () => ({

View File

@ -1,7 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Typography } from '@strapi/design-system';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import CellValue from '../CellValue';
const TypographyMaxWidth = styled(Typography)`

View File

@ -1,6 +1,7 @@
import React from 'react';
import { lightTheme, ThemeProvider } from '@strapi/design-system';
import { render } from '@testing-library/react';
import { ThemeProvider, lightTheme } from '@strapi/design-system';
import { IntlProvider } from 'react-intl';
import RelationSingle from '../index';

View File

@ -1,9 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { useIntl } from 'react-intl';
import { Badge, Box, Typography, SimpleMenu, MenuItem } from '@strapi/design-system';
import { Badge, Box, MenuItem, SimpleMenu, Typography } from '@strapi/design-system';
import { stopPropagation } from '@strapi/helper-plugin';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import styled from 'styled-components';
import CellValue from '../CellValue';

View File

@ -1,7 +1,8 @@
import React from 'react';
import { Tooltip, Typography } from '@strapi/design-system';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { Tooltip, Typography } from '@strapi/design-system';
import CellValue from '../CellValue';

View File

@ -1,14 +1,16 @@
import React from 'react';
import { Tooltip, Typography } from '@strapi/design-system';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { Typography, Tooltip } from '@strapi/design-system';
import CellValue from './CellValue';
import Media from './Media';
import MultipleMedias from './MultipleMedias';
import RelationMultiple from './RelationMultiple';
import RelationSingle from './RelationSingle';
import RepeatableComponent from './RepeatableComponent';
import SingleComponent from './SingleComponent';
import CellValue from './CellValue';
import hasContent from './utils/hasContent';
import isSingleRelation from './utils/isSingleRelation';

View File

@ -1,4 +1,5 @@
import React from 'react';
import { render } from '@testing-library/react';
import { IntlProvider } from 'react-intl';

View File

@ -1,9 +1,10 @@
import isEmpty from 'lodash/isEmpty';
import isNumber from 'lodash/isNumber';
import isSingleRelation from './isSingleRelation';
import isFieldTypeNumber from '../../../../utils/isFieldTypeNumber';
import isSingleRelation from './isSingleRelation';
export default function hasContent(type, content, metadatas, fieldSchema) {
if (type === 'component') {
const {

View File

@ -1,8 +1,10 @@
import React from 'react';
import { Button, Dialog, DialogBody, DialogFooter, Flex, Typography } from '@strapi/design-system';
import { ExclamationMarkCircle, Trash } from '@strapi/icons';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { Dialog, DialogBody, DialogFooter, Flex, Typography, Button } from '@strapi/design-system';
import { ExclamationMarkCircle, Trash } from '@strapi/icons';
import InjectionZoneList from '../../InjectionZoneList';
const ConfirmDialogDelete = ({ isConfirmButtonLoading, isOpen, onToggleDialog, onConfirm }) => {

View File

@ -1,18 +1,14 @@
import React from 'react';
import { BaseCheckbox, Box, Flex, IconButton, Tbody, Td, Tr } from '@strapi/design-system';
import { onRowClick, stopPropagation, useTracking } from '@strapi/helper-plugin';
import { Duplicate, Pencil, Trash } from '@strapi/icons';
import PropTypes from 'prop-types';
import { Link, useHistory } from 'react-router-dom';
import { useIntl } from 'react-intl';
import { BaseCheckbox, Box, IconButton, Tbody, Td, Tr, Flex } from '@strapi/design-system';
import { Trash, Duplicate, Pencil } from '@strapi/icons';
import { useTracking, stopPropagation, onRowClick } from '@strapi/helper-plugin';
import { usePluginsQueryParams } from '../../../hooks';
import { Link, useHistory } from 'react-router-dom';
import { getFullName } from '../../../../utils';
import { usePluginsQueryParams } from '../../../hooks';
import CellContent from '../CellContent';
const TableRows = ({

View File

@ -1,17 +1,19 @@
import React, { useMemo } from 'react';
import { DynamicTable as Table, useStrapiApp } from '@strapi/helper-plugin';
import getReviewWorkflowsColumns from 'ee_else_ce/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumns';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { DynamicTable as Table, useStrapiApp } from '@strapi/helper-plugin';
import { useSelector } from 'react-redux';
import getReviewWorkflowsColumns from 'ee_else_ce/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumns';
import { INJECT_COLUMN_IN_TABLE } from '../../../exposedHooks';
import { selectDisplayedHeaders } from '../../pages/ListView/selectors';
import { getTrad } from '../../utils';
import TableRows from './TableRows';
import ConfirmDialogDelete from './ConfirmDialogDelete';
import { PublicationState } from './CellContent/PublicationState/PublicationState';
import BulkActionsBar from './BulkActionsBar';
import { PublicationState } from './CellContent/PublicationState/PublicationState';
import ConfirmDialogDelete from './ConfirmDialogDelete';
import TableRows from './TableRows';
const DynamicTable = ({
canCreate,

View File

@ -5,10 +5,11 @@
*/
import React from 'react';
import { BaseButton, Flex, Typography } from '@strapi/design-system';
import { PlusCircle } from '@strapi/icons';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { PlusCircle } from '@strapi/icons';
import { BaseButton, Flex, Typography } from '@strapi/design-system';
export const AddComponentButton = ({ hasError, isDisabled, isOpen, children, onClick }) => {
return (

View File

@ -5,12 +5,12 @@
*/
import React from 'react';
import { Box, Flex, Typography } from '@strapi/design-system';
import { pxToRem } from '@strapi/helper-plugin';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { Box, Typography, Flex } from '@strapi/design-system';
import { pxToRem } from '@strapi/helper-plugin';
import { ComponentIcon } from '../../ComponentIcon';
const ComponentBox = styled(Box)`

View File

@ -1,16 +1,17 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
Accordion,
AccordionToggle,
AccordionContent,
AccordionToggle,
Box,
Flex,
Typography,
} from '@strapi/design-system';
import { pxToRem } from '@strapi/helper-plugin';
import styled from 'styled-components';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import styled from 'styled-components';
import { ComponentIcon } from '../../ComponentIcon';

View File

@ -1,7 +1,8 @@
import React, { useEffect, useState } from 'react';
import { Box, Flex, KeyboardNavigable, Typography } from '@strapi/design-system';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { KeyboardNavigable, Box, Flex, Typography } from '@strapi/design-system';
import { getTrad } from '../../../utils';

View File

@ -1,28 +1,27 @@
import React, { useEffect, useMemo, useState } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { useIntl } from 'react-intl';
import get from 'lodash/get';
import { getEmptyImage } from 'react-dnd-html5-backend';
import {
Accordion,
AccordionToggle,
AccordionContent,
IconButton,
AccordionToggle,
Box,
Flex,
IconButton,
VisuallyHidden,
} from '@strapi/design-system';
import { Menu, MenuItem } from '@strapi/design-system/v2';
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
import { Trash, Drag, More } from '@strapi/icons';
import { Drag, More, Trash } from '@strapi/icons';
import get from 'lodash/get';
import PropTypes from 'prop-types';
import { getEmptyImage } from 'react-dnd-html5-backend';
import { useIntl } from 'react-intl';
import styled from 'styled-components';
import { useContentTypeLayout, useDragAndDrop } from '../../../hooks';
import { composeRefs, getTrad, ItemTypes } from '../../../utils';
import FieldComponent from '../../FieldComponent';
import { ComponentIcon } from '../../ComponentIcon';
import FieldComponent from '../../FieldComponent';
export const DynamicComponent = ({
componentUid,

View File

@ -5,10 +5,11 @@
*/
import React from 'react';
import { useIntl } from 'react-intl';
import PropTypes from 'prop-types';
import { pxToRem } from '@strapi/helper-plugin';
import { Box, Flex, Typography } from '@strapi/design-system';
import { pxToRem } from '@strapi/helper-plugin';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
export const DynamicZoneLabel = ({
label,

View File

@ -1,7 +1,8 @@
import React from 'react';
import { lightTheme, ThemeProvider } from '@strapi/design-system';
import { render as renderRTL } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { ThemeProvider, lightTheme } from '@strapi/design-system';
import { IntlProvider } from 'react-intl';
import { AddComponentButton } from '../AddComponentButton';

View File

@ -1,10 +1,9 @@
import React from 'react';
import { lightTheme, ThemeProvider } from '@strapi/design-system';
import { fireEvent, render } from '@testing-library/react';
import { ThemeProvider, lightTheme } from '@strapi/design-system';
import GlobalStyle from '../../../../../components/GlobalStyle';
import ComponentCard from '../ComponentCard';
describe('ComponentCard', () => {

View File

@ -1,7 +1,8 @@
import React from 'react';
import { lightTheme, ThemeProvider } from '@strapi/design-system';
import { render as renderRTL } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { ThemeProvider, lightTheme } from '@strapi/design-system';
import { IntlProvider } from 'react-intl';
import { ComponentCategory } from '../ComponentCategory';

View File

@ -1,7 +1,8 @@
import React from 'react';
import { lightTheme, ThemeProvider } from '@strapi/design-system';
import { render as renderRTL } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { ThemeProvider, lightTheme } from '@strapi/design-system';
import { IntlProvider } from 'react-intl';
import { ComponentPicker } from '../ComponentPicker';

View File

@ -1,14 +1,15 @@
import React from 'react';
import { render as renderRTL, fireEvent } from '@testing-library/react';
import { lightTheme, ThemeProvider } from '@strapi/design-system';
import { fireEvent, render as renderRTL } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { ThemeProvider, lightTheme } from '@strapi/design-system';
import { IntlProvider } from 'react-intl';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
import { IntlProvider } from 'react-intl';
import { DynamicComponent } from '../DynamicComponent';
import { layoutData, dynamicComponentsByCategory } from './fixtures';
import { dynamicComponentsByCategory, layoutData } from './fixtures';
jest.mock('../../../../hooks', () => ({
...jest.requireActual('../../../../hooks'),

View File

@ -1,9 +1,9 @@
import React from 'react';
import { IntlProvider } from 'react-intl';
import { render as renderRTL } from '@testing-library/react';
import { ThemeProvider, lightTheme, Tooltip } from '@strapi/design-system';
import { lightTheme, ThemeProvider, Tooltip } from '@strapi/design-system';
import { Earth } from '@strapi/icons';
import { render as renderRTL } from '@testing-library/react';
import { IntlProvider } from 'react-intl';
import { DynamicZoneLabel } from '../DynamicZoneLabel';

View File

@ -1,17 +1,17 @@
import React, { useMemo, useState } from 'react';
import PropTypes from 'prop-types';
import { Box, Flex, VisuallyHidden } from '@strapi/design-system';
import { NotAllowedInput, useNotification, useCMEditViewDataManager } from '@strapi/helper-plugin';
import { NotAllowedInput, useCMEditViewDataManager, useNotification } from '@strapi/helper-plugin';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { useContentTypeLayout } from '../../hooks';
import { getTrad } from '../../utils';
import { DynamicComponent } from './components/DynamicComponent';
import { AddComponentButton } from './components/AddComponentButton';
import { DynamicZoneLabel } from './components/DynamicZoneLabel';
import { ComponentPicker } from './components/ComponentPicker';
import { useContentTypeLayout } from '../../hooks';
import { DynamicComponent } from './components/DynamicComponent';
import { DynamicZoneLabel } from './components/DynamicZoneLabel';
const DynamicZone = ({ name, labelAction, fieldSchema, metadatas }) => {
// We cannot use the default props here

View File

@ -1,11 +1,12 @@
import React from 'react';
import { lightTheme, ThemeProvider } from '@strapi/design-system';
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
import { render as renderRTL } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { ThemeProvider, lightTheme } from '@strapi/design-system';
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
import { IntlProvider } from 'react-intl';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
import { IntlProvider } from 'react-intl';
import { DynamicZone } from '../index';

View File

@ -1,37 +1,35 @@
/* eslint-disable react/jsx-no-constructed-context-values */
import React, { useCallback, useEffect, useMemo, useRef, useReducer } from 'react';
import isEmpty from 'lodash/isEmpty';
import cloneDeep from 'lodash/cloneDeep';
import get from 'lodash/get';
import isEqual from 'lodash/isEqual';
import set from 'lodash/set';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { Prompt, Redirect } from 'react-router-dom';
import { flushSync } from 'react-dom';
import { useDispatch, useSelector } from 'react-redux';
import React, { useCallback, useEffect, useMemo, useReducer, useRef } from 'react';
import { Main } from '@strapi/design-system';
import {
LoadingIndicatorPage,
ContentManagerEditViewDataManagerContext,
getAPIInnerErrors,
getYupInnerErrors,
LoadingIndicatorPage,
useNotification,
useOverlayBlocker,
useTracking,
getYupInnerErrors,
getAPIInnerErrors,
} from '@strapi/helper-plugin';
import cloneDeep from 'lodash/cloneDeep';
import get from 'lodash/get';
import isEmpty from 'lodash/isEmpty';
import isEqual from 'lodash/isEqual';
import set from 'lodash/set';
import PropTypes from 'prop-types';
import { flushSync } from 'react-dom';
import { useIntl } from 'react-intl';
import { useDispatch, useSelector } from 'react-redux';
import { Prompt, Redirect } from 'react-router-dom';
import { createYupSchema, getTrad } from '../../utils';
import { usePrev } from '../../hooks';
import { clearSetModifiedDataOnly } from '../../sharedReducers/crudReducer/actions';
import selectCrudReducer from '../../sharedReducers/crudReducer/selectors';
import { createYupSchema, getTrad } from '../../utils';
import reducer, { initialState } from './reducer';
import { cleanData } from './utils';
import { clearSetModifiedDataOnly } from '../../sharedReducers/crudReducer/actions';
import { usePrev } from '../../hooks';
const EditViewDataManagerProvider = ({
allLayoutData,
allowedActions: { canRead, canUpdate },

View File

@ -1,14 +1,15 @@
import { generateNKeysBetween } from 'fractional-indexing';
import produce from 'immer';
import unset from 'lodash/unset';
import cloneDeep from 'lodash/cloneDeep';
import get from 'lodash/get';
import set from 'lodash/set';
import take from 'lodash/take';
import cloneDeep from 'lodash/cloneDeep';
import uniqBy from 'lodash/uniqBy';
import { generateNKeysBetween } from 'fractional-indexing';
import unset from 'lodash/unset';
import { getMaxTempKey } from '../../utils';
import { findAllAndReplace, moveFields } from './utils';
import { getMaxTempKey } from '../../utils';
const initialState = {
componentsDataStructure: {},

View File

@ -1,6 +1,7 @@
import get from 'lodash/get';
import isArray from 'lodash/isArray';
import isObject from 'lodash/isObject';
import { getInitialDataPathUsingTempKeys } from '../../../utils/paths';
/* eslint-disable indent */

View File

@ -1,3 +1,3 @@
export { default as moveFields } from './moveFields';
export { default as cleanData } from './cleanData';
export { findAllAndReplace } from './findAllAndReplace';
export { default as moveFields } from './moveFields';

View File

@ -1,8 +1,9 @@
import React from 'react';
import { Box, Flex, Typography } from '@strapi/design-system';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import styled from 'styled-components';
import { Box, Flex, Typography } from '@strapi/design-system';
const LabelAction = styled(Box)`
svg path {

View File

@ -1,22 +1,23 @@
/* eslint-disable import/no-cycle */
import React, { memo, useMemo } from 'react';
import PropTypes from 'prop-types';
import size from 'lodash/size';
import isEqual from 'lodash/isEqual';
import { useIntl } from 'react-intl';
import { Box, Flex, IconButton } from '@strapi/design-system';
import { NotAllowedInput } from '@strapi/helper-plugin';
import { Trash } from '@strapi/icons';
import { Box, IconButton, Flex } from '@strapi/design-system';
import isEqual from 'lodash/isEqual';
import size from 'lodash/size';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import connect from './utils/connect';
import select from './utils/select';
import Label from './Label';
import { useContentTypeLayout } from '../../hooks';
import { getTrad } from '../../utils';
import ComponentInitializer from '../ComponentInitializer';
import NonRepeatableComponent from '../NonRepeatableComponent';
import RepeatableComponent from '../RepeatableComponent';
import { useContentTypeLayout } from '../../hooks';
import { getTrad } from '../../utils';
import Label from './Label';
import connect from './utils/connect';
import select from './utils/select';
const FieldComponent = ({
addNonRepeatableComponentToField,

View File

@ -1,10 +1,11 @@
import { useMemo } from 'react';
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
import get from 'lodash/get';
import take from 'lodash/take';
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
import { getFieldName } from '../../../utils';
import { useContentTypeLayout } from '../../../hooks';
import { getFieldName } from '../../../utils';
function useSelect({ isFromDynamicZone, name }) {
const {

View File

@ -1,21 +1,22 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Box } from '@strapi/design-system';
import { useCustomFields } from '@strapi/helper-plugin';
import {
Date,
Boolean,
Component,
Date,
DynamicZone,
Email,
Enumeration,
Json,
Media,
Number,
Relation,
Text,
Uid,
Number,
Json,
Component,
DynamicZone,
} from '@strapi/icons';
import PropTypes from 'prop-types';
const iconByTypes = {
biginteger: <Number />,

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