@strapi/admin 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/src/components/Notifications/Notification/index.js +3 -3
- package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +2 -2
- package/admin/src/content-manager/components/ComponentInitializer/index.js +4 -9
- package/admin/src/content-manager/components/DragLayer/index.js +1 -1
- package/admin/src/content-manager/components/DynamicTable/index.js +7 -0
- package/admin/src/content-manager/components/DynamicZone/index.js +25 -5
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/schema.js +4 -1
- package/admin/src/content-manager/components/RepeatableComponent/AccordionGroupCustom/index.js +1 -3
- package/admin/src/content-manager/components/SelectWrapper/index.js +15 -81
- package/admin/src/content-manager/hooks/useFetchContentTypeLayout/utils/formatLayouts.js +2 -2
- package/admin/src/content-manager/pages/App/LeftMenu/index.js +2 -6
- package/admin/src/content-manager/pages/App/index.js +3 -1
- package/admin/src/content-manager/pages/EditSettingsView/index.js +1 -1
- package/admin/src/content-manager/pages/EditView/Informations/index.js +37 -13
- package/admin/src/content-manager/pages/ListSettingsView/components/CardPreview.js +19 -8
- package/admin/src/content-manager/pages/ListSettingsView/components/DraggableCard.js +123 -67
- package/admin/src/content-manager/pages/ListSettingsView/components/SortDisplayedFields.js +4 -1
- package/admin/src/content-manager/pages/ListSettingsView/index.js +1 -1
- package/admin/src/content-manager/pages/ListView/index.js +37 -20
- package/admin/src/hooks/useSettingsMenu/utils/defaultGlobalLinks.js +1 -1
- package/admin/src/pages/App/utils/unique-identifier.js +3 -1
- package/admin/src/pages/AuthPage/index.js +8 -2
- package/admin/src/pages/ProfilePage/index.js +32 -6
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +20 -7
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +3 -3
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +3 -3
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/stepper.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +5 -11
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/tableHeaders.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/components/MagicLink/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/components/SelectRoles/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/HeadersInput/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +5 -5
- package/admin/src/translations/en.json +29 -23
- package/admin/src/translations/fr.json +315 -6
- package/admin/src/translations/ko.json +670 -263
- package/admin/src/translations/nl.json +1 -1
- package/admin/src/translations/zh.json +482 -41
- package/build/{01a600d9e6e0dea21e33017a97bdf431.png → 01a600d9e6e0dea21e33.png} +0 -0
- package/build/{15026a3d58aeb282813457f060f2d6ac.png → 15026a3d58aeb2828134.png} +0 -0
- package/build/{1551f4f60c37af51121f106501f69b80.woff2 → 1551f4f60c37af51121f.woff2} +0 -0
- package/build/{1e59d2330b4c6deb84b340635ed36249.ttf → 1e59d2330b4c6deb84b3.ttf} +0 -0
- package/build/{20fd1704ea223900efa9fd4e869efb08.woff2 → 20fd1704ea223900efa9.woff2} +0 -0
- package/build/{2285773e6b4b172f07d9b777c81b0775.woff → 2285773e6b4b172f07d9.woff} +0 -0
- package/build/{23f19bb08961f37aaf692ff943823453.eot → 23f19bb08961f37aaf69.eot} +0 -0
- package/build/2664.f33f619d.chunk.js +2 -0
- package/build/2664.f33f619d.chunk.js.LICENSE.txt +7 -0
- package/build/{2a9e9ef5c4c775bb7c7b3625041b1354.png → 2a9e9ef5c4c775bb7c7b.png} +0 -0
- package/build/{2f517e09eb2ca6650ff5bec5a95157ab.svg → 2f517e09eb2ca6650ff5.svg} +0 -0
- package/build/3226.1a4b5cd1.chunk.js +2 -0
- package/build/{3226.0dc582b2.chunk.js.LICENSE.txt → 3226.1a4b5cd1.chunk.js.LICENSE.txt} +0 -0
- package/build/4362.c65ab24b.chunk.js +1 -0
- package/build/{4689f52cc96215721344e51e5831eec1.svg → 4689f52cc96215721344.svg} +0 -0
- package/build/{4715.35096dd7.chunk.js → 4715.f134f37a.chunk.js} +1 -1
- package/build/{491974d108fe4002b2aaf7ffc48249a0.ttf → 491974d108fe4002b2aa.ttf} +0 -0
- package/build/{527940b104eb2ea366c8630f3f038603.ttf → 527940b104eb2ea366c8.ttf} +0 -0
- package/build/{77206a6bb316fa0aded5083cc57f92b9.eot → 77206a6bb316fa0aded5.eot} +0 -0
- package/build/{7a3337626410ca2f40718481c755640f.woff2 → 7a3337626410ca2f4071.woff2} +0 -0
- package/build/{7a8b4f130182d19a2d7c67d80c090397.svg → 7a8b4f130182d19a2d7c.svg} +0 -0
- package/build/{849.fc26299c.chunk.js → 849.35b7e7af.chunk.js} +1 -1
- package/build/{8b43027f47b20503057dfbbaa9401fef.eot → 8b43027f47b20503057d.eot} +0 -0
- package/build/{9238.f112d6c9.chunk.js → 9238.63386655.chunk.js} +1 -1
- package/build/{9bbb245e67a133f6e486d8d2545e14a5.eot → 9bbb245e67a133f6e486.eot} +0 -0
- package/build/{Admin-authenticatedApp.0298a225.chunk.js → Admin-authenticatedApp.bcc1dcbe.chunk.js} +1 -1
- package/build/{Admin_homePage.31e37124.chunk.js → Admin_homePage.74b48134.chunk.js} +1 -1
- package/build/Admin_marketplace.8d0028cc.chunk.js +1 -0
- package/build/Admin_profilePage.f276f571.chunk.js +1 -0
- package/build/Admin_settingsPage.1947fe0c.chunk.js +1 -0
- package/build/{admin-edit-roles-page.e91bd9e5.chunk.js → admin-edit-roles-page.2bccaf76.chunk.js} +1 -1
- package/build/admin-edit-users.1632dcf7.chunk.js +1 -0
- package/build/admin-users.1f0533e6.chunk.js +1 -0
- package/build/{api-tokens-create-page.ac4285ba.chunk.js → api-tokens-create-page.ab33d46d.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.b8900ddd.chunk.js → api-tokens-edit-page.749496cc.chunk.js} +1 -1
- package/build/{b997a22a2e0b87ef1fa23258f14f3b27.ico → b997a22a2e0b87ef1fa2.ico} +0 -0
- package/build/{bb58e57c48a3e911f15fa834ff00d44a.woff → bb58e57c48a3e911f15f.woff} +0 -0
- package/build/{bd81ba6c07827282255d031b2a6f4fe4.png → bd81ba6c07827282255d.png} +0 -0
- package/build/{be9ee23c0c6390141475d519c2c5fb8f.ttf → be9ee23c0c6390141475.ttf} +0 -0
- package/build/{c1e38fd9e0e74ba58f7a2b77ef29fdd3.svg → c1e38fd9e0e74ba58f7a.svg} +0 -0
- package/build/{c3de6118ef47086ad05c83a1c78f006d.png → c3de6118ef47086ad05c.png} +0 -0
- package/build/codemirror-css.d09c79d2.chunk.js +1 -0
- package/build/content-manager.be0bf12e.chunk.js +1 -0
- package/build/{content-type-builder-translation-en-json.d860718a.chunk.js → content-type-builder-translation-en-json.81257d0d.chunk.js} +1 -1
- package/build/content-type-builder-translation-ko-json.0288cb2b.chunk.js +1 -0
- package/build/content-type-builder.aa13e7a4.chunk.js +1 -0
- package/build/{d878b0a6a1144760244ff0665888404c.woff2 → d878b0a6a1144760244f.woff2} +0 -0
- package/build/{eeccf4f66002c6f2ba24d3d22f2434c2.woff → eeccf4f66002c6f2ba24.woff} +0 -0
- package/build/{email-settings-page.def5ceaf.chunk.js → email-settings-page.d3ce077f.chunk.js} +1 -1
- package/build/email-translation-en-json.ef8208e3.chunk.js +1 -0
- package/build/email-translation-ja-json.66b21ec1.chunk.js +1 -0
- package/build/email-translation-ko-json.e383ad57.chunk.js +1 -0
- package/build/en-json.4c3c1c95.chunk.js +1 -0
- package/build/{f691f37e57f04c152e2315ab7dbad881.woff → f691f37e57f04c152e23.woff} +0 -0
- package/build/{fde9b1ad0670d29a251605a5e8eef02b.png → fde9b1ad0670d29a2516.png} +0 -0
- package/build/fontawesome-css-all.90be2358.chunk.js +1 -0
- package/build/fontawesome-css.32df0f91.chunk.js +1 -0
- package/build/fr-json.c75e1a2e.chunk.js +1 -0
- package/build/i18n-settings-page.ad670b2c.chunk.js +1 -0
- package/build/i18n-translation-en-json.a90b9dc5.chunk.js +1 -0
- package/build/i18n-translation-ko-json.f0628aff.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/ko-json.35832b30.chunk.js +1 -0
- package/build/main.9b622560.js +2 -0
- package/build/{main.a5bd9650.js.LICENSE.txt → main.9b622560.js.LICENSE.txt} +0 -0
- package/build/nl-json.9e55cf9c.chunk.js +1 -0
- package/build/runtime~main.726e5497.js +1 -0
- package/build/{upload-settings.8a380d3d.chunk.js → upload-settings.f65c4d08.chunk.js} +1 -1
- package/build/{upload-translation-en-json.58d8ce44.chunk.js → upload-translation-en-json.d205cecd.chunk.js} +1 -1
- package/build/upload-translation-ko-json.b6602572.chunk.js +1 -0
- package/build/{users-advanced-settings-page.bda19eae.chunk.js → users-advanced-settings-page.da9830fd.chunk.js} +1 -1
- package/build/{users-email-settings-page.b1d1f551.chunk.js → users-email-settings-page.36142cd7.chunk.js} +1 -1
- package/build/users-permissions-translation-ko-json.4677f640.chunk.js +1 -0
- package/build/{users-providers-settings-page.733a51ec.chunk.js → users-providers-settings-page.2c0685d3.chunk.js} +1 -1
- package/build/{users-roles-settings-page.0eb926e7.chunk.js → users-roles-settings-page.61c9b376.chunk.js} +1 -1
- package/build/{webhook-edit-page.634e50da.chunk.js → webhook-edit-page.36755ae4.chunk.js} +1 -1
- package/build/{webhook-list-page.aae66737.chunk.js → webhook-list-page.8abf0b5f.chunk.js} +1 -1
- package/build/zh-json.3b683748.chunk.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/Roles/CreatePage/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Users/components/MagicLink/index.js +1 -1
- package/index.js +40 -1
- package/jest.config.front.js +10 -0
- package/package.json +16 -11
- package/server/register.js +5 -0
- package/server/routes/serve-admin-panel.js +59 -0
- package/server/strategies/api-token.js +2 -1
- package/webpack.config.js +11 -7
- package/build/3226.0dc582b2.chunk.js +0 -2
- package/build/4362.e71cf036.chunk.js +0 -1
- package/build/8447.32ee17be.chunk.js +0 -2
- package/build/8447.32ee17be.chunk.js.LICENSE.txt +0 -22
- package/build/Admin_marketplace.201373e2.chunk.js +0 -1
- package/build/Admin_profilePage.3aa61921.chunk.js +0 -1
- package/build/Admin_settingsPage.363ad01d.chunk.js +0 -1
- package/build/admin-edit-users.bcdd2e4d.chunk.js +0 -1
- package/build/admin-users.a2d08780.chunk.js +0 -1
- package/build/codemirror-css.7b034e03.chunk.js +0 -1
- package/build/content-manager.4a449a52.chunk.js +0 -1
- package/build/content-type-builder-translation-ko-json.20ad3eac.chunk.js +0 -1
- package/build/content-type-builder.eeae4ee8.chunk.js +0 -1
- package/build/email-translation-en-json.5ec38fe9.chunk.js +0 -1
- package/build/email-translation-ja-json.b75afc52.chunk.js +0 -1
- package/build/email-translation-ko-json.eb9a23cd.chunk.js +0 -1
- package/build/en-json.6282a00f.chunk.js +0 -1
- package/build/fontawesome-css-all.162c8569.chunk.js +0 -1
- package/build/fontawesome-css.b1736497.chunk.js +0 -1
- package/build/fr-json.f7d484a8.chunk.js +0 -1
- package/build/i18n-settings-page.00c74503.chunk.js +0 -1
- package/build/i18n-translation-en-json.17af559c.chunk.js +0 -1
- package/build/ko-json.7203b08b.chunk.js +0 -1
- package/build/main.a5bd9650.js +0 -2
- package/build/nl-json.9c7f83db.chunk.js +0 -1
- package/build/runtime~main.bddfe3c6.js +0 -1
- package/build/users-permissions-translation-ko-json.90c2d129.chunk.js +0 -1
- package/build/zh-json.414d826f.chunk.js +0 -1
|
@@ -40,18 +40,18 @@ const Notification = ({ dispatch, notification }) => {
|
|
|
40
40
|
variant = 'default';
|
|
41
41
|
alertTitle = formatMessage({
|
|
42
42
|
id: 'notification.default.title',
|
|
43
|
-
defaultMessage: 'Information
|
|
43
|
+
defaultMessage: 'Information:',
|
|
44
44
|
});
|
|
45
45
|
} else if (type === 'warning') {
|
|
46
46
|
alertTitle = formatMessage({
|
|
47
47
|
id: 'notification.warning.title',
|
|
48
|
-
defaultMessage: 'Warning
|
|
48
|
+
defaultMessage: 'Warning:',
|
|
49
49
|
});
|
|
50
50
|
variant = 'danger';
|
|
51
51
|
} else {
|
|
52
52
|
alertTitle = formatMessage({
|
|
53
53
|
id: 'notification.success.title',
|
|
54
|
-
defaultMessage: 'Success
|
|
54
|
+
defaultMessage: 'Success:',
|
|
55
55
|
});
|
|
56
56
|
variant = 'success';
|
|
57
57
|
}
|
|
@@ -200,10 +200,10 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
200
200
|
|
|
201
201
|
const displayErrors = useCallback(
|
|
202
202
|
err => {
|
|
203
|
-
const errorPayload = err.response.
|
|
203
|
+
const errorPayload = err.response.data;
|
|
204
204
|
console.error(errorPayload);
|
|
205
205
|
|
|
206
|
-
let errorMessage = get(errorPayload, ['message'], 'Bad Request');
|
|
206
|
+
let errorMessage = get(errorPayload, ['error', 'message'], 'Bad Request');
|
|
207
207
|
|
|
208
208
|
// TODO handle errors correctly when back-end ready
|
|
209
209
|
if (Array.isArray(errorMessage)) {
|
|
@@ -57,13 +57,10 @@ const ComponentInitializer = ({ error, isReadOnly, onClick }) => {
|
|
|
57
57
|
</Box>
|
|
58
58
|
{error?.id && (
|
|
59
59
|
<Typography textColor="danger600" variant="pi">
|
|
60
|
-
{formatMessage(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
error.values
|
|
66
|
-
)}
|
|
60
|
+
{formatMessage({
|
|
61
|
+
id: error.id,
|
|
62
|
+
defaultMessage: error.id,
|
|
63
|
+
})}
|
|
67
64
|
</Typography>
|
|
68
65
|
)}
|
|
69
66
|
</>
|
|
@@ -78,8 +75,6 @@ ComponentInitializer.defaultProps = {
|
|
|
78
75
|
ComponentInitializer.propTypes = {
|
|
79
76
|
error: PropTypes.shape({
|
|
80
77
|
id: PropTypes.string.isRequired,
|
|
81
|
-
defaultMessage: PropTypes.string.isRequired,
|
|
82
|
-
values: PropTypes.object,
|
|
83
78
|
}),
|
|
84
79
|
isReadOnly: PropTypes.bool,
|
|
85
80
|
onClick: PropTypes.func.isRequired,
|
|
@@ -54,7 +54,7 @@ const CustomDragLayer = () => {
|
|
|
54
54
|
<LayoutDndProvider>
|
|
55
55
|
<div style={layerStyles}>
|
|
56
56
|
<div style={getItemStyles(initialOffset, currentOffset, mouseOffset)} className="col-md-2">
|
|
57
|
-
{[ItemTypes.EDIT_RELATION, ItemTypes.EDIT_FIELD].includes(itemType) && (
|
|
57
|
+
{[ItemTypes.EDIT_RELATION, ItemTypes.EDIT_FIELD, ItemTypes.FIELD].includes(itemType) && (
|
|
58
58
|
<CardPreview labelField={item.labelField} />
|
|
59
59
|
)}
|
|
60
60
|
{itemType === ItemTypes.COMPONENT && (
|
|
@@ -16,6 +16,7 @@ const DynamicTable = ({
|
|
|
16
16
|
canCreate,
|
|
17
17
|
canDelete,
|
|
18
18
|
contentTypeName,
|
|
19
|
+
action,
|
|
19
20
|
isBulkable,
|
|
20
21
|
isLoading,
|
|
21
22
|
onConfirmDelete,
|
|
@@ -77,6 +78,7 @@ const DynamicTable = ({
|
|
|
77
78
|
<Table
|
|
78
79
|
components={{ ConfirmDialogDelete, ConfirmDialogDeleteAll }}
|
|
79
80
|
contentType={contentTypeName}
|
|
81
|
+
action={action}
|
|
80
82
|
isLoading={isLoading}
|
|
81
83
|
headers={tableHeaders}
|
|
82
84
|
onConfirmDelete={onConfirmDelete}
|
|
@@ -98,10 +100,15 @@ const DynamicTable = ({
|
|
|
98
100
|
);
|
|
99
101
|
};
|
|
100
102
|
|
|
103
|
+
DynamicTable.defaultProps = {
|
|
104
|
+
action: undefined,
|
|
105
|
+
};
|
|
106
|
+
|
|
101
107
|
DynamicTable.propTypes = {
|
|
102
108
|
canCreate: PropTypes.bool.isRequired,
|
|
103
109
|
canDelete: PropTypes.bool.isRequired,
|
|
104
110
|
contentTypeName: PropTypes.string.isRequired,
|
|
111
|
+
action: PropTypes.node,
|
|
105
112
|
isBulkable: PropTypes.bool.isRequired,
|
|
106
113
|
isLoading: PropTypes.bool.isRequired,
|
|
107
114
|
layout: PropTypes.exact({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { memo, useCallback, useMemo, useState } from 'react';
|
|
1
|
+
import React, { memo, useCallback, useMemo, useState, useEffect } from 'react';
|
|
2
2
|
import get from 'lodash/get';
|
|
3
3
|
import isEqual from 'react-fast-compare';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
@@ -37,11 +37,33 @@ const DynamicZone = ({
|
|
|
37
37
|
}) => {
|
|
38
38
|
const toggleNotification = useNotification();
|
|
39
39
|
const [isOpen, setIsOpen] = useState(false);
|
|
40
|
+
const [shouldOpenAddedComponent, setShouldOpenAddedComponent] = useState(false);
|
|
40
41
|
const dynamicDisplayedComponentsLength = dynamicDisplayedComponents.length;
|
|
42
|
+
|
|
41
43
|
const [componentCollapses, setComponentsCollapses] = useState(
|
|
42
44
|
createCollapses(dynamicDisplayedComponentsLength)
|
|
43
45
|
);
|
|
44
46
|
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
setComponentsCollapses(createCollapses(dynamicDisplayedComponentsLength));
|
|
49
|
+
}, [dynamicDisplayedComponentsLength]);
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (shouldOpenAddedComponent) {
|
|
53
|
+
setComponentsCollapses(prev =>
|
|
54
|
+
prev.map((collapse, index) => {
|
|
55
|
+
if (index === prev.length - 1) {
|
|
56
|
+
return { ...collapse, isOpen: true };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return collapse;
|
|
60
|
+
})
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
setShouldOpenAddedComponent(false);
|
|
64
|
+
}
|
|
65
|
+
}, [shouldOpenAddedComponent]);
|
|
66
|
+
|
|
45
67
|
// We cannot use the default props here
|
|
46
68
|
const { max = Infinity, min = -Infinity } = fieldSchema;
|
|
47
69
|
const dynamicZoneErrors = useMemo(() => {
|
|
@@ -68,7 +90,7 @@ const DynamicZone = ({
|
|
|
68
90
|
setIsOpen(false);
|
|
69
91
|
|
|
70
92
|
addComponentToDynamicZone(name, componentUid, hasError);
|
|
71
|
-
|
|
93
|
+
setShouldOpenAddedComponent(true);
|
|
72
94
|
},
|
|
73
95
|
[addComponentToDynamicZone, hasError, name]
|
|
74
96
|
);
|
|
@@ -132,8 +154,6 @@ const DynamicZone = ({
|
|
|
132
154
|
|
|
133
155
|
const handleRemoveComponent = (name, currentIndex) => {
|
|
134
156
|
removeComponentFromDynamicZone(name, currentIndex);
|
|
135
|
-
|
|
136
|
-
setComponentsCollapses(prev => prev.filter((_, index) => index !== currentIndex));
|
|
137
157
|
};
|
|
138
158
|
|
|
139
159
|
if (!isFieldAllowed && isCreatingEntry) {
|
|
@@ -183,7 +203,7 @@ const DynamicZone = ({
|
|
|
183
203
|
dynamicDisplayedComponentsLength > 0 &&
|
|
184
204
|
index < dynamicDisplayedComponentsLength - 1;
|
|
185
205
|
const showUpIcon = isFieldAllowed && dynamicDisplayedComponentsLength > 0 && index > 0;
|
|
186
|
-
const isOpen = componentCollapses[index]
|
|
206
|
+
const isOpen = componentCollapses[index]?.isOpen || false;
|
|
187
207
|
|
|
188
208
|
return (
|
|
189
209
|
<Component
|
|
@@ -338,7 +338,10 @@ const createYupSchemaAttribute = (type, validations, options) => {
|
|
|
338
338
|
break;
|
|
339
339
|
}
|
|
340
340
|
case 'regex':
|
|
341
|
-
schema = schema.matches(new RegExp(validationValue),
|
|
341
|
+
schema = schema.matches(new RegExp(validationValue), {
|
|
342
|
+
message: errorsTrads.regex,
|
|
343
|
+
excludeEmptyString: !validations.required,
|
|
344
|
+
});
|
|
342
345
|
break;
|
|
343
346
|
case 'lowercase':
|
|
344
347
|
if (['text', 'textarea', 'email', 'string'].includes(type)) {
|
package/admin/src/content-manager/components/RepeatableComponent/AccordionGroupCustom/index.js
CHANGED
|
@@ -92,7 +92,7 @@ const AccordionGroupCustom = ({ children, footer, label, labelAction, error }) =
|
|
|
92
92
|
{error && (
|
|
93
93
|
<Box paddingTop={1}>
|
|
94
94
|
<Typography variant="pi" textColor="danger600">
|
|
95
|
-
{formatMessage({ id: error.id, defaultMessage: error.
|
|
95
|
+
{formatMessage({ id: error.id, defaultMessage: error.id })}
|
|
96
96
|
</Typography>
|
|
97
97
|
</Box>
|
|
98
98
|
)}
|
|
@@ -111,8 +111,6 @@ AccordionGroupCustom.propTypes = {
|
|
|
111
111
|
children: PropTypes.node.isRequired,
|
|
112
112
|
error: PropTypes.shape({
|
|
113
113
|
id: PropTypes.string.isRequired,
|
|
114
|
-
defaultMessage: PropTypes.string.isRequired,
|
|
115
|
-
values: PropTypes.object,
|
|
116
114
|
}),
|
|
117
115
|
footer: PropTypes.node,
|
|
118
116
|
label: PropTypes.string,
|
|
@@ -29,9 +29,9 @@ import { connect, select } from './utils';
|
|
|
29
29
|
import getSelectStyles from './utils/getSelectStyles';
|
|
30
30
|
|
|
31
31
|
const initialPaginationState = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
contains: '',
|
|
33
|
+
limit: 20,
|
|
34
|
+
start: 0,
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
const buildParams = (query, paramsToKeep) => {
|
|
@@ -141,10 +141,10 @@ function SelectWrapper({
|
|
|
141
141
|
|
|
142
142
|
setIsLoading(true);
|
|
143
143
|
|
|
144
|
-
const params = {
|
|
144
|
+
const params = { limit: state.limit, ...defaultParams, start: state.start };
|
|
145
145
|
|
|
146
|
-
if (state.
|
|
147
|
-
params[containsKey] = state.
|
|
146
|
+
if (state.contains) {
|
|
147
|
+
params[`filters[${containsKey}][$contains]`] = state.contains;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
try {
|
|
@@ -183,10 +183,9 @@ function SelectWrapper({
|
|
|
183
183
|
isFieldAllowed,
|
|
184
184
|
isMorph,
|
|
185
185
|
mainField.name,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
state.
|
|
189
|
-
state._limit,
|
|
186
|
+
state.contains,
|
|
187
|
+
state.limit,
|
|
188
|
+
state.start,
|
|
190
189
|
]
|
|
191
190
|
);
|
|
192
191
|
|
|
@@ -204,11 +203,11 @@ function SelectWrapper({
|
|
|
204
203
|
const handleInputChange = (inputValue, { action }) => {
|
|
205
204
|
if (action === 'input-change') {
|
|
206
205
|
setState(prevState => {
|
|
207
|
-
if (prevState.
|
|
206
|
+
if (prevState.contains === inputValue) {
|
|
208
207
|
return prevState;
|
|
209
208
|
}
|
|
210
209
|
|
|
211
|
-
return { ...prevState,
|
|
210
|
+
return { ...prevState, contains: inputValue, start: 0 };
|
|
212
211
|
});
|
|
213
212
|
}
|
|
214
213
|
|
|
@@ -216,7 +215,10 @@ function SelectWrapper({
|
|
|
216
215
|
};
|
|
217
216
|
|
|
218
217
|
const handleMenuScrollToBottom = () => {
|
|
219
|
-
setState(prevState => ({
|
|
218
|
+
setState(prevState => ({
|
|
219
|
+
...prevState,
|
|
220
|
+
start: prevState.start + 20,
|
|
221
|
+
}));
|
|
220
222
|
};
|
|
221
223
|
|
|
222
224
|
const handleMenuClose = () => {
|
|
@@ -304,7 +306,6 @@ function SelectWrapper({
|
|
|
304
306
|
move={moveRelation}
|
|
305
307
|
name={name}
|
|
306
308
|
options={filteredOptions}
|
|
307
|
-
// options={temp}
|
|
308
309
|
onChange={handleChange}
|
|
309
310
|
onInputChange={handleInputChange}
|
|
310
311
|
onMenuClose={handleMenuClose}
|
|
@@ -320,73 +321,6 @@ function SelectWrapper({
|
|
|
320
321
|
/>
|
|
321
322
|
</Stack>
|
|
322
323
|
);
|
|
323
|
-
|
|
324
|
-
// return (
|
|
325
|
-
// <Padded>
|
|
326
|
-
// <BaselineAlignment />
|
|
327
|
-
// <Flex justifyContent="space-between">
|
|
328
|
-
// <Flex>
|
|
329
|
-
// <Text fontWeight="semiBold">
|
|
330
|
-
// <span>
|
|
331
|
-
// {label}
|
|
332
|
-
// {!isSingle && ` (${associationsLength})`}
|
|
333
|
-
// </span>
|
|
334
|
-
// </Text>
|
|
335
|
-
// {labelIconformatted && (
|
|
336
|
-
// <div style={{ lineHeight: '13px' }}>
|
|
337
|
-
// <LabelIconWrapper title={labelIconformatted.title}>
|
|
338
|
-
// {labelIconformatted.icon}
|
|
339
|
-
// </LabelIconWrapper>
|
|
340
|
-
// </div>
|
|
341
|
-
// )}
|
|
342
|
-
// </Flex>
|
|
343
|
-
// {isSingle && link}
|
|
344
|
-
// </Flex>
|
|
345
|
-
// {!isEmpty(description) && (
|
|
346
|
-
// <Padded top size="xs">
|
|
347
|
-
// <BaselineAlignment />
|
|
348
|
-
// <Text fontSize="sm" color="grey" lineHeight="12px" ellipsis>
|
|
349
|
-
// {description}
|
|
350
|
-
// </Text>
|
|
351
|
-
// </Padded>
|
|
352
|
-
// )}
|
|
353
|
-
// <Padded top size="sm">
|
|
354
|
-
// <BaselineAlignment />
|
|
355
|
-
|
|
356
|
-
// <Component
|
|
357
|
-
// addRelation={handleAddRelation}
|
|
358
|
-
// components={{ ClearIndicator, DropdownIndicator, IndicatorSeparator, Option }}
|
|
359
|
-
// displayNavigationLink={shouldDisplayRelationLink}
|
|
360
|
-
// id={name}
|
|
361
|
-
// isDisabled={isDisabled}
|
|
362
|
-
// isLoading={isLoading}
|
|
363
|
-
// isClearable
|
|
364
|
-
// mainField={mainField}
|
|
365
|
-
// move={moveRelation}
|
|
366
|
-
// name={name}
|
|
367
|
-
// options={filteredOptions}
|
|
368
|
-
// onChange={handleChange}
|
|
369
|
-
// onInputChange={handleInputChange}
|
|
370
|
-
// onMenuClose={handleMenuClose}
|
|
371
|
-
// onMenuOpen={handleMenuOpen}
|
|
372
|
-
// onMenuScrollToBottom={handleMenuScrollToBottom}
|
|
373
|
-
// onRemove={onRemoveRelation}
|
|
374
|
-
// placeholder={
|
|
375
|
-
// isEmpty(placeholder) ? (
|
|
376
|
-
// <FormattedMessage id={getTrad('containers.Edit.addAnItem')} />
|
|
377
|
-
// ) : (
|
|
378
|
-
// placeholder
|
|
379
|
-
// )
|
|
380
|
-
// }
|
|
381
|
-
// searchToPersist={searchToPersist}
|
|
382
|
-
// styles={styles}
|
|
383
|
-
// targetModel={targetModel}
|
|
384
|
-
// value={value}
|
|
385
|
-
// />
|
|
386
|
-
// </Padded>
|
|
387
|
-
// <div style={{ marginBottom: 28 }} />
|
|
388
|
-
// </Padded>
|
|
389
|
-
// );
|
|
390
324
|
}
|
|
391
325
|
|
|
392
326
|
SelectWrapper.defaultProps = {
|
|
@@ -185,7 +185,7 @@ const generateRelationQueryInfos = (contentTypeConfiguration, fieldName, models)
|
|
|
185
185
|
|
|
186
186
|
const queryInfos = {
|
|
187
187
|
endPoint,
|
|
188
|
-
containsKey: `${mainField}
|
|
188
|
+
containsKey: `${mainField}`,
|
|
189
189
|
defaultParams: {},
|
|
190
190
|
shouldDisplayRelationLink,
|
|
191
191
|
};
|
|
@@ -210,7 +210,7 @@ const generateRelationQueryInfosForComponents = (
|
|
|
210
210
|
|
|
211
211
|
const queryInfos = {
|
|
212
212
|
endPoint,
|
|
213
|
-
containsKey: `${mainField}
|
|
213
|
+
containsKey: `${mainField}`,
|
|
214
214
|
defaultParams: {
|
|
215
215
|
_component: contentTypeConfiguration.uid,
|
|
216
216
|
},
|
|
@@ -48,9 +48,7 @@ const LeftMenu = () => {
|
|
|
48
48
|
id: 'collectionTypes',
|
|
49
49
|
title: {
|
|
50
50
|
id: getTrad('components.LeftMenu.collection-types'),
|
|
51
|
-
defaultMessage:
|
|
52
|
-
'{number, plural, =0 {Collection Types} one {Collection Type } other {Collection Types}}',
|
|
53
|
-
values: { number: intlCollectionTypeLinks.length },
|
|
51
|
+
defaultMessage: 'Collection Types',
|
|
54
52
|
},
|
|
55
53
|
searchable: true,
|
|
56
54
|
links: sortBy(matchByTitle(intlCollectionTypeLinks, search), object =>
|
|
@@ -61,9 +59,7 @@ const LeftMenu = () => {
|
|
|
61
59
|
id: 'singleTypes',
|
|
62
60
|
title: {
|
|
63
61
|
id: getTrad('components.LeftMenu.single-types'),
|
|
64
|
-
defaultMessage:
|
|
65
|
-
'{number, plural, =0 {Single Types} one {Single Type } other {Single Types}}',
|
|
66
|
-
values: { number: intlSingleTypeLinks.length },
|
|
62
|
+
defaultMessage: 'Single Types',
|
|
67
63
|
},
|
|
68
64
|
searchable: true,
|
|
69
65
|
links: sortBy(matchByTitle(intlSingleTypeLinks, search), object =>
|
|
@@ -23,7 +23,9 @@ const cmPermissions = permissions.contentManager;
|
|
|
23
23
|
const App = () => {
|
|
24
24
|
const contentTypeMatch = useRouteMatch(`/content-manager/:kind/:uid`);
|
|
25
25
|
const { status, collectionTypeLinks, singleTypeLinks, models, refetchData } = useModels();
|
|
26
|
-
const authorisedModels = sortBy([...collectionTypeLinks, ...singleTypeLinks],
|
|
26
|
+
const authorisedModels = sortBy([...collectionTypeLinks, ...singleTypeLinks], model =>
|
|
27
|
+
model.title.toLowerCase()
|
|
28
|
+
);
|
|
27
29
|
const { pathname } = useLocation();
|
|
28
30
|
const { formatMessage } = useIntl();
|
|
29
31
|
|
|
@@ -13,19 +13,25 @@ import { getFullName } from '../../../../utils';
|
|
|
13
13
|
const Informations = () => {
|
|
14
14
|
const { formatMessage, formatRelativeTime } = useIntl();
|
|
15
15
|
const { initialData, isCreatingEntry } = useCMEditViewDataManager();
|
|
16
|
-
|
|
17
|
-
const updatedAt = 'updatedAt';
|
|
18
|
-
const updatedByFirstname = initialData.updatedBy?.firstname || '';
|
|
19
|
-
const updatedByLastname = initialData.updatedBy?.lastname || '';
|
|
20
|
-
const updatedByUsername = initialData.updatedBy?.username;
|
|
21
|
-
const updatedBy = updatedByUsername || getFullName(updatedByFirstname, updatedByLastname);
|
|
22
16
|
const currentTime = useRef(Date.now());
|
|
23
|
-
const timestamp = initialData[updatedAt]
|
|
24
|
-
? new Date(initialData[updatedAt]).getTime()
|
|
25
|
-
: Date.now();
|
|
26
|
-
const elapsed = timestamp - currentTime.current;
|
|
27
17
|
|
|
28
|
-
const
|
|
18
|
+
const getFieldInfo = (atField, byField) => {
|
|
19
|
+
const userFirstname = initialData[byField]?.firstname || '';
|
|
20
|
+
const userLastname = initialData[byField]?.lastname || '';
|
|
21
|
+
const userUsername = initialData[byField]?.username;
|
|
22
|
+
const user = userUsername || getFullName(userFirstname, userLastname);
|
|
23
|
+
const timestamp = initialData[atField] ? new Date(initialData[atField]).getTime() : Date.now();
|
|
24
|
+
const elapsed = timestamp - currentTime.current;
|
|
25
|
+
const { unit, value } = getUnits(-elapsed);
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
at: formatRelativeTime(value, unit, { numeric: 'auto' }),
|
|
29
|
+
by: isCreatingEntry ? '-' : user,
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const updated = getFieldInfo('updatedAt', 'updatedBy');
|
|
34
|
+
const created = getFieldInfo('createdAt', 'createdBy');
|
|
29
35
|
|
|
30
36
|
return (
|
|
31
37
|
<Box>
|
|
@@ -39,6 +45,24 @@ const Informations = () => {
|
|
|
39
45
|
<Divider />
|
|
40
46
|
</Box>
|
|
41
47
|
<Stack size={4}>
|
|
48
|
+
<Flex justifyContent="space-between">
|
|
49
|
+
<Typography fontWeight="bold">
|
|
50
|
+
{formatMessage({
|
|
51
|
+
id: getTrad('containers.Edit.information.created'),
|
|
52
|
+
defaultMessage: 'Created',
|
|
53
|
+
})}
|
|
54
|
+
</Typography>
|
|
55
|
+
<Typography>{created.at}</Typography>
|
|
56
|
+
</Flex>
|
|
57
|
+
<Flex justifyContent="space-between">
|
|
58
|
+
<Typography fontWeight="bold">
|
|
59
|
+
{formatMessage({
|
|
60
|
+
id: getTrad('containers.Edit.information.by'),
|
|
61
|
+
defaultMessage: 'By',
|
|
62
|
+
})}
|
|
63
|
+
</Typography>
|
|
64
|
+
<Typography>{created.by}</Typography>
|
|
65
|
+
</Flex>
|
|
42
66
|
<Flex justifyContent="space-between">
|
|
43
67
|
<Typography fontWeight="bold">
|
|
44
68
|
{formatMessage({
|
|
@@ -46,7 +70,7 @@ const Informations = () => {
|
|
|
46
70
|
defaultMessage: 'Last update',
|
|
47
71
|
})}
|
|
48
72
|
</Typography>
|
|
49
|
-
<Typography>{
|
|
73
|
+
<Typography>{updated.at}</Typography>
|
|
50
74
|
</Flex>
|
|
51
75
|
<Flex justifyContent="space-between">
|
|
52
76
|
<Typography fontWeight="bold">
|
|
@@ -55,7 +79,7 @@ const Informations = () => {
|
|
|
55
79
|
defaultMessage: 'By',
|
|
56
80
|
})}
|
|
57
81
|
</Typography>
|
|
58
|
-
<Typography>{
|
|
82
|
+
<Typography>{updated.by}</Typography>
|
|
59
83
|
</Flex>
|
|
60
84
|
</Stack>
|
|
61
85
|
</Box>
|
|
@@ -31,36 +31,40 @@ const DragButton = styled(ActionBox)`
|
|
|
31
31
|
const FieldContainer = styled(Flex)`
|
|
32
32
|
display: inline-flex;
|
|
33
33
|
max-height: ${32 / 16}rem;
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
opacity: ${({ transparent }) => (transparent ? 0 : 1)};
|
|
35
|
+
background-color: ${({ theme, isSibling }) =>
|
|
36
|
+
isSibling ? theme.colors.neutral100 : theme.colors.primary100};
|
|
37
|
+
border: 1px solid
|
|
38
|
+
${({ theme, isSibling }) => (isSibling ? theme.colors.neutral150 : theme.colors.primary200)};
|
|
36
39
|
|
|
37
40
|
svg {
|
|
38
41
|
width: ${10 / 16}rem;
|
|
39
42
|
height: ${10 / 16}rem;
|
|
40
43
|
|
|
41
44
|
path {
|
|
42
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
|
45
|
+
fill: ${({ theme, isSibling }) => (isSibling ? undefined : theme.colors.primary600)};
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
${Typography} {
|
|
47
|
-
color: ${({ theme }) => theme.colors.primary600};
|
|
50
|
+
color: ${({ theme, isSibling }) => (isSibling ? undefined : theme.colors.primary600)};
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
${DragButton} {
|
|
51
|
-
border-right: 1px solid
|
|
54
|
+
border-right: 1px solid
|
|
55
|
+
${({ theme, isSibling }) => (isSibling ? theme.colors.neutral150 : theme.colors.primary200)};
|
|
52
56
|
}
|
|
53
57
|
`;
|
|
54
58
|
|
|
55
|
-
const CardPreview = ({ labelField }) => {
|
|
59
|
+
const CardPreview = ({ labelField, transparent, isSibling }) => {
|
|
56
60
|
const cardEllipsisTitle = ellipsisCardTitle(labelField);
|
|
57
61
|
|
|
58
62
|
return (
|
|
59
63
|
<FieldContainer
|
|
60
|
-
borderColor="neutral150"
|
|
61
|
-
background="neutral100"
|
|
62
64
|
hasRadius
|
|
63
65
|
justifyContent="space-between"
|
|
66
|
+
transparent={transparent}
|
|
67
|
+
isSibling={isSibling}
|
|
64
68
|
>
|
|
65
69
|
<Stack horizontal size={3}>
|
|
66
70
|
<DragButton alignItems="center">
|
|
@@ -80,8 +84,15 @@ const CardPreview = ({ labelField }) => {
|
|
|
80
84
|
);
|
|
81
85
|
};
|
|
82
86
|
|
|
87
|
+
CardPreview.defaultProps = {
|
|
88
|
+
isSibling: false,
|
|
89
|
+
transparent: false,
|
|
90
|
+
};
|
|
91
|
+
|
|
83
92
|
CardPreview.propTypes = {
|
|
93
|
+
isSibling: PropTypes.bool,
|
|
84
94
|
labelField: PropTypes.string.isRequired,
|
|
95
|
+
transparent: PropTypes.bool,
|
|
85
96
|
};
|
|
86
97
|
|
|
87
98
|
export default CardPreview;
|