@strapi/i18n 0.0.0-experimental.d53e940834bf72ddc725f1d2fd36dac9abec30cb → 0.0.0-experimental.d6bba97c7ed8309e57888e84d4788fa279d473fd
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/LICENSE +18 -3
- package/dist/_chunks/{SettingsPage-w9zz705o.mjs → SettingsPage-BAx9nmep.mjs} +8 -8
- package/dist/_chunks/SettingsPage-BAx9nmep.mjs.map +1 -0
- package/dist/_chunks/{SettingsPage-CxZ9qSb_.js → SettingsPage-BTgjb2KS.js} +9 -10
- package/dist/_chunks/SettingsPage-BTgjb2KS.js.map +1 -0
- package/dist/_chunks/{en-BsOU9o5z.js → en-BKBz3tro.js} +10 -3
- package/dist/_chunks/en-BKBz3tro.js.map +1 -0
- package/dist/_chunks/{en-CM6Pjfyv.mjs → en-DlXfy6Gy.mjs} +10 -3
- package/dist/_chunks/en-DlXfy6Gy.mjs.map +1 -0
- package/dist/_chunks/{index-CLtneDAv.js → index-3yyF237r.js} +433 -187
- package/dist/_chunks/index-3yyF237r.js.map +1 -0
- package/dist/_chunks/{index-jbI6Njjb.mjs → index-B0NijiBB.mjs} +428 -181
- package/dist/_chunks/index-B0NijiBB.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/BulkLocaleActionModal.d.ts +2 -1
- package/dist/admin/src/components/CMHeaderActions.d.ts +29 -3
- package/dist/admin/src/components/CreateLocale.d.ts +6 -6
- package/dist/admin/src/contentReleasesHooks/releaseDetailsView.d.ts +9 -5
- package/dist/admin/src/utils/clean.d.ts +4 -0
- package/dist/admin/src/utils/schemas.d.ts +1 -0
- package/dist/server/index.js +414 -482
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +415 -482
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts +1 -4
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +21 -13
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +20 -10
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/permissions/actions.d.ts +14 -2
- package/dist/server/src/services/permissions/actions.d.ts.map +1 -1
- package/dist/server/src/services/permissions.d.ts +14 -2
- package/dist/server/src/services/permissions.d.ts.map +1 -1
- package/dist/server/src/services/sanitize/index.d.ts +11 -0
- package/dist/server/src/services/sanitize/index.d.ts.map +1 -0
- package/dist/server/src/utils/index.d.ts +2 -2
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/package.json +13 -13
- package/dist/_chunks/SettingsPage-CxZ9qSb_.js.map +0 -1
- package/dist/_chunks/SettingsPage-w9zz705o.mjs.map +0 -1
- package/dist/_chunks/en-BsOU9o5z.js.map +0 -1
- package/dist/_chunks/en-CM6Pjfyv.mjs.map +0 -1
- package/dist/_chunks/index-CLtneDAv.js.map +0 -1
- package/dist/_chunks/index-jbI6Njjb.mjs.map +0 -1
- package/dist/admin/src/components/Initializer.d.ts +0 -5
- package/dist/server/src/migrations/content-type/disable/index.d.ts +0 -3
- package/dist/server/src/migrations/content-type/disable/index.d.ts.map +0 -1
- package/dist/server/src/migrations/content-type/enable/index.d.ts +0 -3
- package/dist/server/src/migrations/content-type/enable/index.d.ts.map +0 -1
- package/dist/server/src/services/entity-service-decorator.d.ts +0 -29
- package/dist/server/src/services/entity-service-decorator.d.ts.map +0 -1
- package/strapi-server.js +0 -3
@@ -1,24 +1,32 @@
|
|
1
1
|
import get from "lodash/get";
|
2
2
|
import * as yup from "yup";
|
3
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
3
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
4
4
|
import * as React from "react";
|
5
|
-
import { Typography, Dialog, Field, Checkbox, Flex, Button
|
6
|
-
import { WarningCircle, Pencil, CrossCircle, CheckCircle, ArrowsCounterClockwise, Trash, ListPlus, Earth, EarthStriked, CaretDown } from "@strapi/icons";
|
5
|
+
import { Typography, Dialog, Field, Checkbox, Flex, Button, Modal, Box, Status, IconButton, Tooltip, SingleSelect, SingleSelectOption, VisuallyHidden, useCollator, Popover } from "@strapi/design-system";
|
6
|
+
import { WarningCircle, Pencil, CrossCircle, CheckCircle, ArrowsCounterClockwise, Trash, Plus, Download, ListPlus, Cross, Earth, EarthStriked, CaretDown } from "@strapi/icons";
|
7
7
|
import { useIntl } from "react-intl";
|
8
8
|
import { styled } from "styled-components";
|
9
|
-
import {
|
9
|
+
import { skipToken } from "@reduxjs/toolkit/query";
|
10
|
+
import { useAuth, adminApi, useTable, Table, useQueryParams, useForm, useNotification, useAPIErrorHandler } from "@strapi/admin/strapi-admin";
|
10
11
|
import { unstable_useDocument, unstable_useDocumentActions, buildValidParams } from "@strapi/content-manager/strapi-admin";
|
11
12
|
import { useParams, Link, useNavigate, matchPath } from "react-router-dom";
|
12
13
|
import * as qs from "qs";
|
13
14
|
import { stringify } from "qs";
|
14
15
|
import omit from "lodash/omit";
|
15
|
-
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
16
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
16
17
|
const v = glob[path];
|
17
18
|
if (v) {
|
18
19
|
return typeof v === "function" ? v() : Promise.resolve(v);
|
19
20
|
}
|
20
21
|
return new Promise((_, reject) => {
|
21
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
22
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
23
|
+
reject.bind(
|
24
|
+
null,
|
25
|
+
new Error(
|
26
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
27
|
+
)
|
28
|
+
)
|
29
|
+
);
|
22
30
|
});
|
23
31
|
};
|
24
32
|
const pluginId = "i18n";
|
@@ -77,11 +85,11 @@ const CheckboxConfirmation = ({
|
|
77
85
|
}) }) })
|
78
86
|
] }) }),
|
79
87
|
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
80
|
-
/* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button
|
88
|
+
/* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", children: formatMessage({
|
81
89
|
id: "components.popUpWarning.button.cancel",
|
82
90
|
defaultMessage: "No, cancel"
|
83
91
|
}) }) }),
|
84
|
-
/* @__PURE__ */ jsx(Dialog.Action, { children: /* @__PURE__ */ jsx(Button
|
92
|
+
/* @__PURE__ */ jsx(Dialog.Action, { children: /* @__PURE__ */ jsx(Button, { variant: "danger-light", onClick: handleConfirm, children: formatMessage({
|
85
93
|
id: getTranslation("CheckboxConfirmation.Modal.button-confirm"),
|
86
94
|
defaultMessage: "Yes, disable"
|
87
95
|
}) }) })
|
@@ -136,7 +144,7 @@ const useI18n = () => {
|
|
136
144
|
model: params.slug
|
137
145
|
},
|
138
146
|
{
|
139
|
-
skip:
|
147
|
+
skip: true
|
140
148
|
}
|
141
149
|
);
|
142
150
|
if (doesPluginOptionsHaveI18nLocalized(schema?.pluginOptions)) {
|
@@ -216,10 +224,94 @@ const relationsApi = i18nApi.injectEndpoints({
|
|
216
224
|
})
|
217
225
|
});
|
218
226
|
const { useGetManyDraftRelationCountQuery } = relationsApi;
|
227
|
+
const cleanData = (data, schema, components) => {
|
228
|
+
const cleanedData = removeFields(data, [
|
229
|
+
"createdAt",
|
230
|
+
"createdBy",
|
231
|
+
"updatedAt",
|
232
|
+
"updatedBy",
|
233
|
+
"id",
|
234
|
+
"documentId",
|
235
|
+
"publishedAt",
|
236
|
+
"strapi_stage",
|
237
|
+
"strapi_assignee",
|
238
|
+
"locale",
|
239
|
+
"status"
|
240
|
+
]);
|
241
|
+
const cleanedDataWithoutPasswordAndRelation = recursiveRemoveFieldTypes(
|
242
|
+
cleanedData,
|
243
|
+
schema,
|
244
|
+
components,
|
245
|
+
["relation", "password"]
|
246
|
+
);
|
247
|
+
return cleanedDataWithoutPasswordAndRelation;
|
248
|
+
};
|
249
|
+
const removeFields = (data, fields) => {
|
250
|
+
return Object.keys(data).reduce((acc, current) => {
|
251
|
+
if (fields.includes(current)) {
|
252
|
+
return acc;
|
253
|
+
}
|
254
|
+
acc[current] = data[current];
|
255
|
+
return acc;
|
256
|
+
}, {});
|
257
|
+
};
|
258
|
+
const recursiveRemoveFieldTypes = (data, schema, components, fields) => {
|
259
|
+
return Object.keys(data).reduce((acc, current) => {
|
260
|
+
const attribute = schema.attributes[current] ?? { type: void 0 };
|
261
|
+
if (fields.includes(attribute.type)) {
|
262
|
+
return acc;
|
263
|
+
}
|
264
|
+
if (attribute.type === "dynamiczone") {
|
265
|
+
acc[current] = data[current].map((componentValue, index2) => {
|
266
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
267
|
+
componentValue,
|
268
|
+
components[componentValue.__component],
|
269
|
+
components,
|
270
|
+
fields
|
271
|
+
);
|
272
|
+
return {
|
273
|
+
...rest,
|
274
|
+
__temp_key__: index2 + 1
|
275
|
+
};
|
276
|
+
});
|
277
|
+
} else if (attribute.type === "component") {
|
278
|
+
const { repeatable, component } = attribute;
|
279
|
+
if (repeatable) {
|
280
|
+
acc[current] = (data[current] ?? []).map((compoData, index2) => {
|
281
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
282
|
+
compoData,
|
283
|
+
components[component],
|
284
|
+
components,
|
285
|
+
fields
|
286
|
+
);
|
287
|
+
return {
|
288
|
+
...rest,
|
289
|
+
__temp_key__: index2 + 1
|
290
|
+
};
|
291
|
+
});
|
292
|
+
} else {
|
293
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
294
|
+
data[current] ?? {},
|
295
|
+
components[component],
|
296
|
+
components,
|
297
|
+
fields
|
298
|
+
);
|
299
|
+
acc[current] = rest;
|
300
|
+
}
|
301
|
+
} else {
|
302
|
+
acc[current] = data[current];
|
303
|
+
}
|
304
|
+
return acc;
|
305
|
+
}, {});
|
306
|
+
};
|
219
307
|
const isErrorMessageDescriptor = (object) => {
|
220
308
|
return typeof object === "object" && object !== null && "id" in object && "defaultMessage" in object;
|
221
309
|
};
|
222
|
-
const EntryValidationText = ({
|
310
|
+
const EntryValidationText = ({
|
311
|
+
status = "draft",
|
312
|
+
validationErrors,
|
313
|
+
action
|
314
|
+
}) => {
|
223
315
|
const { formatMessage } = useIntl();
|
224
316
|
const getErrorStr = (key, value) => {
|
225
317
|
if (typeof value === "string") {
|
@@ -253,30 +345,63 @@ const EntryValidationText = ({ status = "draft", validationErrors }) => {
|
|
253
345
|
) })
|
254
346
|
] });
|
255
347
|
}
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
348
|
+
const getStatusMessage = () => {
|
349
|
+
if (action === "bulk-publish") {
|
350
|
+
if (status === "published") {
|
351
|
+
return {
|
352
|
+
icon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
353
|
+
text: formatMessage({
|
354
|
+
id: "content-manager.bulk-publish.already-published",
|
355
|
+
defaultMessage: "Already Published"
|
356
|
+
}),
|
357
|
+
textColor: "success600",
|
358
|
+
fontWeight: "bold"
|
359
|
+
};
|
360
|
+
} else if (status === "modified") {
|
361
|
+
return {
|
362
|
+
icon: /* @__PURE__ */ jsx(ArrowsCounterClockwise, { fill: "alternative600" }),
|
363
|
+
text: formatMessage({
|
364
|
+
id: "app.utils.ready-to-publish-changes",
|
365
|
+
defaultMessage: "Ready to publish changes"
|
366
|
+
})
|
367
|
+
};
|
368
|
+
} else {
|
369
|
+
return {
|
370
|
+
icon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
371
|
+
text: formatMessage({
|
372
|
+
id: "app.utils.ready-to-publish",
|
373
|
+
defaultMessage: "Ready to publish"
|
374
|
+
})
|
375
|
+
};
|
376
|
+
}
|
377
|
+
} else {
|
378
|
+
if (status === "draft") {
|
379
|
+
return {
|
380
|
+
icon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
381
|
+
text: formatMessage({
|
382
|
+
id: "content-manager.bulk-unpublish.already-unpublished",
|
383
|
+
defaultMessage: "Already Unpublished"
|
384
|
+
}),
|
385
|
+
textColor: "success600",
|
386
|
+
fontWeight: "bold"
|
387
|
+
};
|
388
|
+
} else {
|
389
|
+
return {
|
390
|
+
icon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
391
|
+
text: formatMessage({
|
392
|
+
id: "app.utils.ready-to-unpublish-changes",
|
393
|
+
defaultMessage: "Ready to unpublish"
|
394
|
+
}),
|
395
|
+
textColor: "success600",
|
396
|
+
fontWeight: "bold"
|
397
|
+
};
|
398
|
+
}
|
399
|
+
}
|
400
|
+
};
|
401
|
+
const { icon, text, textColor = "success600", fontWeight = "normal" } = getStatusMessage();
|
274
402
|
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
275
|
-
|
276
|
-
/* @__PURE__ */ jsx(Typography, { children:
|
277
|
-
id: "app.utils.ready-to-publish",
|
278
|
-
defaultMessage: "Ready to publish"
|
279
|
-
}) })
|
403
|
+
icon,
|
404
|
+
/* @__PURE__ */ jsx(Typography, { textColor, fontWeight, children: text })
|
280
405
|
] });
|
281
406
|
};
|
282
407
|
const BoldChunk = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: chunks });
|
@@ -284,7 +409,8 @@ const BulkLocaleActionModal = ({
|
|
284
409
|
headers,
|
285
410
|
rows,
|
286
411
|
localesMetadata,
|
287
|
-
validationErrors = {}
|
412
|
+
validationErrors = {},
|
413
|
+
action
|
288
414
|
}) => {
|
289
415
|
const { formatMessage } = useIntl();
|
290
416
|
const selectedRows = useTable(
|
@@ -297,27 +423,29 @@ const BulkLocaleActionModal = ({
|
|
297
423
|
return acc;
|
298
424
|
}, {});
|
299
425
|
const localesWithErrors = Object.keys(validationErrors);
|
300
|
-
const
|
426
|
+
const publishedCount = selectedRows.filter(
|
301
427
|
({ locale }) => currentStatusByLocale[locale] === "published"
|
302
428
|
).length;
|
303
|
-
const
|
429
|
+
const draftCount = selectedRows.filter(
|
304
430
|
({ locale }) => (currentStatusByLocale[locale] === "draft" || currentStatusByLocale[locale] === "modified") && !localesWithErrors.includes(locale)
|
305
431
|
).length;
|
306
432
|
const withErrorsCount = localesWithErrors.length;
|
433
|
+
const messageId = action === "bulk-publish" ? "content-manager.containers.list.selectedEntriesModal.selectedCount.publish" : "content-manager.containers.list.selectedEntriesModal.selectedCount.unpublish";
|
434
|
+
const defaultMessage = action === "bulk-publish" ? "<b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} already published. <b>{draftCount}</b> {draftCount, plural, =0 {entries} one {entry} other {entries}} ready to publish. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action." : "<b>{draftCount}</b> {draftCount, plural, =0 {entries} one {entry} other {entries}} already unpublished. <b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} ready to unpublish.";
|
307
435
|
return formatMessage(
|
308
436
|
{
|
309
|
-
id:
|
310
|
-
defaultMessage
|
437
|
+
id: messageId,
|
438
|
+
defaultMessage
|
311
439
|
},
|
312
440
|
{
|
313
441
|
withErrorsCount,
|
314
|
-
|
315
|
-
|
442
|
+
draftCount,
|
443
|
+
publishedCount,
|
316
444
|
b: BoldChunk
|
317
445
|
}
|
318
446
|
);
|
319
447
|
};
|
320
|
-
return /* @__PURE__ */ jsxs(
|
448
|
+
return /* @__PURE__ */ jsxs(Modal.Body, { children: [
|
321
449
|
/* @__PURE__ */ jsx(Typography, { children: getFormattedCountMessage() }),
|
322
450
|
/* @__PURE__ */ jsx(Box, { marginTop: 5, children: /* @__PURE__ */ jsxs(Table.Content, { children: [
|
323
451
|
/* @__PURE__ */ jsxs(Table.Head, { children: [
|
@@ -338,13 +466,12 @@ const BulkLocaleActionModal = ({
|
|
338
466
|
paddingRight: "6px",
|
339
467
|
paddingTop: "2px",
|
340
468
|
paddingBottom: "2px",
|
341
|
-
showBullet: false,
|
342
469
|
size: "S",
|
343
470
|
variant: statusVariant,
|
344
471
|
children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
345
472
|
}
|
346
473
|
) }) }),
|
347
|
-
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(EntryValidationText, { validationErrors: error, status }) }),
|
474
|
+
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(EntryValidationText, { validationErrors: error, status, action }) }),
|
348
475
|
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(
|
349
476
|
IconButton,
|
350
477
|
{
|
@@ -361,7 +488,7 @@ const BulkLocaleActionModal = ({
|
|
361
488
|
name: locale
|
362
489
|
}
|
363
490
|
),
|
364
|
-
|
491
|
+
variant: "ghost",
|
365
492
|
children: /* @__PURE__ */ jsx(Pencil, {})
|
366
493
|
}
|
367
494
|
) })
|
@@ -370,6 +497,47 @@ const BulkLocaleActionModal = ({
|
|
370
497
|
] }) })
|
371
498
|
] });
|
372
499
|
};
|
500
|
+
const statusVariants = {
|
501
|
+
draft: "secondary",
|
502
|
+
published: "success",
|
503
|
+
modified: "alternative"
|
504
|
+
};
|
505
|
+
const LocaleOption = ({
|
506
|
+
isDraftAndPublishEnabled,
|
507
|
+
locale,
|
508
|
+
status,
|
509
|
+
entryExists
|
510
|
+
}) => {
|
511
|
+
const { formatMessage } = useIntl();
|
512
|
+
if (!entryExists) {
|
513
|
+
return formatMessage(
|
514
|
+
{
|
515
|
+
id: getTranslation("CMEditViewLocalePicker.locale.create"),
|
516
|
+
defaultMessage: "Create <bold>{locale}</bold> locale"
|
517
|
+
},
|
518
|
+
{
|
519
|
+
bold: (locale2) => /* @__PURE__ */ jsx("b", { children: locale2 }),
|
520
|
+
locale: locale.name
|
521
|
+
}
|
522
|
+
);
|
523
|
+
}
|
524
|
+
return /* @__PURE__ */ jsxs(Flex, { width: "100%", gap: 1, justifyContent: "space-between", children: [
|
525
|
+
/* @__PURE__ */ jsx(Typography, { children: locale.name }),
|
526
|
+
isDraftAndPublishEnabled ? /* @__PURE__ */ jsx(
|
527
|
+
Status,
|
528
|
+
{
|
529
|
+
display: "flex",
|
530
|
+
paddingLeft: "6px",
|
531
|
+
paddingRight: "6px",
|
532
|
+
paddingTop: "2px",
|
533
|
+
paddingBottom: "2px",
|
534
|
+
size: "S",
|
535
|
+
variant: statusVariants[status],
|
536
|
+
children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
537
|
+
}
|
538
|
+
) : null
|
539
|
+
] });
|
540
|
+
};
|
373
541
|
const LocalePickerAction = ({
|
374
542
|
document,
|
375
543
|
meta,
|
@@ -381,7 +549,13 @@ const LocalePickerAction = ({
|
|
381
549
|
const [{ query }, setQuery] = useQueryParams();
|
382
550
|
const { hasI18n, canCreate, canRead } = useI18n();
|
383
551
|
const { data: locales = [] } = useGetLocalesQuery();
|
384
|
-
const
|
552
|
+
const currentDesiredLocale = query.plugins?.i18n?.locale;
|
553
|
+
const { schema } = unstable_useDocument({
|
554
|
+
model,
|
555
|
+
collectionType,
|
556
|
+
documentId,
|
557
|
+
params: { locale: currentDesiredLocale }
|
558
|
+
});
|
385
559
|
const handleSelect = React.useCallback(
|
386
560
|
(value) => {
|
387
561
|
setQuery({
|
@@ -399,53 +573,50 @@ const LocalePickerAction = ({
|
|
399
573
|
if (!Array.isArray(locales) || !hasI18n) {
|
400
574
|
return;
|
401
575
|
}
|
402
|
-
const currentDesiredLocale = query.plugins?.i18n?.locale;
|
403
576
|
const doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);
|
404
577
|
const defaultLocale = locales.find((locale) => locale.isDefault);
|
405
578
|
if (!doesLocaleExist && defaultLocale?.code) {
|
406
579
|
handleSelect(defaultLocale.code);
|
407
580
|
}
|
408
|
-
}, [handleSelect, hasI18n, locales,
|
409
|
-
|
410
|
-
return null;
|
411
|
-
}
|
412
|
-
const currentLocale = query.plugins?.i18n?.locale || locales.find((loc) => loc.isDefault)?.code;
|
581
|
+
}, [handleSelect, hasI18n, locales, currentDesiredLocale]);
|
582
|
+
const currentLocale = Array.isArray(locales) ? locales.find((locale) => locale.code === currentDesiredLocale) : void 0;
|
413
583
|
const allCurrentLocales = [
|
414
|
-
{ status: getDocumentStatus(document, meta), locale: currentLocale },
|
584
|
+
{ status: getDocumentStatus(document, meta), locale: currentLocale?.code },
|
415
585
|
...meta?.availableLocales ?? []
|
416
586
|
];
|
587
|
+
if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {
|
588
|
+
return null;
|
589
|
+
}
|
590
|
+
const displayedLocales = locales.filter((locale) => {
|
591
|
+
return canRead.includes(locale.code);
|
592
|
+
});
|
417
593
|
return {
|
418
594
|
label: formatMessage({
|
419
595
|
id: getTranslation("Settings.locales.modal.locales.label"),
|
420
596
|
defaultMessage: "Locales"
|
421
597
|
}),
|
422
|
-
options:
|
598
|
+
options: displayedLocales.map((locale) => {
|
599
|
+
const entryWithLocaleExists = allCurrentLocales.some((doc) => doc.locale === locale.code);
|
423
600
|
const currentLocaleDoc = allCurrentLocales.find(
|
424
601
|
(doc) => "locale" in doc ? doc.locale === locale.code : false
|
425
602
|
);
|
426
|
-
const
|
427
|
-
const permissionsToCheck = currentLocaleDoc ? canCreate : canRead;
|
428
|
-
const statusVariant = status === "draft" ? "primary" : status === "published" ? "success" : "alternative";
|
603
|
+
const permissionsToCheck = currentLocaleDoc ? canRead : canCreate;
|
429
604
|
return {
|
430
605
|
disabled: !permissionsToCheck.includes(locale.code),
|
431
606
|
value: locale.code,
|
432
|
-
label:
|
433
|
-
|
434
|
-
Status,
|
607
|
+
label: /* @__PURE__ */ jsx(
|
608
|
+
LocaleOption,
|
435
609
|
{
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
paddingBottom: "2px",
|
441
|
-
showBullet: false,
|
442
|
-
size: "S",
|
443
|
-
variant: statusVariant,
|
444
|
-
children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
610
|
+
isDraftAndPublishEnabled: !!schema?.options?.draftAndPublish,
|
611
|
+
locale,
|
612
|
+
status: currentLocaleDoc?.status,
|
613
|
+
entryExists: entryWithLocaleExists
|
445
614
|
}
|
446
|
-
)
|
615
|
+
),
|
616
|
+
startIcon: !entryWithLocaleExists ? /* @__PURE__ */ jsx(Plus, {}) : null
|
447
617
|
};
|
448
618
|
}),
|
619
|
+
customizeContent: () => currentLocale?.name,
|
449
620
|
onSelect: handleSelect,
|
450
621
|
value: currentLocale
|
451
622
|
};
|
@@ -461,6 +632,99 @@ const getDocumentStatus = (document, meta) => {
|
|
461
632
|
}
|
462
633
|
return docStatus;
|
463
634
|
};
|
635
|
+
const FillFromAnotherLocaleAction = ({
|
636
|
+
documentId,
|
637
|
+
meta,
|
638
|
+
model,
|
639
|
+
collectionType
|
640
|
+
}) => {
|
641
|
+
const { formatMessage } = useIntl();
|
642
|
+
const [{ query }] = useQueryParams();
|
643
|
+
const { hasI18n } = useI18n();
|
644
|
+
const currentDesiredLocale = query.plugins?.i18n?.locale;
|
645
|
+
const [localeSelected, setLocaleSelected] = React.useState(null);
|
646
|
+
const setValues = useForm("FillFromAnotherLocale", (state) => state.setValues);
|
647
|
+
const { getDocument } = unstable_useDocumentActions();
|
648
|
+
const { schema, components } = unstable_useDocument({
|
649
|
+
model,
|
650
|
+
documentId,
|
651
|
+
collectionType,
|
652
|
+
params: { locale: currentDesiredLocale }
|
653
|
+
});
|
654
|
+
const { data: locales = [] } = useGetLocalesQuery();
|
655
|
+
const availableLocales = Array.isArray(locales) ? locales.filter((locale) => meta?.availableLocales.some((l) => l.locale === locale.code)) : [];
|
656
|
+
const fillFromLocale = (onClose) => async () => {
|
657
|
+
const response = await getDocument({
|
658
|
+
collectionType,
|
659
|
+
model,
|
660
|
+
documentId,
|
661
|
+
params: { locale: localeSelected }
|
662
|
+
});
|
663
|
+
if (!response || !schema) {
|
664
|
+
return;
|
665
|
+
}
|
666
|
+
const { data } = response;
|
667
|
+
const cleanedData = cleanData(data, schema, components);
|
668
|
+
setValues(cleanedData);
|
669
|
+
onClose();
|
670
|
+
};
|
671
|
+
if (!hasI18n) {
|
672
|
+
return null;
|
673
|
+
}
|
674
|
+
return {
|
675
|
+
type: "icon",
|
676
|
+
icon: /* @__PURE__ */ jsx(Download, {}),
|
677
|
+
disabled: availableLocales.length === 0,
|
678
|
+
label: formatMessage({
|
679
|
+
id: getTranslation("CMEditViewCopyLocale.copy-text"),
|
680
|
+
defaultMessage: "Fill in from another locale"
|
681
|
+
}),
|
682
|
+
dialog: {
|
683
|
+
type: "dialog",
|
684
|
+
title: formatMessage({
|
685
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.title"),
|
686
|
+
defaultMessage: "Confirmation"
|
687
|
+
}),
|
688
|
+
content: ({ onClose }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
689
|
+
/* @__PURE__ */ jsx(Dialog.Body, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 3, children: [
|
690
|
+
/* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }),
|
691
|
+
/* @__PURE__ */ jsx(Typography, { textAlign: "center", children: formatMessage({
|
692
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.body"),
|
693
|
+
defaultMessage: "Your current content will be erased and filled by the content of the selected locale:"
|
694
|
+
}) }),
|
695
|
+
/* @__PURE__ */ jsxs(Field.Root, { width: "100%", children: [
|
696
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
697
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.field.label"),
|
698
|
+
defaultMessage: "Locale"
|
699
|
+
}) }),
|
700
|
+
/* @__PURE__ */ jsx(
|
701
|
+
SingleSelect,
|
702
|
+
{
|
703
|
+
value: localeSelected,
|
704
|
+
placeholder: formatMessage({
|
705
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.field.placeholder"),
|
706
|
+
defaultMessage: "Select one locale..."
|
707
|
+
}),
|
708
|
+
onChange: (value) => setLocaleSelected(value),
|
709
|
+
children: availableLocales.map((locale) => /* @__PURE__ */ jsx(SingleSelectOption, { value: locale.code, children: locale.name }, locale.code))
|
710
|
+
}
|
711
|
+
)
|
712
|
+
] })
|
713
|
+
] }) }),
|
714
|
+
/* @__PURE__ */ jsx(Dialog.Footer, { children: /* @__PURE__ */ jsxs(Flex, { gap: 2, width: "100%", children: [
|
715
|
+
/* @__PURE__ */ jsx(Button, { flex: "auto", variant: "tertiary", onClick: onClose, children: formatMessage({
|
716
|
+
id: getTranslation("CMEditViewCopyLocale.cancel-text"),
|
717
|
+
defaultMessage: "No, cancel"
|
718
|
+
}) }),
|
719
|
+
/* @__PURE__ */ jsx(Button, { flex: "auto", variant: "success", onClick: fillFromLocale(onClose), children: formatMessage({
|
720
|
+
id: getTranslation("CMEditViewCopyLocale.submit-text"),
|
721
|
+
defaultMessage: "Yes, fill in"
|
722
|
+
}) })
|
723
|
+
] }) })
|
724
|
+
] })
|
725
|
+
}
|
726
|
+
};
|
727
|
+
};
|
464
728
|
const DeleteLocaleAction = ({
|
465
729
|
document,
|
466
730
|
documentId,
|
@@ -472,16 +736,23 @@ const DeleteLocaleAction = ({
|
|
472
736
|
const { toggleNotification } = useNotification();
|
473
737
|
const { delete: deleteAction } = unstable_useDocumentActions();
|
474
738
|
const { hasI18n, canDelete } = useI18n();
|
739
|
+
const [{ query }] = useQueryParams();
|
740
|
+
const { data: locales = [] } = useGetLocalesQuery();
|
741
|
+
const currentDesiredLocale = query.plugins?.i18n?.locale;
|
742
|
+
const locale = !("error" in locales) && locales.find((loc) => loc.code === currentDesiredLocale);
|
475
743
|
if (!hasI18n) {
|
476
744
|
return null;
|
477
745
|
}
|
478
746
|
return {
|
479
747
|
disabled: document?.locale && !canDelete.includes(document.locale) || !document || !document.id,
|
480
748
|
position: ["header", "table-row"],
|
481
|
-
label: formatMessage(
|
482
|
-
|
483
|
-
|
484
|
-
|
749
|
+
label: formatMessage(
|
750
|
+
{
|
751
|
+
id: getTranslation("actions.delete.label"),
|
752
|
+
defaultMessage: "Delete entry ({locale})"
|
753
|
+
},
|
754
|
+
{ locale: locale && locale.name }
|
755
|
+
),
|
485
756
|
icon: /* @__PURE__ */ jsx(StyledTrash, {}),
|
486
757
|
variant: "danger",
|
487
758
|
dialog: {
|
@@ -498,7 +769,12 @@ const DeleteLocaleAction = ({
|
|
498
769
|
}) })
|
499
770
|
] }),
|
500
771
|
onConfirm: async () => {
|
501
|
-
|
772
|
+
const unableToDelete = (
|
773
|
+
// We are unable to delete a collection type without a document ID
|
774
|
+
// & unable to delete generally if there is no document locale
|
775
|
+
collectionType !== "single-types" && !documentId || !document?.locale
|
776
|
+
);
|
777
|
+
if (unableToDelete) {
|
502
778
|
console.error(
|
503
779
|
"You're trying to delete a document without an id or locale, this is likely a bug with Strapi. Please open an issue."
|
504
780
|
);
|
@@ -524,37 +800,43 @@ const DeleteLocaleAction = ({
|
|
524
800
|
}
|
525
801
|
};
|
526
802
|
};
|
527
|
-
const
|
803
|
+
const BulkLocaleAction = ({
|
528
804
|
document: baseDocument,
|
529
805
|
documentId,
|
530
806
|
model,
|
531
|
-
collectionType
|
807
|
+
collectionType,
|
808
|
+
action
|
532
809
|
}) => {
|
533
810
|
const baseLocale = baseDocument?.locale ?? null;
|
534
811
|
const [{ query }] = useQueryParams();
|
535
812
|
const params = React.useMemo(() => buildValidParams(query), [query]);
|
536
|
-
const
|
813
|
+
const isOnPublishedTab = query.status === "published";
|
537
814
|
const { formatMessage } = useIntl();
|
538
815
|
const { hasI18n, canPublish } = useI18n();
|
539
816
|
const { toggleNotification } = useNotification();
|
540
817
|
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
541
818
|
const [selectedRows, setSelectedRows] = React.useState([]);
|
542
819
|
const [isDraftRelationConfirmationOpen, setIsDraftRelationConfirmationOpen] = React.useState(false);
|
543
|
-
const { publishMany: publishManyAction } = unstable_useDocumentActions();
|
820
|
+
const { publishMany: publishManyAction, unpublishMany: unpublishManyAction } = unstable_useDocumentActions();
|
544
821
|
const {
|
545
822
|
document,
|
546
823
|
meta: documentMeta,
|
547
824
|
schema,
|
548
825
|
validate
|
549
|
-
} = unstable_useDocument(
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
826
|
+
} = unstable_useDocument(
|
827
|
+
{
|
828
|
+
model,
|
829
|
+
collectionType,
|
830
|
+
documentId,
|
831
|
+
params: {
|
832
|
+
locale: baseLocale
|
833
|
+
}
|
834
|
+
},
|
835
|
+
{
|
836
|
+
skip: !hasI18n || !baseLocale
|
555
837
|
}
|
556
|
-
|
557
|
-
const { data: localesMetadata = [] } = useGetLocalesQuery();
|
838
|
+
);
|
839
|
+
const { data: localesMetadata = [] } = useGetLocalesQuery(hasI18n ? void 0 : skipToken);
|
558
840
|
const headers = [
|
559
841
|
{
|
560
842
|
label: formatMessage({
|
@@ -603,12 +885,19 @@ const BulkLocalePublishAction = ({
|
|
603
885
|
}, {});
|
604
886
|
return [rowsFromMeta, errors];
|
605
887
|
}, [document, documentMeta?.availableLocales, validate]);
|
606
|
-
const
|
607
|
-
|
888
|
+
const isBulkPublish = action === "bulk-publish";
|
889
|
+
const localesForAction = selectedRows.reduce((acc, selectedRow) => {
|
890
|
+
const isValidLocale = (
|
891
|
+
// Validation errors are irrelevant if we are trying to unpublish
|
892
|
+
!isBulkPublish || !Object.keys(validationErrors).includes(selectedRow.locale)
|
893
|
+
);
|
894
|
+
const shouldAddLocale = isBulkPublish ? selectedRow.status !== "published" && isValidLocale : selectedRow.status !== "draft" && isValidLocale;
|
895
|
+
if (shouldAddLocale) {
|
608
896
|
acc.push(selectedRow.locale);
|
609
897
|
}
|
610
898
|
return acc;
|
611
899
|
}, []);
|
900
|
+
const enableDraftRelationsCount = false;
|
612
901
|
const {
|
613
902
|
data: draftRelationsCount = 0,
|
614
903
|
isLoading: isDraftRelationsLoading,
|
@@ -617,10 +906,10 @@ const BulkLocalePublishAction = ({
|
|
617
906
|
{
|
618
907
|
model,
|
619
908
|
documentIds: [documentId],
|
620
|
-
locale:
|
909
|
+
locale: localesForAction
|
621
910
|
},
|
622
911
|
{
|
623
|
-
skip: !
|
912
|
+
skip: !enableDraftRelationsCount
|
624
913
|
}
|
625
914
|
);
|
626
915
|
React.useEffect(() => {
|
@@ -646,7 +935,18 @@ const BulkLocalePublishAction = ({
|
|
646
935
|
documentIds: [documentId],
|
647
936
|
params: {
|
648
937
|
...params,
|
649
|
-
locale:
|
938
|
+
locale: localesForAction
|
939
|
+
}
|
940
|
+
});
|
941
|
+
setSelectedRows([]);
|
942
|
+
};
|
943
|
+
const unpublish = async () => {
|
944
|
+
await unpublishManyAction({
|
945
|
+
model,
|
946
|
+
documentIds: [documentId],
|
947
|
+
params: {
|
948
|
+
...params,
|
949
|
+
locale: localesForAction
|
650
950
|
}
|
651
951
|
});
|
652
952
|
setSelectedRows([]);
|
@@ -654,14 +954,12 @@ const BulkLocalePublishAction = ({
|
|
654
954
|
const handleAction = async () => {
|
655
955
|
if (draftRelationsCount > 0) {
|
656
956
|
setIsDraftRelationConfirmationOpen(true);
|
657
|
-
} else {
|
957
|
+
} else if (isBulkPublish) {
|
658
958
|
await publish();
|
959
|
+
} else {
|
960
|
+
await unpublish();
|
659
961
|
}
|
660
962
|
};
|
661
|
-
const isUnpublish = document?.status === "published";
|
662
|
-
if (isUnpublish) {
|
663
|
-
console.warn(["I18N"], "Bulk locale unpublish modal not implemented");
|
664
|
-
}
|
665
963
|
if (isDraftRelationConfirmationOpen) {
|
666
964
|
return {
|
667
965
|
label: formatMessage({
|
@@ -696,20 +994,21 @@ const BulkLocalePublishAction = ({
|
|
696
994
|
}
|
697
995
|
};
|
698
996
|
}
|
997
|
+
const hasPermission = selectedRows.map(({ locale }) => locale).every((locale) => canPublish.includes(locale));
|
699
998
|
return {
|
700
999
|
label: formatMessage({
|
701
|
-
id: getTranslation("
|
702
|
-
defaultMessage: "Publish Multiple Locales
|
1000
|
+
id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? "publish" : "unpublish"}-title`),
|
1001
|
+
defaultMessage: `${isBulkPublish ? "Publish" : "Unpublish"} Multiple Locales`
|
703
1002
|
}),
|
704
|
-
|
705
|
-
|
1003
|
+
variant: isBulkPublish ? "secondary" : "danger",
|
1004
|
+
icon: isBulkPublish ? /* @__PURE__ */ jsx(ListPlus, {}) : /* @__PURE__ */ jsx(Cross, {}),
|
1005
|
+
disabled: isOnPublishedTab || canPublish.length === 0,
|
706
1006
|
position: ["panel"],
|
707
|
-
variant: "secondary",
|
708
1007
|
dialog: {
|
709
1008
|
type: "modal",
|
710
1009
|
title: formatMessage({
|
711
|
-
id: getTranslation("
|
712
|
-
defaultMessage: "Publish Multiple Locales
|
1010
|
+
id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? "publish" : "unpublish"}-title`),
|
1011
|
+
defaultMessage: `${isBulkPublish ? "Publish" : "Unpublish"} Multiple Locales`
|
713
1012
|
}),
|
714
1013
|
content: () => {
|
715
1014
|
return /* @__PURE__ */ jsx(
|
@@ -728,28 +1027,35 @@ const BulkLocalePublishAction = ({
|
|
728
1027
|
validationErrors,
|
729
1028
|
headers,
|
730
1029
|
rows,
|
731
|
-
localesMetadata
|
1030
|
+
localesMetadata,
|
1031
|
+
action: action ?? "bulk-publish"
|
732
1032
|
}
|
733
1033
|
)
|
734
1034
|
}
|
735
1035
|
);
|
736
1036
|
},
|
737
|
-
footer: () => /* @__PURE__ */ jsx(
|
738
|
-
Button
|
1037
|
+
footer: () => /* @__PURE__ */ jsx(Modal.Footer, { justifyContent: "flex-end", children: /* @__PURE__ */ jsx(
|
1038
|
+
Button,
|
739
1039
|
{
|
740
1040
|
loading: isDraftRelationsLoading,
|
741
|
-
disabled:
|
1041
|
+
disabled: !hasPermission || localesForAction.length === 0,
|
742
1042
|
variant: "default",
|
743
1043
|
onClick: handleAction,
|
744
1044
|
children: formatMessage({
|
745
|
-
id: "app.utils.publish",
|
746
|
-
defaultMessage: "Publish"
|
1045
|
+
id: isBulkPublish ? "app.utils.publish" : "app.utils.unpublish",
|
1046
|
+
defaultMessage: isBulkPublish ? "Publish" : "Unpublish"
|
747
1047
|
})
|
748
1048
|
}
|
749
1049
|
) })
|
750
1050
|
}
|
751
1051
|
};
|
752
1052
|
};
|
1053
|
+
const BulkLocalePublishAction = (props) => {
|
1054
|
+
return BulkLocaleAction({ action: "bulk-publish", ...props });
|
1055
|
+
};
|
1056
|
+
const BulkLocaleUnpublishAction = (props) => {
|
1057
|
+
return BulkLocaleAction({ action: "bulk-unpublish", ...props });
|
1058
|
+
};
|
753
1059
|
const StyledTrash = styled(Trash)`
|
754
1060
|
path {
|
755
1061
|
fill: currentColor;
|
@@ -806,13 +1112,6 @@ const UnpublishModalAdditionalInfo = () => {
|
|
806
1112
|
}
|
807
1113
|
) });
|
808
1114
|
};
|
809
|
-
const Initializer = ({ setPlugin }) => {
|
810
|
-
const setPluginRef = React.useRef(setPlugin);
|
811
|
-
React.useEffect(() => {
|
812
|
-
setPluginRef.current(pluginId);
|
813
|
-
}, []);
|
814
|
-
return null;
|
815
|
-
};
|
816
1115
|
const LocalePicker = () => {
|
817
1116
|
const { formatMessage } = useIntl();
|
818
1117
|
const [{ query }, setQuery] = useQueryParams();
|
@@ -976,54 +1275,13 @@ const LocaleListCell = ({
|
|
976
1275
|
return locale.name;
|
977
1276
|
}).toSorted((a, b) => formatter.compare(a, b));
|
978
1277
|
return /* @__PURE__ */ jsxs(Popover.Root, { children: [
|
979
|
-
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(Button, { type: "button", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxs(
|
980
|
-
|
981
|
-
{
|
982
|
-
|
983
|
-
alignItems: "center",
|
984
|
-
justifyContent: "center",
|
985
|
-
height: "3.2rem",
|
986
|
-
width: "3.2rem",
|
987
|
-
children: [
|
988
|
-
/* @__PURE__ */ jsx(Typography, { textColor: "neutral800", ellipsis: true, children: localesForDocument.join(", ") }),
|
989
|
-
/* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(CaretDown, {}) })
|
990
|
-
]
|
991
|
-
}
|
992
|
-
) }) }),
|
1278
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(Button, { variant: "ghost", type: "button", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxs(Flex, { minWidth: "100%", alignItems: "center", justifyContent: "center", fontWeight: "regular", children: [
|
1279
|
+
/* @__PURE__ */ jsx(Typography, { textColor: "neutral800", ellipsis: true, marginRight: 2, children: localesForDocument.join(", ") }),
|
1280
|
+
/* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(CaretDown, { width: "1.2rem", height: "1.2rem" }) })
|
1281
|
+
] }) }) }),
|
993
1282
|
/* @__PURE__ */ jsx(Popover.Content, { sideOffset: 16, children: /* @__PURE__ */ jsx("ul", { children: localesForDocument.map((name) => /* @__PURE__ */ jsx(Box, { padding: 3, tag: "li", children: /* @__PURE__ */ jsx(Typography, { children: name }) }, name)) }) })
|
994
1283
|
] });
|
995
1284
|
};
|
996
|
-
const Button = styled.button`
|
997
|
-
width: 100%;
|
998
|
-
|
999
|
-
svg {
|
1000
|
-
> g,
|
1001
|
-
path {
|
1002
|
-
fill: ${({ theme }) => theme.colors.neutral500};
|
1003
|
-
}
|
1004
|
-
}
|
1005
|
-
&:hover {
|
1006
|
-
svg {
|
1007
|
-
> g,
|
1008
|
-
path {
|
1009
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
1010
|
-
}
|
1011
|
-
}
|
1012
|
-
}
|
1013
|
-
&:active {
|
1014
|
-
svg {
|
1015
|
-
> g,
|
1016
|
-
path {
|
1017
|
-
fill: ${({ theme }) => theme.colors.neutral400};
|
1018
|
-
}
|
1019
|
-
}
|
1020
|
-
}
|
1021
|
-
`;
|
1022
|
-
const ActionWrapper = styled(Flex)`
|
1023
|
-
svg {
|
1024
|
-
height: 0.4rem;
|
1025
|
-
}
|
1026
|
-
`;
|
1027
1285
|
const addColumnToTableHook = ({ displayedHeaders, layout }) => {
|
1028
1286
|
const { options } = layout;
|
1029
1287
|
const isFieldLocalized = doesPluginOptionsHaveI18nLocalized(options) ? options.i18n.localized : false;
|
@@ -1052,18 +1310,11 @@ const addColumnToTableHook = ({ displayedHeaders, layout }) => {
|
|
1052
1310
|
const addLocaleToReleasesHook = ({ displayedHeaders = [] }) => {
|
1053
1311
|
return {
|
1054
1312
|
displayedHeaders: [
|
1055
|
-
|
1056
|
-
// ...displayedHeaders,
|
1313
|
+
...displayedHeaders,
|
1057
1314
|
{
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
label: {
|
1062
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
1063
|
-
defaultMessage: "locale"
|
1064
|
-
},
|
1065
|
-
searchable: false,
|
1066
|
-
sortable: false
|
1315
|
+
label: {
|
1316
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
1317
|
+
defaultMessage: "locale"
|
1067
1318
|
},
|
1068
1319
|
name: "locale"
|
1069
1320
|
}
|
@@ -1156,9 +1407,6 @@ const localeMiddleware = (ctx) => (next) => (permissions) => {
|
|
1156
1407
|
return next(revisedPermissions);
|
1157
1408
|
};
|
1158
1409
|
const prefixPluginTranslations = (trad, pluginId2) => {
|
1159
|
-
if (!pluginId2) {
|
1160
|
-
throw new TypeError("pluginId can't be empty");
|
1161
|
-
}
|
1162
1410
|
return Object.keys(trad).reduce((acc, current) => {
|
1163
1411
|
acc[`${pluginId2}.${current}`] = trad[current];
|
1164
1412
|
return acc;
|
@@ -1211,8 +1459,6 @@ const index = {
|
|
1211
1459
|
app.addRBACMiddleware([localeMiddleware]);
|
1212
1460
|
app.registerPlugin({
|
1213
1461
|
id: pluginId,
|
1214
|
-
initializer: Initializer,
|
1215
|
-
isReady: false,
|
1216
1462
|
name: pluginId
|
1217
1463
|
});
|
1218
1464
|
},
|
@@ -1230,11 +1476,11 @@ const index = {
|
|
1230
1476
|
},
|
1231
1477
|
id: "internationalization",
|
1232
1478
|
to: "internationalization",
|
1233
|
-
Component: () => import("./SettingsPage-
|
1479
|
+
Component: () => import("./SettingsPage-BAx9nmep.mjs").then((mod) => ({ default: mod.ProtectedSettingsPage })),
|
1234
1480
|
permissions: PERMISSIONS.accessMain
|
1235
1481
|
});
|
1236
1482
|
const contentManager = app.getPlugin("content-manager");
|
1237
|
-
contentManager.apis.addDocumentHeaderAction([LocalePickerAction]);
|
1483
|
+
contentManager.apis.addDocumentHeaderAction([LocalePickerAction, FillFromAnotherLocaleAction]);
|
1238
1484
|
contentManager.apis.addDocumentAction((actions) => {
|
1239
1485
|
const indexOfDeleteAction = actions.findIndex((action) => action.type === "delete");
|
1240
1486
|
actions.splice(indexOfDeleteAction, 0, DeleteLocaleAction);
|
@@ -1242,6 +1488,7 @@ const index = {
|
|
1242
1488
|
});
|
1243
1489
|
contentManager.apis.addDocumentAction((actions) => {
|
1244
1490
|
actions.splice(2, 0, BulkLocalePublishAction);
|
1491
|
+
actions.splice(5, 0, BulkLocaleUnpublishAction);
|
1245
1492
|
return actions;
|
1246
1493
|
});
|
1247
1494
|
contentManager.injectComponent("listView", "actions", {
|
@@ -1347,7 +1594,7 @@ const index = {
|
|
1347
1594
|
async registerTrads({ locales }) {
|
1348
1595
|
const importedTrads = await Promise.all(
|
1349
1596
|
locales.map((locale) => {
|
1350
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => import("./de-9eCAqqrB.mjs"), "./translations/dk.json": () => import("./dk-2qBjxt-P.mjs"), "./translations/en.json": () => import("./en-
|
1597
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => import("./de-9eCAqqrB.mjs"), "./translations/dk.json": () => import("./dk-2qBjxt-P.mjs"), "./translations/en.json": () => import("./en-DlXfy6Gy.mjs"), "./translations/es.json": () => import("./es-DlmMVaBG.mjs"), "./translations/fr.json": () => import("./fr-3S6ke71d.mjs"), "./translations/ko.json": () => import("./ko-qTjQ8IMw.mjs"), "./translations/pl.json": () => import("./pl-B67TSHqT.mjs"), "./translations/ru.json": () => import("./ru-hagMa57T.mjs"), "./translations/tr.json": () => import("./tr-Dw_jmkG-.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-Dyc-aR-h.mjs"), "./translations/zh.json": () => import("./zh-57YM4amO.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
1351
1598
|
return {
|
1352
1599
|
data: prefixPluginTranslations(data, pluginId),
|
1353
1600
|
locale
|
@@ -1373,4 +1620,4 @@ export {
|
|
1373
1620
|
index as i,
|
1374
1621
|
useCreateLocaleMutation as u
|
1375
1622
|
};
|
1376
|
-
//# sourceMappingURL=index-
|
1623
|
+
//# sourceMappingURL=index-B0NijiBB.mjs.map
|