@strapi/admin 4.5.0 → 4.5.2
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/components/LeftMenu/index.js +22 -4
- package/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js +4 -3
- package/admin/src/content-manager/components/DynamicZone/components/{AddComponentButton/index.js → AddComponentButton.js} +12 -6
- package/admin/src/content-manager/components/DynamicZone/components/{ComponentPicker/Category/ComponentCard/index.js → ComponentCard.js} +8 -19
- package/admin/src/content-manager/components/DynamicZone/components/{ComponentPicker/Category/index.js → ComponentCategory.js} +19 -18
- package/admin/src/content-manager/components/DynamicZone/components/{ComponentPicker/index.js → ComponentPicker.js} +36 -38
- package/admin/src/content-manager/components/DynamicZone/components/DynamicComponent.js +195 -0
- package/admin/src/content-manager/components/DynamicZone/components/{DzLabel/index.js → DynamicZoneLabel.js} +13 -5
- package/admin/src/content-manager/components/DynamicZone/index.js +33 -118
- package/admin/src/content-manager/pages/ListSettingsView/components/Settings.js +79 -76
- package/admin/src/pages/HomePage/index.js +1 -1
- package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/FilterSelect.js +2 -1
- package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/index.js +1 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormApiTokenContainer/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormBody/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormHead/index.js +1 -1
- package/admin/src/translations/nl.json +210 -23
- package/admin/src/translations/pt-BR.json +14 -14
- package/admin/src/translations/pt.json +33 -32
- package/admin/src/translations/sv.json +117 -85
- package/admin/src/translations/zh.json +280 -95
- package/build/{7692.a36fb2c2.chunk.js → 1233.bddaaa76.chunk.js} +144 -445
- package/build/1920.208c77f8.chunk.js +245 -0
- package/build/2438.afe24949.chunk.js +2525 -0
- package/build/2517.5cc235ba.chunk.js +117 -0
- package/build/4306.e62b841c.chunk.js +98 -0
- package/build/4318.7931eee7.chunk.js +30 -0
- package/build/4986.3820d11d.chunk.js +145 -0
- package/build/{8469.41c8d25f.chunk.js → 5015.f080b64e.chunk.js} +6 -1
- package/build/504.9aeff724.chunk.js +758 -0
- package/build/805.a1894307.chunk.js +138 -0
- package/build/8633.8da5488a.chunk.js +1 -0
- package/build/9707.932a3c12.chunk.js +70 -0
- package/build/Admin-authenticatedApp.7484bdf1.chunk.js +80 -0
- package/build/Admin_InternalErrorPage.e0317a5e.chunk.js +1 -0
- package/build/Admin_homePage.54e33c2d.chunk.js +77 -0
- package/build/Admin_marketplace.ff012eb2.chunk.js +26 -0
- package/build/Admin_pluginsPage.3c872de7.chunk.js +6 -0
- package/build/Admin_profilePage.e9fcce92.chunk.js +15 -0
- package/build/Admin_settingsPage.a1a5218b.chunk.js +178 -0
- package/build/admin-app.9cb0abc7.chunk.js +112 -0
- package/build/admin-edit-roles-page.23f15909.chunk.js +1 -0
- package/build/admin-edit-users.283b49ed.chunk.js +10 -0
- package/build/admin-users.a0748674.chunk.js +11 -0
- package/build/api-tokens-list-page.700e575f.chunk.js +16 -0
- package/build/content-manager.577fddcb.chunk.js +1200 -0
- package/build/content-type-builder-list-view.95012cf0.chunk.js +201 -0
- package/build/content-type-builder-translation-pt-BR-json.6fe3b8d1.chunk.js +1 -0
- package/build/content-type-builder-translation-pt-json.96a31576.chunk.js +1 -0
- package/build/content-type-builder-translation-zh-json.3b0afd31.chunk.js +1 -0
- package/build/content-type-builder.95b9d6a2.chunk.js +145 -0
- package/build/email-settings-page.4bb3606f.chunk.js +15 -0
- package/build/email-translation-en-json.ebad8943.chunk.js +1 -0
- package/build/email-translation-pt-json.159505ab.chunk.js +1 -0
- package/build/email-translation-zh-json.62b1c6fe.chunk.js +1 -0
- package/build/i18n-settings-page.195d42fe.chunk.js +1 -0
- package/build/i18n-translation-zh-json.eeebb849.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/main.23670c4c.js +2026 -0
- package/build/nl-json.26f39180.chunk.js +1 -0
- package/build/pt-BR-json.2b72b1d6.chunk.js +1 -0
- package/build/pt-json.cd67ba86.chunk.js +1 -0
- package/build/runtime~main.4dc8c7c6.js +2 -0
- package/build/sso-settings-page.9f091262.chunk.js +1 -0
- package/build/sv-json.fb1081ff.chunk.js +1 -0
- package/build/upload-settings.3010911f.chunk.js +18 -0
- package/build/upload-translation-pt-json.5c452b48.chunk.js +1 -0
- package/build/upload-translation-zh-json.ac5711de.chunk.js +1 -0
- package/build/upload.9f19f2e8.chunk.js +64 -0
- package/build/users-advanced-settings-page.9df41d67.chunk.js +13 -0
- package/build/users-email-settings-page.56d82eaf.chunk.js +28 -0
- package/build/users-permissions-translation-sv-json.d5d11648.chunk.js +1 -0
- package/build/users-permissions-translation-zh-json.92f406f9.chunk.js +1 -0
- package/build/users-providers-settings-page.96bb7da0.chunk.js +33 -0
- package/build/users-roles-settings-page.445e5e16.chunk.js +30 -0
- package/build/webhook-edit-page.3285abc4.chunk.js +75 -0
- package/build/webhook-list-page.b87821f2.chunk.js +42 -0
- package/build/zh-json.2ecc6b99.chunk.js +1 -0
- package/jest.config.front.js +0 -1
- package/package.json +17 -16
- package/server/content-types/api-token.js +1 -1
- package/webpack.alias.js +3 -2
- package/webpack.config.js +13 -1
- package/admin/src/content-manager/components/DynamicZone/components/Component/Rectangle.js +0 -19
- package/admin/src/content-manager/components/DynamicZone/components/Component/index.js +0 -191
- package/admin/src/content-manager/icons/Bold/index.js +0 -22
- package/admin/src/content-manager/icons/Code/index.js +0 -13
- package/admin/src/content-manager/icons/Cross/index.js +0 -28
- package/admin/src/content-manager/icons/Italic/index.js +0 -23
- package/admin/src/content-manager/icons/Link/index.js +0 -21
- package/admin/src/content-manager/icons/Media/index.js +0 -14
- package/admin/src/content-manager/icons/Na/index.js +0 -39
- package/admin/src/content-manager/icons/Ol/index.js +0 -13
- package/admin/src/content-manager/icons/Quote/index.js +0 -13
- package/admin/src/content-manager/icons/Striked/index.js +0 -24
- package/admin/src/content-manager/icons/Ul/index.js +0 -15
- package/admin/src/content-manager/icons/Underline/index.js +0 -22
- package/build/1856.172d5fa0.chunk.js +0 -174
- package/build/2077.058590f4.chunk.js +0 -206
- package/build/2912.2c42c07b.chunk.js +0 -259
- package/build/4318.5e670740.chunk.js +0 -30
- package/build/4715.22747b59.chunk.js +0 -387
- package/build/4800.a6935af6.chunk.js +0 -1
- package/build/4982.1b75ddb1.chunk.js +0 -325
- package/build/6925.f5c8b6fc.chunk.js +0 -761
- package/build/7379.d246dd38.chunk.js +0 -1
- package/build/7841.c50e9509.chunk.js +0 -259
- package/build/7866.ba215f99.chunk.js +0 -505
- package/build/8380.e53e7207.chunk.js +0 -299
- package/build/8549.832ed79d.chunk.js +0 -159
- package/build/8738.0fe8a61e.chunk.js +0 -463
- package/build/9066.eaf76ff3.chunk.js +0 -101
- package/build/9166.90876521.chunk.js +0 -342
- package/build/9420.5292d1d2.chunk.js +0 -505
- package/build/9649.468667d9.chunk.js +0 -199
- package/build/Admin-authenticatedApp.c4f68103.chunk.js +0 -80
- package/build/Admin_InternalErrorPage.12e24216.chunk.js +0 -1
- package/build/Admin_homePage.26d32e30.chunk.js +0 -72
- package/build/Admin_marketplace.32375885.chunk.js +0 -22
- package/build/Admin_pluginsPage.4d59785a.chunk.js +0 -1
- package/build/Admin_profilePage.da32abbc.chunk.js +0 -15
- package/build/Admin_settingsPage.bf2234e1.chunk.js +0 -178
- package/build/admin-app.9049056c.chunk.js +0 -112
- package/build/admin-edit-roles-page.69d9fcb2.chunk.js +0 -1
- package/build/admin-edit-users.c585212f.chunk.js +0 -10
- package/build/admin-users.d71f198a.chunk.js +0 -11
- package/build/api-tokens-list-page.bb36535f.chunk.js +0 -16
- package/build/content-manager.ff998bed.chunk.js +0 -1204
- package/build/content-type-builder-list-view.5b3cd768.chunk.js +0 -194
- package/build/content-type-builder-translation-pt-BR-json.d6c7fcc1.chunk.js +0 -1
- package/build/content-type-builder-translation-pt-json.766bd747.chunk.js +0 -1
- package/build/content-type-builder-translation-zh-json.2cc55621.chunk.js +0 -1
- package/build/content-type-builder.16af63a6.chunk.js +0 -145
- package/build/email-settings-page.c3469093.chunk.js +0 -103
- package/build/email-translation-en-json.3d74ff95.chunk.js +0 -1
- package/build/email-translation-pt-json.959ea070.chunk.js +0 -1
- package/build/email-translation-zh-json.3455468b.chunk.js +0 -1
- package/build/i18n-settings-page.46d894ff.chunk.js +0 -101
- package/build/main.91328e7a.js +0 -9381
- package/build/nl-json.2b8cc3a0.chunk.js +0 -1
- package/build/pt-BR-json.7852f808.chunk.js +0 -1
- package/build/pt-json.3161ca22.chunk.js +0 -1
- package/build/runtime~main.c9c319c0.js +0 -2
- package/build/sso-settings-page.9ceb0140.chunk.js +0 -1
- package/build/sv-json.8e5a7911.chunk.js +0 -1
- package/build/upload-settings.53b690f3.chunk.js +0 -101
- package/build/upload-translation-zh-json.ee8fba96.chunk.js +0 -1
- package/build/upload.7084cea6.chunk.js +0 -7
- package/build/users-advanced-settings-page.3f4ee86e.chunk.js +0 -101
- package/build/users-email-settings-page.73c41236.chunk.js +0 -1
- package/build/users-permissions-translation-sv-json.83c60841.chunk.js +0 -1
- package/build/users-permissions-translation-zh-json.e03ae2a4.chunk.js +0 -1
- package/build/users-providers-settings-page.f8e78537.chunk.js +0 -1
- package/build/users-roles-settings-page.b33ec5e5.chunk.js +0 -30
- package/build/webhook-edit-page.dc9442ce.chunk.js +0 -23
- package/build/webhook-list-page.02191138.chunk.js +0 -134
- package/build/zh-json.608aaf24.chunk.js +0 -1
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
import React, { memo,
|
|
1
|
+
import React, { memo, useMemo, useState } from 'react';
|
|
2
2
|
import get from 'lodash/get';
|
|
3
3
|
import isEqual from 'react-fast-compare';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { Stack } from '@strapi/design-system/Stack';
|
|
6
6
|
import { Box } from '@strapi/design-system/Box';
|
|
7
7
|
import { NotAllowedInput, useNotification } from '@strapi/helper-plugin';
|
|
8
|
+
|
|
8
9
|
import { getTrad } from '../../utils';
|
|
10
|
+
|
|
9
11
|
import connect from './utils/connect';
|
|
10
12
|
import select from './utils/select';
|
|
11
|
-
import AddComponentButton from './components/AddComponentButton';
|
|
12
|
-
import DzLabel from './components/DzLabel';
|
|
13
|
-
import Component from './components/Component';
|
|
14
13
|
|
|
14
|
+
import DynamicZoneComponent from './components/DynamicComponent';
|
|
15
|
+
import AddComponentButton from './components/AddComponentButton';
|
|
16
|
+
import DynamicZoneLabel from './components/DynamicZoneLabel';
|
|
15
17
|
import ComponentPicker from './components/ComponentPicker';
|
|
16
|
-
import { useContentTypeLayout } from '../../hooks';
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const createCollapses = (arrayLength) =>
|
|
21
|
-
Array.from({ length: arrayLength }).map(() => ({ isOpen: false }));
|
|
19
|
+
import { useContentTypeLayout } from '../../hooks';
|
|
22
20
|
|
|
23
21
|
const DynamicZone = ({
|
|
24
22
|
name,
|
|
@@ -36,39 +34,16 @@ const DynamicZone = ({
|
|
|
36
34
|
fieldSchema,
|
|
37
35
|
metadatas,
|
|
38
36
|
}) => {
|
|
37
|
+
const [addComponentIsOpen, setAddComponentIsOpen] = useState(false);
|
|
38
|
+
|
|
39
39
|
const toggleNotification = useNotification();
|
|
40
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
41
|
-
const [shouldOpenAddedComponent, setShouldOpenAddedComponent] = useState(false);
|
|
42
40
|
const { getComponentLayout, components } = useContentTypeLayout();
|
|
41
|
+
|
|
43
42
|
const dynamicDisplayedComponentsLength = dynamicDisplayedComponents.length;
|
|
44
43
|
const intlDescription = metadatas.description
|
|
45
44
|
? { id: metadatas.description, defaultMessage: metadatas.description }
|
|
46
45
|
: null;
|
|
47
46
|
|
|
48
|
-
const [componentCollapses, setComponentsCollapses] = useState(
|
|
49
|
-
createCollapses(dynamicDisplayedComponentsLength)
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
setComponentsCollapses(createCollapses(dynamicDisplayedComponentsLength));
|
|
54
|
-
}, [dynamicDisplayedComponentsLength]);
|
|
55
|
-
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
if (shouldOpenAddedComponent) {
|
|
58
|
-
setComponentsCollapses((prev) =>
|
|
59
|
-
prev.map((collapse, index) => {
|
|
60
|
-
if (index === prev.length - 1) {
|
|
61
|
-
return { ...collapse, isOpen: true };
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return collapse;
|
|
65
|
-
})
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
setShouldOpenAddedComponent(false);
|
|
69
|
-
}
|
|
70
|
-
}, [shouldOpenAddedComponent]);
|
|
71
|
-
|
|
72
47
|
// We cannot use the default props here
|
|
73
48
|
const { max = Infinity, min = -Infinity } = fieldSchema;
|
|
74
49
|
const dynamicZoneErrors = useMemo(() => {
|
|
@@ -79,8 +54,6 @@ const DynamicZone = ({
|
|
|
79
54
|
.map((key) => formErrors[key]);
|
|
80
55
|
}, [formErrors, name]);
|
|
81
56
|
|
|
82
|
-
const dynamicZoneAvailableComponents = useMemo(() => fieldSchema.components || [], [fieldSchema]);
|
|
83
|
-
|
|
84
57
|
const missingComponentNumber = min - dynamicDisplayedComponentsLength;
|
|
85
58
|
const hasError = dynamicZoneErrors.length > 0;
|
|
86
59
|
|
|
@@ -90,21 +63,17 @@ const DynamicZone = ({
|
|
|
90
63
|
const hasMaxError =
|
|
91
64
|
hasError && get(dynamicZoneErrors, [0, 'id'], '') === 'components.Input.error.validation.max';
|
|
92
65
|
|
|
93
|
-
const handleAddComponent =
|
|
94
|
-
(
|
|
95
|
-
setIsOpen(false);
|
|
66
|
+
const handleAddComponent = (componentUid) => {
|
|
67
|
+
setAddComponentIsOpen(false);
|
|
96
68
|
|
|
97
|
-
|
|
69
|
+
const componentLayoutData = getComponentLayout(componentUid);
|
|
98
70
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
},
|
|
102
|
-
[addComponentToDynamicZone, hasError, name, components, getComponentLayout]
|
|
103
|
-
);
|
|
71
|
+
addComponentToDynamicZone(name, componentLayoutData, components, hasError);
|
|
72
|
+
};
|
|
104
73
|
|
|
105
74
|
const handleClickOpenPicker = () => {
|
|
106
75
|
if (dynamicDisplayedComponentsLength < max) {
|
|
107
|
-
|
|
76
|
+
setAddComponentIsOpen((prev) => !prev);
|
|
108
77
|
} else {
|
|
109
78
|
toggleNotification({
|
|
110
79
|
type: 'info',
|
|
@@ -113,68 +82,19 @@ const DynamicZone = ({
|
|
|
113
82
|
}
|
|
114
83
|
};
|
|
115
84
|
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
prev.map(({ isOpen }, index) => {
|
|
119
|
-
if (index === indexToToggle) {
|
|
120
|
-
return { isOpen: !isOpen };
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return { isOpen };
|
|
124
|
-
})
|
|
125
|
-
);
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const handleMoveComponentDown = (name, currentIndex) => {
|
|
129
|
-
moveComponentDown(name, currentIndex);
|
|
130
|
-
setComponentsCollapses((prev) => {
|
|
131
|
-
return prev.map(({ isOpen }, index, refArray) => {
|
|
132
|
-
if (index === currentIndex + 1) {
|
|
133
|
-
return { isOpen: refArray[currentIndex].isOpen };
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (index === currentIndex) {
|
|
137
|
-
return { isOpen: refArray[index + 1].isOpen };
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return { isOpen };
|
|
141
|
-
});
|
|
142
|
-
});
|
|
85
|
+
const handleMoveComponentDown = (name, componentIndex) => () => {
|
|
86
|
+
moveComponentDown(name, componentIndex);
|
|
143
87
|
};
|
|
144
88
|
|
|
145
|
-
const handleMoveComponentUp = (name,
|
|
146
|
-
moveComponentUp(name,
|
|
147
|
-
setComponentsCollapses((prev) => {
|
|
148
|
-
return prev.map(({ isOpen }, index, refArray) => {
|
|
149
|
-
if (index === currentIndex - 1) {
|
|
150
|
-
return { isOpen: refArray[currentIndex].isOpen };
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (index === currentIndex) {
|
|
154
|
-
return { isOpen: refArray[index - 1].isOpen };
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return { isOpen };
|
|
158
|
-
});
|
|
159
|
-
});
|
|
89
|
+
const handleMoveComponentUp = (name, componentIndex) => () => {
|
|
90
|
+
moveComponentUp(name, componentIndex);
|
|
160
91
|
};
|
|
161
92
|
|
|
162
|
-
const handleRemoveComponent = (name, currentIndex) => {
|
|
93
|
+
const handleRemoveComponent = (name, currentIndex) => () => {
|
|
163
94
|
removeComponentFromDynamicZone(name, currentIndex);
|
|
164
95
|
};
|
|
165
96
|
|
|
166
|
-
if (!isFieldAllowed && isCreatingEntry) {
|
|
167
|
-
return (
|
|
168
|
-
<NotAllowedInput
|
|
169
|
-
description={intlDescription}
|
|
170
|
-
intlLabel={{ id: metadatas.label, defaultMessage: metadatas.label }}
|
|
171
|
-
labelAction={labelAction}
|
|
172
|
-
name={name}
|
|
173
|
-
/>
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (!isFieldAllowed && !isFieldReadable && !isCreatingEntry) {
|
|
97
|
+
if (!isFieldAllowed && (isCreatingEntry || (!isFieldReadable && !isCreatingEntry))) {
|
|
178
98
|
return (
|
|
179
99
|
<NotAllowedInput
|
|
180
100
|
description={intlDescription}
|
|
@@ -189,7 +109,7 @@ const DynamicZone = ({
|
|
|
189
109
|
<Stack spacing={6}>
|
|
190
110
|
{dynamicDisplayedComponentsLength > 0 && (
|
|
191
111
|
<Box>
|
|
192
|
-
<
|
|
112
|
+
<DynamicZoneLabel
|
|
193
113
|
intlDescription={intlDescription}
|
|
194
114
|
label={metadatas.label}
|
|
195
115
|
labelAction={labelAction}
|
|
@@ -198,26 +118,21 @@ const DynamicZone = ({
|
|
|
198
118
|
required={fieldSchema.required || false}
|
|
199
119
|
/>
|
|
200
120
|
{dynamicDisplayedComponents.map((componentUid, index) => {
|
|
201
|
-
const showDownIcon =
|
|
202
|
-
|
|
203
|
-
dynamicDisplayedComponentsLength > 0 &&
|
|
204
|
-
index < dynamicDisplayedComponentsLength - 1;
|
|
205
|
-
const showUpIcon = isFieldAllowed && dynamicDisplayedComponentsLength > 0 && index > 0;
|
|
206
|
-
const isOpen = componentCollapses[index]?.isOpen || false;
|
|
121
|
+
const showDownIcon = isFieldAllowed && index < dynamicDisplayedComponentsLength - 1;
|
|
122
|
+
const showUpIcon = isFieldAllowed && index > 0;
|
|
207
123
|
|
|
208
124
|
return (
|
|
209
|
-
<
|
|
125
|
+
<DynamicZoneComponent
|
|
210
126
|
componentUid={componentUid}
|
|
211
127
|
formErrors={formErrors}
|
|
128
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
212
129
|
key={index}
|
|
213
130
|
index={index}
|
|
214
|
-
isOpen={isOpen}
|
|
215
131
|
isFieldAllowed={isFieldAllowed}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
onToggle={handleToggleComponent}
|
|
132
|
+
onMoveComponentDownClick={handleMoveComponentDown(name, index)}
|
|
133
|
+
onMoveComponentUpClick={handleMoveComponentUp(name, index)}
|
|
219
134
|
name={name}
|
|
220
|
-
|
|
135
|
+
onRemoveComponentClick={handleRemoveComponent(name, index)}
|
|
221
136
|
showDownIcon={showDownIcon}
|
|
222
137
|
showUpIcon={showUpIcon}
|
|
223
138
|
/>
|
|
@@ -233,13 +148,13 @@ const DynamicZone = ({
|
|
|
233
148
|
isDisabled={!isFieldAllowed}
|
|
234
149
|
label={metadatas.label}
|
|
235
150
|
missingComponentNumber={missingComponentNumber}
|
|
236
|
-
isOpen={
|
|
151
|
+
isOpen={addComponentIsOpen}
|
|
237
152
|
name={name}
|
|
238
153
|
onClick={handleClickOpenPicker}
|
|
239
154
|
/>
|
|
240
155
|
<ComponentPicker
|
|
241
|
-
isOpen={
|
|
242
|
-
components={
|
|
156
|
+
isOpen={addComponentIsOpen}
|
|
157
|
+
components={fieldSchema.components ?? []}
|
|
243
158
|
onClickAddComponent={handleAddComponent}
|
|
244
159
|
/>
|
|
245
160
|
</Stack>
|
|
@@ -1,92 +1,95 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
3
|
import { useIntl } from 'react-intl';
|
|
5
|
-
import {
|
|
4
|
+
import { Box } from '@strapi/design-system/Box';
|
|
6
5
|
import { Grid, GridItem } from '@strapi/design-system/Grid';
|
|
7
6
|
import { Select, Option } from '@strapi/design-system/Select';
|
|
8
7
|
import { ToggleInput } from '@strapi/design-system/ToggleInput';
|
|
9
|
-
import {
|
|
8
|
+
import { Stack } from '@strapi/design-system/Stack';
|
|
10
9
|
import { Typography } from '@strapi/design-system/Typography';
|
|
11
10
|
import { getTrad } from '../../../utils';
|
|
12
11
|
|
|
13
|
-
const FlexGap = styled(Flex)`
|
|
14
|
-
gap: ${({ theme }) => theme.spaces[4]};
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
12
|
const Settings = ({ modifiedData, onChange, sortOptions }) => {
|
|
18
13
|
const { formatMessage } = useIntl();
|
|
19
14
|
const { settings, metadatas } = modifiedData;
|
|
20
15
|
|
|
21
16
|
return (
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
17
|
+
<Stack spacing={4}>
|
|
18
|
+
<Typography variant="delta" as="h2">
|
|
19
|
+
{formatMessage({
|
|
20
|
+
id: getTrad('containers.SettingPage.settings'),
|
|
21
|
+
defaultMessage: 'Settings',
|
|
22
|
+
})}
|
|
23
|
+
</Typography>
|
|
24
|
+
|
|
25
|
+
<Stack horizontal justifyContent="space-between" spacing={4}>
|
|
26
|
+
<Box width="100%">
|
|
27
|
+
<ToggleInput
|
|
28
|
+
label={formatMessage({
|
|
29
|
+
id: getTrad('form.Input.search'),
|
|
30
|
+
defaultMessage: 'Enable search',
|
|
31
|
+
})}
|
|
32
|
+
onChange={(e) => {
|
|
33
|
+
onChange({ target: { name: 'settings.searchable', value: e.target.checked } });
|
|
34
|
+
}}
|
|
35
|
+
onLabel={formatMessage({
|
|
36
|
+
id: 'app.components.ToggleCheckbox.on-label',
|
|
37
|
+
defaultMessage: 'on',
|
|
38
|
+
})}
|
|
39
|
+
offLabel={formatMessage({
|
|
40
|
+
id: 'app.components.ToggleCheckbox.off-label',
|
|
41
|
+
defaultMessage: 'off',
|
|
42
|
+
})}
|
|
43
|
+
name="settings.searchable"
|
|
44
|
+
checked={settings.searchable}
|
|
45
|
+
/>
|
|
46
|
+
</Box>
|
|
47
|
+
|
|
48
|
+
<Box width="100%">
|
|
49
|
+
<ToggleInput
|
|
50
|
+
label={formatMessage({
|
|
51
|
+
id: getTrad('form.Input.filters'),
|
|
52
|
+
defaultMessage: 'Enable filters',
|
|
53
|
+
})}
|
|
54
|
+
onChange={(e) => {
|
|
55
|
+
onChange({ target: { name: 'settings.filterable', value: e.target.checked } });
|
|
56
|
+
}}
|
|
57
|
+
onLabel={formatMessage({
|
|
58
|
+
id: 'app.components.ToggleCheckbox.on-label',
|
|
59
|
+
defaultMessage: 'on',
|
|
60
|
+
})}
|
|
61
|
+
offLabel={formatMessage({
|
|
62
|
+
id: 'app.components.ToggleCheckbox.off-label',
|
|
63
|
+
defaultMessage: 'off',
|
|
64
|
+
})}
|
|
65
|
+
name="settings.filterable"
|
|
66
|
+
checked={settings.filterable}
|
|
67
|
+
/>
|
|
68
|
+
</Box>
|
|
69
|
+
|
|
70
|
+
<Box width="100%">
|
|
71
|
+
<ToggleInput
|
|
72
|
+
label={formatMessage({
|
|
73
|
+
id: getTrad('form.Input.bulkActions'),
|
|
74
|
+
defaultMessage: 'Enable bulk actions',
|
|
75
|
+
})}
|
|
76
|
+
onChange={(e) => {
|
|
77
|
+
onChange({ target: { name: 'settings.bulkable', value: e.target.checked } });
|
|
78
|
+
}}
|
|
79
|
+
onLabel={formatMessage({
|
|
80
|
+
id: 'app.components.ToggleCheckbox.on-label',
|
|
81
|
+
defaultMessage: 'on',
|
|
82
|
+
})}
|
|
83
|
+
offLabel={formatMessage({
|
|
84
|
+
id: 'app.components.ToggleCheckbox.off-label',
|
|
85
|
+
defaultMessage: 'off',
|
|
86
|
+
})}
|
|
87
|
+
name="settings.bulkable"
|
|
88
|
+
checked={settings.bulkable}
|
|
89
|
+
/>
|
|
90
|
+
</Box>
|
|
91
|
+
</Stack>
|
|
92
|
+
|
|
90
93
|
<Grid gap={4}>
|
|
91
94
|
<GridItem s={12} col={6}>
|
|
92
95
|
<Select
|
|
@@ -145,7 +148,7 @@ const Settings = ({ modifiedData, onChange, sortOptions }) => {
|
|
|
145
148
|
</Select>
|
|
146
149
|
</GridItem>
|
|
147
150
|
</Grid>
|
|
148
|
-
|
|
151
|
+
</Stack>
|
|
149
152
|
);
|
|
150
153
|
};
|
|
151
154
|
|
|
@@ -32,7 +32,7 @@ const LogoContainer = styled(Box)`
|
|
|
32
32
|
`;
|
|
33
33
|
|
|
34
34
|
const HomePage = () => {
|
|
35
|
-
//
|
|
35
|
+
// Temporary until we develop the menu API
|
|
36
36
|
const { collectionTypes, singleTypes, isLoading: isLoadingForModels } = useModels();
|
|
37
37
|
const { guidedTourState, isGuidedTourVisible, isSkipped } = useGuidedTour();
|
|
38
38
|
|
|
@@ -9,6 +9,7 @@ const FilterSelect = ({ message, value, onChange, possibleFilters, onClear, cust
|
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
11
|
<Select
|
|
12
|
+
data-testid={`${message}-button`}
|
|
12
13
|
aria-label={message}
|
|
13
14
|
placeholder={message}
|
|
14
15
|
size="M"
|
|
@@ -20,7 +21,7 @@ const FilterSelect = ({ message, value, onChange, possibleFilters, onClear, cust
|
|
|
20
21
|
>
|
|
21
22
|
{Object.entries(possibleFilters).map(([filterName, count]) => {
|
|
22
23
|
return (
|
|
23
|
-
<Option key={filterName} value={filterName}>
|
|
24
|
+
<Option data-testid={`${filterName}-${count}`} key={filterName} value={filterName}>
|
|
24
25
|
{computeFilterMessage(filterName, count)}
|
|
25
26
|
</Option>
|
|
26
27
|
);
|
|
@@ -229,14 +229,14 @@ FormApiTokenContainer.propTypes = {
|
|
|
229
229
|
values: PropTypes.shape({
|
|
230
230
|
name: PropTypes.string,
|
|
231
231
|
description: PropTypes.string,
|
|
232
|
-
lifespan: PropTypes.string,
|
|
232
|
+
lifespan: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
233
233
|
type: PropTypes.string,
|
|
234
234
|
}).isRequired,
|
|
235
235
|
isCreating: PropTypes.bool.isRequired,
|
|
236
236
|
apiToken: PropTypes.shape({
|
|
237
237
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
238
238
|
type: PropTypes.string,
|
|
239
|
-
lifespan: PropTypes.
|
|
239
|
+
lifespan: PropTypes.string,
|
|
240
240
|
name: PropTypes.string,
|
|
241
241
|
accessKey: PropTypes.string,
|
|
242
242
|
permissions: PropTypes.array,
|
|
@@ -50,7 +50,7 @@ FormBody.propTypes = {
|
|
|
50
50
|
apiToken: PropTypes.shape({
|
|
51
51
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
52
52
|
type: PropTypes.string,
|
|
53
|
-
lifespan: PropTypes.number,
|
|
53
|
+
lifespan: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
54
54
|
name: PropTypes.string,
|
|
55
55
|
accessKey: PropTypes.string,
|
|
56
56
|
permissions: PropTypes.array,
|
|
@@ -69,7 +69,7 @@ FormHead.propTypes = {
|
|
|
69
69
|
apiToken: PropTypes.shape({
|
|
70
70
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
71
71
|
type: PropTypes.string,
|
|
72
|
-
lifespan: PropTypes.number,
|
|
72
|
+
lifespan: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
73
73
|
name: PropTypes.string,
|
|
74
74
|
accessKey: PropTypes.string,
|
|
75
75
|
permissions: PropTypes.array,
|