@strapi/admin 4.12.0-beta.1 → 4.12.0-beta.3
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/content-manager/components/CollectionTypeFormWrapper/index.js +1 -3
- package/admin/src/content-manager/components/RelationInput/components/Option.js +6 -5
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +7 -7
- package/admin/src/content-manager/pages/EditSettingsView/components/DisplayedFields.js +23 -21
- package/admin/src/content-manager/pages/EditSettingsView/components/ModalForm.js +21 -23
- package/admin/src/content-manager/pages/ListSettingsView/components/SortDisplayedFields.js +24 -22
- package/admin/src/content-manager/pages/ListView/components/Body/index.js +191 -0
- package/admin/src/content-manager/pages/ListView/components/BulkActionButtons/ConfirmBulkActionDialog/index.js +164 -0
- package/admin/src/content-manager/pages/ListView/components/BulkActionButtons/SelectedEntriesModal/index.js +468 -0
- package/admin/src/content-manager/{components/DynamicTable/BulkActionsBar → pages/ListView/components/BulkActionButtons}/index.js +56 -132
- package/admin/src/content-manager/pages/ListView/components/CellContent/RelationMultiple/index.js +63 -69
- package/admin/src/content-manager/pages/ListView/components/CellContent/RepeatableComponent/index.js +28 -21
- package/admin/src/content-manager/pages/ListView/index.js +191 -132
- package/admin/src/layouts/UnauthenticatedLayout/LocaleToggle/index.js +7 -7
- package/admin/src/translations/ca.json +4 -4
- package/admin/src/translations/de.json +4 -4
- package/admin/src/translations/dk.json +2 -2
- package/admin/src/translations/en.json +23 -4
- package/admin/src/translations/es.json +4 -4
- package/admin/src/translations/eu.json +4 -4
- package/admin/src/translations/fr.json +2 -2
- package/admin/src/translations/gu.json +4 -4
- package/admin/src/translations/hi.json +4 -4
- package/admin/src/translations/hu.json +4 -4
- package/admin/src/translations/ja.json +2 -2
- package/admin/src/translations/ko.json +2 -2
- package/admin/src/translations/ml.json +4 -4
- package/admin/src/translations/nl.json +4 -4
- package/admin/src/translations/pl.json +4 -4
- package/admin/src/translations/pt-BR.json +4 -4
- package/admin/src/translations/ru.json +4 -4
- package/admin/src/translations/sa.json +4 -4
- package/admin/src/translations/sk.json +4 -4
- package/admin/src/translations/sv.json +4 -4
- package/admin/src/translations/tr.json +4 -4
- package/admin/src/translations/zh-Hans.json +4 -4
- package/admin/src/translations/zh.json +4 -4
- package/build/{2801.18ac397d.chunk.js → 2801.18f38baf.chunk.js} +1 -1
- package/build/{3483.e182b190.chunk.js → 3483.ddd2d6df.chunk.js} +1 -1
- package/build/{970.89601f27.chunk.js → 3739.63e352f1.chunk.js} +52 -20
- package/build/6158.c974fd83.chunk.js +1 -0
- package/build/6691.f880a0b6.chunk.js +105 -0
- package/build/8298.fd253c9f.chunk.js +117 -0
- package/build/{9932.b5a3bb3a.chunk.js → 9806.91360bb6.chunk.js} +47 -47
- package/build/{Admin-authenticatedApp.2ffa318a.chunk.js → Admin-authenticatedApp.36b3826c.chunk.js} +2 -2
- package/build/Admin_settingsPage.8c600d1a.chunk.js +111 -0
- package/build/{admin-app.088bcd33.chunk.js → admin-app.1c3f7fd6.chunk.js} +9 -9
- package/build/{ca-json.1fed5d8b.chunk.js → ca-json.a53c10b6.chunk.js} +1 -1
- package/build/content-manager.b8d593d4.chunk.js +1103 -0
- package/build/{content-type-builder-translation-ar-json.56d8fcf4.chunk.js → content-type-builder-translation-ar-json.3e808e2f.chunk.js} +1 -1
- package/build/{content-type-builder-translation-cs-json.a5b299ca.chunk.js → content-type-builder-translation-cs-json.1ef9e106.chunk.js} +1 -1
- package/build/{content-type-builder-translation-de-json.393a76c0.chunk.js → content-type-builder-translation-de-json.63fcff7b.chunk.js} +1 -1
- package/build/{content-type-builder-translation-dk-json.fbd39bb7.chunk.js → content-type-builder-translation-dk-json.fd626b67.chunk.js} +1 -1
- package/build/{content-type-builder-translation-en-json.38e20391.chunk.js → content-type-builder-translation-en-json.ed29ff4d.chunk.js} +1 -1
- package/build/{content-type-builder-translation-es-json.9288474b.chunk.js → content-type-builder-translation-es-json.a4a361a9.chunk.js} +1 -1
- package/build/{content-type-builder-translation-fr-json.d35e269c.chunk.js → content-type-builder-translation-fr-json.499c3a46.chunk.js} +1 -1
- package/build/{content-type-builder-translation-id-json.f0513929.chunk.js → content-type-builder-translation-id-json.65255f93.chunk.js} +1 -1
- package/build/{content-type-builder-translation-it-json.aaf16753.chunk.js → content-type-builder-translation-it-json.e268ab74.chunk.js} +1 -1
- package/build/{content-type-builder-translation-ko-json.8fe21a7f.chunk.js → content-type-builder-translation-ko-json.04cb309d.chunk.js} +1 -1
- package/build/{content-type-builder-translation-ms-json.3b5d2d3e.chunk.js → content-type-builder-translation-ms-json.f6b743b9.chunk.js} +1 -1
- package/build/{content-type-builder-translation-nl-json.225ef5d3.chunk.js → content-type-builder-translation-nl-json.997fe8cc.chunk.js} +1 -1
- package/build/{content-type-builder-translation-pl-json.92f36be2.chunk.js → content-type-builder-translation-pl-json.634f638b.chunk.js} +1 -1
- package/build/{content-type-builder-translation-pt-BR-json.3bd10f89.chunk.js → content-type-builder-translation-pt-BR-json.6a95dc71.chunk.js} +1 -1
- package/build/{content-type-builder-translation-ru-json.9bfe47ce.chunk.js → content-type-builder-translation-ru-json.3af65503.chunk.js} +1 -1
- package/build/{content-type-builder-translation-sk-json.d03cc18a.chunk.js → content-type-builder-translation-sk-json.c6078082.chunk.js} +1 -1
- package/build/{content-type-builder-translation-sv-json.d23dcd32.chunk.js → content-type-builder-translation-sv-json.a6df2462.chunk.js} +1 -1
- package/build/{content-type-builder-translation-th-json.7ad256e2.chunk.js → content-type-builder-translation-th-json.122277cc.chunk.js} +1 -1
- package/build/{content-type-builder-translation-tr-json.926f6191.chunk.js → content-type-builder-translation-tr-json.41f44f77.chunk.js} +1 -1
- package/build/{content-type-builder-translation-uk-json.7bf19546.chunk.js → content-type-builder-translation-uk-json.e1315acd.chunk.js} +1 -1
- package/build/{content-type-builder-translation-zh-Hans-json.415577fb.chunk.js → content-type-builder-translation-zh-Hans-json.6ff57db6.chunk.js} +1 -1
- package/build/{content-type-builder-translation-zh-json.958d90e1.chunk.js → content-type-builder-translation-zh-json.3532b962.chunk.js} +1 -1
- package/build/{content-type-builder.3963fb2d.chunk.js → content-type-builder.40534de5.chunk.js} +21 -17
- package/build/{de-json.fcac7381.chunk.js → de-json.b3be02c7.chunk.js} +1 -1
- package/build/{dk-json.e34cad0d.chunk.js → dk-json.842aa391.chunk.js} +1 -1
- package/build/{en-json.fb9f6ddd.chunk.js → en-json.4c733bd1.chunk.js} +1 -1
- package/build/{es-json.42096084.chunk.js → es-json.f57b5335.chunk.js} +1 -1
- package/build/{eu-json.fb17c8f9.chunk.js → eu-json.633025f0.chunk.js} +1 -1
- package/build/{fr-json.69789980.chunk.js → fr-json.aa8839d2.chunk.js} +1 -1
- package/build/{gu-json.4d667d0c.chunk.js → gu-json.5bd62812.chunk.js} +1 -1
- package/build/{hi-json.323be97d.chunk.js → hi-json.9104eb78.chunk.js} +1 -1
- package/build/{hu-json.fe71e6c8.chunk.js → hu-json.9f4aae42.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/{ja-json.81b6d1e3.chunk.js → ja-json.91286391.chunk.js} +1 -1
- package/build/{ko-json.4539f4ba.chunk.js → ko-json.fcf3ec4b.chunk.js} +1 -1
- package/build/main.a12c4c0f.js +2856 -0
- package/build/{ml-json.8988e374.chunk.js → ml-json.557aa14c.chunk.js} +1 -1
- package/build/{nl-json.98345913.chunk.js → nl-json.b2b16eea.chunk.js} +1 -1
- package/build/{pl-json.59a5dab3.chunk.js → pl-json.f094a417.chunk.js} +1 -1
- package/build/{pt-BR-json.9410688b.chunk.js → pt-BR-json.dec7fb01.chunk.js} +1 -1
- package/build/review-workflows-settings-create-view.dfd87e1f.chunk.js +1 -0
- package/build/review-workflows-settings-edit-view.53c00afe.chunk.js +1 -0
- package/build/{review-workflows-settings-list-view.240cacdf.chunk.js → review-workflows-settings-list-view.a34be805.chunk.js} +5 -5
- package/build/{ru-json.678cd48b.chunk.js → ru-json.8193d8c4.chunk.js} +1 -1
- package/build/{runtime~main.44bf2a37.js → runtime~main.d197f488.js} +2 -2
- package/build/{sa-json.6359a11c.chunk.js → sa-json.a56836f1.chunk.js} +1 -1
- package/build/{sk-json.2374f129.chunk.js → sk-json.bf2f057a.chunk.js} +1 -1
- package/build/{sv-json.ae6e71ea.chunk.js → sv-json.fd0e86c6.chunk.js} +1 -1
- package/build/{tr-json.bac5dbd3.chunk.js → tr-json.56c32cf6.chunk.js} +1 -1
- package/build/upload.cbfeefa5.chunk.js +58 -0
- package/build/{zh-Hans-json.fada6f40.chunk.js → zh-Hans-json.36d81cdc.chunk.js} +1 -1
- package/build/{zh-json.3529f1e5.chunk.js → zh-json.1cc86ff0.chunk.js} +1 -1
- package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/constants.js +2 -2
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/ProtectedPage/ProtectedPage.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +34 -6
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +42 -11
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/{getWorkflowValidationSchema.js → validateWorkflow.js} +33 -2
- package/ee/admin/pages/SettingsPage/pages/Users/ListPage/index.js +1 -1
- package/ee/server/constants/workflows.js +1 -0
- package/ee/server/services/review-workflows/validation.js +6 -0
- package/ee/server/validation/review-workflows.js +6 -2
- package/package.json +9 -9
- package/admin/src/content-manager/pages/ListView/components/TableRows/index.js +0 -300
- package/build/190.66d89241.chunk.js +0 -117
- package/build/6158.f9d82db9.chunk.js +0 -1
- package/build/6691.e6d5ac38.chunk.js +0 -105
- package/build/Admin_settingsPage.3ad19487.chunk.js +0 -79
- package/build/content-manager.9b569036.chunk.js +0 -1094
- package/build/main.98c989b0.js +0 -2908
- package/build/review-workflows-settings-create-view.60bc516c.chunk.js +0 -1
- package/build/review-workflows-settings-edit-view.898ea409.chunk.js +0 -1
- package/build/upload.8d01c525.chunk.js +0 -26
- /package/admin/src/content-manager/components/{DynamicTable → ListViewTable}/CellContent/PublicationState/PublicationState.js +0 -0
- /package/admin/src/content-manager/components/{DynamicTable → ListViewTable}/CellContent/PublicationState/index.js +0 -0
|
@@ -1,100 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import { Button,
|
|
4
|
-
import { useTracking } from '@strapi/helper-plugin';
|
|
5
|
-
import { Check,
|
|
3
|
+
import { Button, Typography } from '@strapi/design-system';
|
|
4
|
+
import { useTracking, useTableContext } from '@strapi/helper-plugin';
|
|
5
|
+
import { Check, Trash } from '@strapi/icons';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { useIntl } from 'react-intl';
|
|
8
8
|
import { useSelector } from 'react-redux';
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
import { getTrad } from '
|
|
12
|
-
import
|
|
10
|
+
import InjectionZoneList from '../../../../components/InjectionZoneList';
|
|
11
|
+
import { getTrad } from '../../../../utils';
|
|
12
|
+
import { listViewDomain } from '../../selectors';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<Dialog
|
|
19
|
-
onClose={onToggleDialog}
|
|
20
|
-
title={formatMessage({
|
|
21
|
-
id: 'app.components.ConfirmDialog.title',
|
|
22
|
-
defaultMessage: 'Confirmation',
|
|
23
|
-
})}
|
|
24
|
-
labelledBy="confirmation"
|
|
25
|
-
describedBy="confirm-description"
|
|
26
|
-
isOpen={isOpen}
|
|
27
|
-
>
|
|
28
|
-
<DialogBody icon={<ExclamationMarkCircle />}>
|
|
29
|
-
<Flex direction="column" alignItems="stretch" gap={2}>
|
|
30
|
-
{dialogBody}
|
|
31
|
-
</Flex>
|
|
32
|
-
</DialogBody>
|
|
33
|
-
<DialogFooter
|
|
34
|
-
startAction={
|
|
35
|
-
<Button onClick={onToggleDialog} variant="tertiary">
|
|
36
|
-
{formatMessage({
|
|
37
|
-
id: 'app.components.Button.cancel',
|
|
38
|
-
defaultMessage: 'Cancel',
|
|
39
|
-
})}
|
|
40
|
-
</Button>
|
|
41
|
-
}
|
|
42
|
-
endAction={endAction}
|
|
43
|
-
/>
|
|
44
|
-
</Dialog>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
ConfirmBulkActionDialog.propTypes = {
|
|
49
|
-
isOpen: PropTypes.bool.isRequired,
|
|
50
|
-
onToggleDialog: PropTypes.func.isRequired,
|
|
51
|
-
dialogBody: PropTypes.node.isRequired,
|
|
52
|
-
endAction: PropTypes.node.isRequired,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const confirmDialogsPropTypes = {
|
|
56
|
-
isConfirmButtonLoading: PropTypes.bool.isRequired,
|
|
57
|
-
isOpen: PropTypes.bool.isRequired,
|
|
58
|
-
onConfirm: PropTypes.func.isRequired,
|
|
59
|
-
onToggleDialog: PropTypes.func.isRequired,
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const ConfirmDialogPublishAll = ({ isOpen, onToggleDialog, isConfirmButtonLoading, onConfirm }) => {
|
|
63
|
-
const { formatMessage } = useIntl();
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<ConfirmBulkActionDialog
|
|
67
|
-
isOpen={isOpen}
|
|
68
|
-
onToggleDialog={onToggleDialog}
|
|
69
|
-
dialogBody={
|
|
70
|
-
<>
|
|
71
|
-
<Typography id="confirm-description" textAlign="center">
|
|
72
|
-
{formatMessage({
|
|
73
|
-
id: getTrad('popUpWarning.bodyMessage.contentType.publish.all'),
|
|
74
|
-
defaultMessage: 'Are you sure you want to publish these entries?',
|
|
75
|
-
})}
|
|
76
|
-
</Typography>
|
|
77
|
-
<InjectionZoneList area="contentManager.listView.publishModalAdditionalInfos" />
|
|
78
|
-
</>
|
|
79
|
-
}
|
|
80
|
-
endAction={
|
|
81
|
-
<Button
|
|
82
|
-
onClick={onConfirm}
|
|
83
|
-
variant="secondary"
|
|
84
|
-
startIcon={<Check />}
|
|
85
|
-
loading={isConfirmButtonLoading}
|
|
86
|
-
>
|
|
87
|
-
{formatMessage({
|
|
88
|
-
id: 'app.utils.publish',
|
|
89
|
-
defaultMessage: 'Publish',
|
|
90
|
-
})}
|
|
91
|
-
</Button>
|
|
92
|
-
}
|
|
93
|
-
/>
|
|
94
|
-
);
|
|
95
|
-
};
|
|
14
|
+
import { ConfirmBulkActionDialog, confirmDialogsPropTypes } from './ConfirmBulkActionDialog';
|
|
15
|
+
import SelectedEntriesModal from './SelectedEntriesModal';
|
|
96
16
|
|
|
97
|
-
|
|
17
|
+
/* -------------------------------------------------------------------------------------------------
|
|
18
|
+
* ConfirmDialogUnpublishAll
|
|
19
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
98
20
|
|
|
99
21
|
const ConfirmDialogUnpublishAll = ({
|
|
100
22
|
isOpen,
|
|
@@ -138,6 +60,10 @@ const ConfirmDialogUnpublishAll = ({
|
|
|
138
60
|
|
|
139
61
|
ConfirmDialogUnpublishAll.propTypes = confirmDialogsPropTypes;
|
|
140
62
|
|
|
63
|
+
/* -------------------------------------------------------------------------------------------------
|
|
64
|
+
* ConfirmDialogDeleteAll
|
|
65
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
66
|
+
|
|
141
67
|
const ConfirmDialogDeleteAll = ({ isOpen, onToggleDialog, isConfirmButtonLoading, onConfirm }) => {
|
|
142
68
|
const { formatMessage } = useIntl();
|
|
143
69
|
|
|
@@ -176,21 +102,25 @@ const ConfirmDialogDeleteAll = ({ isOpen, onToggleDialog, isConfirmButtonLoading
|
|
|
176
102
|
|
|
177
103
|
ConfirmDialogDeleteAll.propTypes = confirmDialogsPropTypes;
|
|
178
104
|
|
|
179
|
-
|
|
105
|
+
/* -------------------------------------------------------------------------------------------------
|
|
106
|
+
* BulkActionButtons
|
|
107
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
108
|
+
|
|
109
|
+
const BulkActionButtons = ({
|
|
180
110
|
showPublish,
|
|
181
111
|
showDelete,
|
|
182
112
|
onConfirmDeleteAll,
|
|
183
|
-
onConfirmPublishAll,
|
|
184
113
|
onConfirmUnpublishAll,
|
|
185
|
-
|
|
186
|
-
clearSelectedEntries,
|
|
114
|
+
refetchData,
|
|
187
115
|
}) => {
|
|
188
116
|
const { formatMessage } = useIntl();
|
|
189
117
|
const { trackUsage } = useTracking();
|
|
190
118
|
const { data } = useSelector(listViewDomain());
|
|
119
|
+
const { selectedEntries, setSelectedEntries } = useTableContext();
|
|
191
120
|
|
|
192
|
-
const [isConfirmButtonLoading, setIsConfirmButtonLoading] = useState(false);
|
|
193
|
-
const [
|
|
121
|
+
const [isConfirmButtonLoading, setIsConfirmButtonLoading] = React.useState(false);
|
|
122
|
+
const [isSelectedEntriesModalOpen, setIsSelectedEntriesModalOpen] = React.useState(false);
|
|
123
|
+
const [dialogToOpen, setDialogToOpen] = React.useState(null);
|
|
194
124
|
|
|
195
125
|
// Filters for Bulk actions
|
|
196
126
|
const selectedEntriesObjects = data.filter((entry) => selectedEntries.includes(entry.id));
|
|
@@ -199,7 +129,7 @@ const BulkActionsBar = ({
|
|
|
199
129
|
const unpublishButtonIsShown =
|
|
200
130
|
showPublish && selectedEntriesObjects.some((entry) => entry.publishedAt);
|
|
201
131
|
|
|
202
|
-
const
|
|
132
|
+
const toggleDeleteDialog = () => {
|
|
203
133
|
if (dialogToOpen === 'delete') {
|
|
204
134
|
setDialogToOpen(null);
|
|
205
135
|
} else {
|
|
@@ -208,16 +138,7 @@ const BulkActionsBar = ({
|
|
|
208
138
|
}
|
|
209
139
|
};
|
|
210
140
|
|
|
211
|
-
const
|
|
212
|
-
if (dialogToOpen === 'publish') {
|
|
213
|
-
setDialogToOpen(null);
|
|
214
|
-
} else {
|
|
215
|
-
setDialogToOpen('publish');
|
|
216
|
-
trackUsage('willBulkPublishEntries');
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
const toggleUnpublishModal = () => {
|
|
141
|
+
const toggleUnpublishDialog = () => {
|
|
221
142
|
if (dialogToOpen === 'unpublish') {
|
|
222
143
|
setDialogToOpen(null);
|
|
223
144
|
} else {
|
|
@@ -226,46 +147,51 @@ const BulkActionsBar = ({
|
|
|
226
147
|
}
|
|
227
148
|
};
|
|
228
149
|
|
|
229
|
-
const handleBulkAction = async (confirmAction,
|
|
150
|
+
const handleBulkAction = async (confirmAction, toggleDialog) => {
|
|
230
151
|
try {
|
|
231
152
|
setIsConfirmButtonLoading(true);
|
|
232
153
|
await confirmAction(selectedEntries);
|
|
233
154
|
setIsConfirmButtonLoading(false);
|
|
234
|
-
|
|
235
|
-
|
|
155
|
+
toggleDialog();
|
|
156
|
+
setSelectedEntries([]);
|
|
236
157
|
} catch (error) {
|
|
237
158
|
setIsConfirmButtonLoading(false);
|
|
238
|
-
|
|
159
|
+
toggleDialog();
|
|
239
160
|
}
|
|
240
161
|
};
|
|
241
162
|
|
|
242
|
-
const handleBulkDelete = () => handleBulkAction(onConfirmDeleteAll,
|
|
243
|
-
const
|
|
244
|
-
const
|
|
163
|
+
const handleBulkDelete = () => handleBulkAction(onConfirmDeleteAll, toggleDeleteDialog);
|
|
164
|
+
const handleBulkUnpublish = () => handleBulkAction(onConfirmUnpublishAll, toggleUnpublishDialog);
|
|
165
|
+
const handleToggleSelectedEntriesModal = () => {
|
|
166
|
+
setIsSelectedEntriesModalOpen((prev) => {
|
|
167
|
+
if (prev) {
|
|
168
|
+
refetchData();
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return !prev;
|
|
172
|
+
});
|
|
173
|
+
};
|
|
245
174
|
|
|
246
175
|
return (
|
|
247
176
|
<>
|
|
248
177
|
{publishButtonIsShown && (
|
|
249
178
|
<>
|
|
250
|
-
<Button variant="tertiary" onClick={
|
|
179
|
+
<Button variant="tertiary" onClick={handleToggleSelectedEntriesModal}>
|
|
251
180
|
{formatMessage({ id: 'app.utils.publish', defaultMessage: 'Publish' })}
|
|
252
181
|
</Button>
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
isConfirmButtonLoading={isConfirmButtonLoading}
|
|
257
|
-
onConfirm={handleBulkPublish}
|
|
258
|
-
/>
|
|
182
|
+
{isSelectedEntriesModalOpen && (
|
|
183
|
+
<SelectedEntriesModal onToggle={handleToggleSelectedEntriesModal} />
|
|
184
|
+
)}
|
|
259
185
|
</>
|
|
260
186
|
)}
|
|
261
187
|
{unpublishButtonIsShown && (
|
|
262
188
|
<>
|
|
263
|
-
<Button variant="tertiary" onClick={
|
|
189
|
+
<Button variant="tertiary" onClick={toggleUnpublishDialog}>
|
|
264
190
|
{formatMessage({ id: 'app.utils.unpublish', defaultMessage: 'Unpublish' })}
|
|
265
191
|
</Button>
|
|
266
192
|
<ConfirmDialogUnpublishAll
|
|
267
193
|
isOpen={dialogToOpen === 'unpublish'}
|
|
268
|
-
onToggleDialog={
|
|
194
|
+
onToggleDialog={toggleUnpublishDialog}
|
|
269
195
|
isConfirmButtonLoading={isConfirmButtonLoading}
|
|
270
196
|
onConfirm={handleBulkUnpublish}
|
|
271
197
|
/>
|
|
@@ -273,12 +199,12 @@ const BulkActionsBar = ({
|
|
|
273
199
|
)}
|
|
274
200
|
{showDelete && (
|
|
275
201
|
<>
|
|
276
|
-
<Button variant="danger-light" onClick={
|
|
202
|
+
<Button variant="danger-light" onClick={toggleDeleteDialog}>
|
|
277
203
|
{formatMessage({ id: 'global.delete', defaultMessage: 'Delete' })}
|
|
278
204
|
</Button>
|
|
279
205
|
<ConfirmDialogDeleteAll
|
|
280
206
|
isOpen={dialogToOpen === 'delete'}
|
|
281
|
-
onToggleDialog={
|
|
207
|
+
onToggleDialog={toggleDeleteDialog}
|
|
282
208
|
isConfirmButtonLoading={isConfirmButtonLoading}
|
|
283
209
|
onConfirm={handleBulkDelete}
|
|
284
210
|
/>
|
|
@@ -288,22 +214,20 @@ const BulkActionsBar = ({
|
|
|
288
214
|
);
|
|
289
215
|
};
|
|
290
216
|
|
|
291
|
-
|
|
217
|
+
BulkActionButtons.defaultProps = {
|
|
292
218
|
showPublish: false,
|
|
293
219
|
showDelete: false,
|
|
294
220
|
onConfirmDeleteAll() {},
|
|
295
|
-
onConfirmPublishAll() {},
|
|
296
221
|
onConfirmUnpublishAll() {},
|
|
222
|
+
refetchData() {},
|
|
297
223
|
};
|
|
298
224
|
|
|
299
|
-
|
|
225
|
+
BulkActionButtons.propTypes = {
|
|
300
226
|
showPublish: PropTypes.bool,
|
|
301
227
|
showDelete: PropTypes.bool,
|
|
302
228
|
onConfirmDeleteAll: PropTypes.func,
|
|
303
|
-
onConfirmPublishAll: PropTypes.func,
|
|
304
229
|
onConfirmUnpublishAll: PropTypes.func,
|
|
305
|
-
|
|
306
|
-
clearSelectedEntries: PropTypes.func.isRequired,
|
|
230
|
+
refetchData: PropTypes.func,
|
|
307
231
|
};
|
|
308
232
|
|
|
309
|
-
export default
|
|
233
|
+
export default BulkActionButtons;
|
package/admin/src/content-manager/pages/ListView/components/CellContent/RelationMultiple/index.js
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
Flex,
|
|
7
|
-
Loader,
|
|
8
|
-
MenuItem,
|
|
9
|
-
SimpleMenu,
|
|
10
|
-
Typography,
|
|
11
|
-
useNotifyAT,
|
|
12
|
-
} from '@strapi/design-system';
|
|
13
|
-
import { stopPropagation, useFetchClient } from '@strapi/helper-plugin';
|
|
3
|
+
import { Badge, Flex, Loader, Typography, useNotifyAT } from '@strapi/design-system';
|
|
4
|
+
import { Menu } from '@strapi/design-system/v2';
|
|
5
|
+
import { useFetchClient } from '@strapi/helper-plugin';
|
|
14
6
|
import PropTypes from 'prop-types';
|
|
15
7
|
import { useIntl } from 'react-intl';
|
|
16
8
|
import { useQuery } from 'react-query';
|
|
@@ -19,54 +11,24 @@ import styled from 'styled-components';
|
|
|
19
11
|
import { getRequestUrl, getTrad } from '../../../../../utils';
|
|
20
12
|
import CellValue from '../CellValue';
|
|
21
13
|
|
|
22
|
-
const TypographyMaxWidth = styled(Typography)`
|
|
23
|
-
max-width: 500px;
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
const fetchRelation = async (endPoint, notifyStatus, get) => {
|
|
27
|
-
const {
|
|
28
|
-
data: { results, pagination },
|
|
29
|
-
} = await get(endPoint);
|
|
30
|
-
|
|
31
|
-
notifyStatus();
|
|
32
|
-
|
|
33
|
-
return { results, pagination };
|
|
34
|
-
};
|
|
35
|
-
|
|
36
14
|
const RelationMultiple = ({ fieldSchema, metadatas, name, entityId, value, contentType }) => {
|
|
37
15
|
const { formatMessage } = useIntl();
|
|
38
16
|
const { notifyStatus } = useNotifyAT();
|
|
39
|
-
const relationFetchEndpoint = useMemo(
|
|
40
|
-
() => getRequestUrl(`relations/${contentType.uid}/${entityId}/${name.split('.')[0]}`),
|
|
41
|
-
[entityId, name, contentType]
|
|
42
|
-
);
|
|
43
17
|
const [isOpen, setIsOpen] = useState(false);
|
|
44
|
-
const { get } = useFetchClient();
|
|
45
|
-
|
|
46
|
-
const Label = (
|
|
47
|
-
<Flex gap={1} wrap="nowrap">
|
|
48
|
-
<Badge>{value.count}</Badge>
|
|
49
|
-
{formatMessage(
|
|
50
|
-
{
|
|
51
|
-
id: 'content-manager.containers.ListPage.items',
|
|
52
|
-
defaultMessage: '{number, plural, =0 {items} one {item} other {items}}',
|
|
53
|
-
},
|
|
54
|
-
{ number: value.count }
|
|
55
|
-
)}
|
|
56
|
-
</Flex>
|
|
57
|
-
);
|
|
58
18
|
|
|
59
|
-
const
|
|
60
|
-
const message = formatMessage({
|
|
61
|
-
id: getTrad('DynamicTable.relation-loaded'),
|
|
62
|
-
defaultMessage: 'Relations have been loaded',
|
|
63
|
-
});
|
|
64
|
-
notifyStatus(message);
|
|
65
|
-
};
|
|
19
|
+
const { get } = useFetchClient();
|
|
66
20
|
|
|
67
21
|
const { data, status } = useQuery(
|
|
68
22
|
[fieldSchema.targetModel, entityId],
|
|
69
|
-
() =>
|
|
23
|
+
async () => {
|
|
24
|
+
const {
|
|
25
|
+
data: { results, pagination },
|
|
26
|
+
} = await get(
|
|
27
|
+
getRequestUrl(`relations/${contentType.uid}/${entityId}/${name.split('.')[0]}`)
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
return { results, pagination };
|
|
31
|
+
},
|
|
70
32
|
{
|
|
71
33
|
enabled: isOpen,
|
|
72
34
|
staleTime: 0,
|
|
@@ -77,53 +39,71 @@ const RelationMultiple = ({ fieldSchema, metadatas, name, entityId, value, conte
|
|
|
77
39
|
}
|
|
78
40
|
);
|
|
79
41
|
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (data) {
|
|
44
|
+
notifyStatus(
|
|
45
|
+
formatMessage({
|
|
46
|
+
id: getTrad('DynamicTable.relation-loaded'),
|
|
47
|
+
defaultMessage: 'Relations have been loaded',
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}, [data, formatMessage, notifyStatus]);
|
|
52
|
+
|
|
80
53
|
return (
|
|
81
|
-
<
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
54
|
+
<Menu.Root onOpenChange={(isOpen) => setIsOpen(isOpen)}>
|
|
55
|
+
<MenuTrigger onClick={(e) => e.stopPropagation()}>
|
|
56
|
+
<Flex gap={1} wrap="nowrap">
|
|
57
|
+
<Badge>{value.count}</Badge>
|
|
58
|
+
{formatMessage(
|
|
59
|
+
{
|
|
60
|
+
id: 'content-manager.containers.ListPage.items',
|
|
61
|
+
defaultMessage: '{number, plural, =0 {items} one {item} other {items}}',
|
|
62
|
+
},
|
|
63
|
+
{ number: value.count }
|
|
64
|
+
)}
|
|
65
|
+
</Flex>
|
|
66
|
+
</MenuTrigger>
|
|
67
|
+
<Menu.Content>
|
|
88
68
|
{status !== 'success' && (
|
|
89
|
-
<
|
|
69
|
+
<Menu.Item disabled>
|
|
90
70
|
<Loader small>
|
|
91
71
|
{formatMessage({
|
|
92
|
-
id: getTrad('
|
|
72
|
+
id: getTrad('ListViewTable.relation-loading'),
|
|
93
73
|
defaultMessage: 'Relations are loading',
|
|
94
74
|
})}
|
|
95
75
|
</Loader>
|
|
96
|
-
</
|
|
76
|
+
</Menu.Item>
|
|
97
77
|
)}
|
|
98
78
|
|
|
99
79
|
{status === 'success' && (
|
|
100
80
|
<>
|
|
101
81
|
{data?.results.map((entry) => (
|
|
102
|
-
<
|
|
82
|
+
<Menu.Item key={entry.id} disabled>
|
|
103
83
|
<TypographyMaxWidth ellipsis>
|
|
104
84
|
<CellValue
|
|
105
85
|
type={metadatas.mainField.schema.type}
|
|
106
86
|
value={entry[metadatas.mainField.name] || entry.id}
|
|
107
87
|
/>
|
|
108
88
|
</TypographyMaxWidth>
|
|
109
|
-
</
|
|
89
|
+
</Menu.Item>
|
|
110
90
|
))}
|
|
111
91
|
|
|
112
92
|
{data?.pagination.total > 10 && (
|
|
113
|
-
<
|
|
93
|
+
<Menu.Item
|
|
114
94
|
aria-disabled
|
|
115
95
|
aria-label={formatMessage({
|
|
116
|
-
id: getTrad('
|
|
96
|
+
id: getTrad('ListViewTable.relation-more'),
|
|
117
97
|
defaultMessage: 'This relation contains more entities than displayed',
|
|
118
98
|
})}
|
|
119
99
|
>
|
|
120
100
|
<Typography>…</Typography>
|
|
121
|
-
</
|
|
101
|
+
</Menu.Item>
|
|
122
102
|
)}
|
|
123
103
|
</>
|
|
124
104
|
)}
|
|
125
|
-
</
|
|
126
|
-
</
|
|
105
|
+
</Menu.Content>
|
|
106
|
+
</Menu.Root>
|
|
127
107
|
);
|
|
128
108
|
};
|
|
129
109
|
|
|
@@ -147,4 +127,18 @@ RelationMultiple.propTypes = {
|
|
|
147
127
|
value: PropTypes.object.isRequired,
|
|
148
128
|
};
|
|
149
129
|
|
|
130
|
+
const TypographyMaxWidth = styled(Typography)`
|
|
131
|
+
max-width: 500px;
|
|
132
|
+
`;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* TODO: this needs to be solved in the Design-System
|
|
136
|
+
*/
|
|
137
|
+
const MenuTrigger = styled(Menu.Trigger)`
|
|
138
|
+
svg {
|
|
139
|
+
width: ${6 / 16}rem;
|
|
140
|
+
height: ${4 / 16}rem;
|
|
141
|
+
}
|
|
142
|
+
`;
|
|
143
|
+
|
|
150
144
|
export default RelationMultiple;
|
package/admin/src/content-manager/pages/ListView/components/CellContent/RepeatableComponent/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { Badge,
|
|
4
|
-
import {
|
|
3
|
+
import { Badge, Typography } from '@strapi/design-system';
|
|
4
|
+
import { Menu } from '@strapi/design-system/v2';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useIntl } from 'react-intl';
|
|
7
7
|
import styled from 'styled-components';
|
|
@@ -18,31 +18,28 @@ const RepeatableComponentCell = ({ value, metadatas }) => {
|
|
|
18
18
|
mainField: { type: mainFieldType, name: mainFieldName },
|
|
19
19
|
} = metadatas;
|
|
20
20
|
|
|
21
|
-
const Label = (
|
|
22
|
-
<>
|
|
23
|
-
<Badge>{value.length}</Badge>{' '}
|
|
24
|
-
{formatMessage(
|
|
25
|
-
{
|
|
26
|
-
id: 'content-manager.containers.ListPage.items',
|
|
27
|
-
defaultMessage: '{number, plural, =0 {items} one {item} other {items}}',
|
|
28
|
-
},
|
|
29
|
-
{ number: value.length }
|
|
30
|
-
)}
|
|
31
|
-
</>
|
|
32
|
-
);
|
|
33
|
-
|
|
34
21
|
return (
|
|
35
|
-
<
|
|
36
|
-
<
|
|
22
|
+
<Menu.Root>
|
|
23
|
+
<MenuTrigger onClick={(e) => e.stopPropagation()}>
|
|
24
|
+
<Badge>{value.length}</Badge>{' '}
|
|
25
|
+
{formatMessage(
|
|
26
|
+
{
|
|
27
|
+
id: 'content-manager.containers.ListPage.items',
|
|
28
|
+
defaultMessage: '{number, plural, =0 {items} one {item} other {items}}',
|
|
29
|
+
},
|
|
30
|
+
{ number: value.length }
|
|
31
|
+
)}
|
|
32
|
+
</MenuTrigger>
|
|
33
|
+
<Menu.Content>
|
|
37
34
|
{value.map((item) => (
|
|
38
|
-
<
|
|
35
|
+
<Menu.Item key={item.id} disabled>
|
|
39
36
|
<TypographyMaxWidth ellipsis>
|
|
40
37
|
<CellValue type={mainFieldType} value={item[mainFieldName] || item.id} />
|
|
41
38
|
</TypographyMaxWidth>
|
|
42
|
-
</
|
|
39
|
+
</Menu.Item>
|
|
43
40
|
))}
|
|
44
|
-
</
|
|
45
|
-
</
|
|
41
|
+
</Menu.Content>
|
|
42
|
+
</Menu.Root>
|
|
46
43
|
);
|
|
47
44
|
};
|
|
48
45
|
|
|
@@ -57,4 +54,14 @@ RepeatableComponentCell.propTypes = {
|
|
|
57
54
|
value: PropTypes.array.isRequired,
|
|
58
55
|
};
|
|
59
56
|
|
|
57
|
+
/**
|
|
58
|
+
* TODO: this needs to be solved in the Design-System
|
|
59
|
+
*/
|
|
60
|
+
const MenuTrigger = styled(Menu.Trigger)`
|
|
61
|
+
svg {
|
|
62
|
+
width: ${6 / 16}rem;
|
|
63
|
+
height: ${4 / 16}rem;
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
|
|
60
67
|
export default RepeatableComponentCell;
|