@strapi/i18n 0.0.0-experimental.d53e940834bf72ddc725f1d2fd36dac9abec30cb → 0.0.0-experimental.d74a8e5e655230b243e2d61ab5bec2fcdb426993
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-D_53Ao8I.mjs} +8 -8
- package/dist/_chunks/SettingsPage-D_53Ao8I.mjs.map +1 -0
- package/dist/_chunks/{SettingsPage-CxZ9qSb_.js → SettingsPage-Z94BBMrV.js} +8 -8
- package/dist/_chunks/SettingsPage-Z94BBMrV.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-jbI6Njjb.mjs → index-BGhYo_Rs.mjs} +412 -177
- package/dist/_chunks/index-BGhYo_Rs.mjs.map +1 -0
- package/dist/_chunks/{index-CLtneDAv.js → index-BOvOaxo-.js} +416 -181
- package/dist/_chunks/index-BOvOaxo-.js.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 +397 -487
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +398 -488
- 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 +15 -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 +14 -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/utils/index.d.ts +0 -2
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/package.json +9 -9
- 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
@@ -7,6 +7,7 @@ const designSystem = require("@strapi/design-system");
|
|
7
7
|
const icons = require("@strapi/icons");
|
8
8
|
const reactIntl = require("react-intl");
|
9
9
|
const styledComponents = require("styled-components");
|
10
|
+
const query = require("@reduxjs/toolkit/query");
|
10
11
|
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
11
12
|
const strapiAdmin$1 = require("@strapi/content-manager/strapi-admin");
|
12
13
|
const reactRouterDom = require("react-router-dom");
|
@@ -160,7 +161,7 @@ const useI18n = () => {
|
|
160
161
|
model: params.slug
|
161
162
|
},
|
162
163
|
{
|
163
|
-
skip:
|
164
|
+
skip: true
|
164
165
|
}
|
165
166
|
);
|
166
167
|
if (doesPluginOptionsHaveI18nLocalized(schema?.pluginOptions)) {
|
@@ -240,10 +241,94 @@ const relationsApi = i18nApi.injectEndpoints({
|
|
240
241
|
})
|
241
242
|
});
|
242
243
|
const { useGetManyDraftRelationCountQuery } = relationsApi;
|
244
|
+
const cleanData = (data, schema, components) => {
|
245
|
+
const cleanedData = removeFields(data, [
|
246
|
+
"createdAt",
|
247
|
+
"createdBy",
|
248
|
+
"updatedAt",
|
249
|
+
"updatedBy",
|
250
|
+
"id",
|
251
|
+
"documentId",
|
252
|
+
"publishedAt",
|
253
|
+
"strapi_stage",
|
254
|
+
"strapi_assignee",
|
255
|
+
"locale",
|
256
|
+
"status"
|
257
|
+
]);
|
258
|
+
const cleanedDataWithoutPasswordAndRelation = recursiveRemoveFieldTypes(
|
259
|
+
cleanedData,
|
260
|
+
schema,
|
261
|
+
components,
|
262
|
+
["relation", "password"]
|
263
|
+
);
|
264
|
+
return cleanedDataWithoutPasswordAndRelation;
|
265
|
+
};
|
266
|
+
const removeFields = (data, fields) => {
|
267
|
+
return Object.keys(data).reduce((acc, current) => {
|
268
|
+
if (fields.includes(current)) {
|
269
|
+
return acc;
|
270
|
+
}
|
271
|
+
acc[current] = data[current];
|
272
|
+
return acc;
|
273
|
+
}, {});
|
274
|
+
};
|
275
|
+
const recursiveRemoveFieldTypes = (data, schema, components, fields) => {
|
276
|
+
return Object.keys(data).reduce((acc, current) => {
|
277
|
+
const attribute = schema.attributes[current] ?? { type: void 0 };
|
278
|
+
if (fields.includes(attribute.type)) {
|
279
|
+
return acc;
|
280
|
+
}
|
281
|
+
if (attribute.type === "dynamiczone") {
|
282
|
+
acc[current] = data[current].map((componentValue, index2) => {
|
283
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
284
|
+
componentValue,
|
285
|
+
components[componentValue.__component],
|
286
|
+
components,
|
287
|
+
fields
|
288
|
+
);
|
289
|
+
return {
|
290
|
+
...rest,
|
291
|
+
__temp_key__: index2 + 1
|
292
|
+
};
|
293
|
+
});
|
294
|
+
} else if (attribute.type === "component") {
|
295
|
+
const { repeatable, component } = attribute;
|
296
|
+
if (repeatable) {
|
297
|
+
acc[current] = (data[current] ?? []).map((compoData, index2) => {
|
298
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
299
|
+
compoData,
|
300
|
+
components[component],
|
301
|
+
components,
|
302
|
+
fields
|
303
|
+
);
|
304
|
+
return {
|
305
|
+
...rest,
|
306
|
+
__temp_key__: index2 + 1
|
307
|
+
};
|
308
|
+
});
|
309
|
+
} else {
|
310
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
311
|
+
data[current] ?? {},
|
312
|
+
components[component],
|
313
|
+
components,
|
314
|
+
fields
|
315
|
+
);
|
316
|
+
acc[current] = rest;
|
317
|
+
}
|
318
|
+
} else {
|
319
|
+
acc[current] = data[current];
|
320
|
+
}
|
321
|
+
return acc;
|
322
|
+
}, {});
|
323
|
+
};
|
243
324
|
const isErrorMessageDescriptor = (object) => {
|
244
325
|
return typeof object === "object" && object !== null && "id" in object && "defaultMessage" in object;
|
245
326
|
};
|
246
|
-
const EntryValidationText = ({
|
327
|
+
const EntryValidationText = ({
|
328
|
+
status = "draft",
|
329
|
+
validationErrors,
|
330
|
+
action
|
331
|
+
}) => {
|
247
332
|
const { formatMessage } = reactIntl.useIntl();
|
248
333
|
const getErrorStr = (key, value) => {
|
249
334
|
if (typeof value === "string") {
|
@@ -277,30 +362,63 @@ const EntryValidationText = ({ status = "draft", validationErrors }) => {
|
|
277
362
|
) })
|
278
363
|
] });
|
279
364
|
}
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
365
|
+
const getStatusMessage = () => {
|
366
|
+
if (action === "bulk-publish") {
|
367
|
+
if (status === "published") {
|
368
|
+
return {
|
369
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
370
|
+
text: formatMessage({
|
371
|
+
id: "content-manager.bulk-publish.already-published",
|
372
|
+
defaultMessage: "Already Published"
|
373
|
+
}),
|
374
|
+
textColor: "success600",
|
375
|
+
fontWeight: "bold"
|
376
|
+
};
|
377
|
+
} else if (status === "modified") {
|
378
|
+
return {
|
379
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowsCounterClockwise, { fill: "alternative600" }),
|
380
|
+
text: formatMessage({
|
381
|
+
id: "app.utils.ready-to-publish-changes",
|
382
|
+
defaultMessage: "Ready to publish changes"
|
383
|
+
})
|
384
|
+
};
|
385
|
+
} else {
|
386
|
+
return {
|
387
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
388
|
+
text: formatMessage({
|
389
|
+
id: "app.utils.ready-to-publish",
|
390
|
+
defaultMessage: "Ready to publish"
|
391
|
+
})
|
392
|
+
};
|
393
|
+
}
|
394
|
+
} else {
|
395
|
+
if (status === "draft") {
|
396
|
+
return {
|
397
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
398
|
+
text: formatMessage({
|
399
|
+
id: "content-manager.bulk-unpublish.already-unpublished",
|
400
|
+
defaultMessage: "Already Unpublished"
|
401
|
+
}),
|
402
|
+
textColor: "success600",
|
403
|
+
fontWeight: "bold"
|
404
|
+
};
|
405
|
+
} else {
|
406
|
+
return {
|
407
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
408
|
+
text: formatMessage({
|
409
|
+
id: "app.utils.ready-to-unpublish-changes",
|
410
|
+
defaultMessage: "Ready to unpublish"
|
411
|
+
}),
|
412
|
+
textColor: "success600",
|
413
|
+
fontWeight: "bold"
|
414
|
+
};
|
415
|
+
}
|
416
|
+
}
|
417
|
+
};
|
418
|
+
const { icon, text, textColor = "success600", fontWeight = "normal" } = getStatusMessage();
|
298
419
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
299
|
-
|
300
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children:
|
301
|
-
id: "app.utils.ready-to-publish",
|
302
|
-
defaultMessage: "Ready to publish"
|
303
|
-
}) })
|
420
|
+
icon,
|
421
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor, fontWeight, children: text })
|
304
422
|
] });
|
305
423
|
};
|
306
424
|
const BoldChunk = (chunks) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: chunks });
|
@@ -308,7 +426,8 @@ const BulkLocaleActionModal = ({
|
|
308
426
|
headers,
|
309
427
|
rows,
|
310
428
|
localesMetadata,
|
311
|
-
validationErrors = {}
|
429
|
+
validationErrors = {},
|
430
|
+
action
|
312
431
|
}) => {
|
313
432
|
const { formatMessage } = reactIntl.useIntl();
|
314
433
|
const selectedRows = strapiAdmin.useTable(
|
@@ -321,27 +440,29 @@ const BulkLocaleActionModal = ({
|
|
321
440
|
return acc;
|
322
441
|
}, {});
|
323
442
|
const localesWithErrors = Object.keys(validationErrors);
|
324
|
-
const
|
443
|
+
const publishedCount = selectedRows.filter(
|
325
444
|
({ locale }) => currentStatusByLocale[locale] === "published"
|
326
445
|
).length;
|
327
|
-
const
|
446
|
+
const draftCount = selectedRows.filter(
|
328
447
|
({ locale }) => (currentStatusByLocale[locale] === "draft" || currentStatusByLocale[locale] === "modified") && !localesWithErrors.includes(locale)
|
329
448
|
).length;
|
330
449
|
const withErrorsCount = localesWithErrors.length;
|
450
|
+
const messageId = action === "bulk-publish" ? "content-manager.containers.list.selectedEntriesModal.selectedCount.publish" : "content-manager.containers.list.selectedEntriesModal.selectedCount.unpublish";
|
451
|
+
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.";
|
331
452
|
return formatMessage(
|
332
453
|
{
|
333
|
-
id:
|
334
|
-
defaultMessage
|
454
|
+
id: messageId,
|
455
|
+
defaultMessage
|
335
456
|
},
|
336
457
|
{
|
337
458
|
withErrorsCount,
|
338
|
-
|
339
|
-
|
459
|
+
draftCount,
|
460
|
+
publishedCount,
|
340
461
|
b: BoldChunk
|
341
462
|
}
|
342
463
|
);
|
343
464
|
};
|
344
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
465
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Body, { children: [
|
345
466
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: getFormattedCountMessage() }),
|
346
467
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 5, children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Content, { children: [
|
347
468
|
/* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Head, { children: [
|
@@ -368,7 +489,7 @@ const BulkLocaleActionModal = ({
|
|
368
489
|
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
369
490
|
}
|
370
491
|
) }) }),
|
371
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(EntryValidationText, { validationErrors: error, status }) }),
|
492
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(EntryValidationText, { validationErrors: error, status, action }) }),
|
372
493
|
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
373
494
|
designSystem.IconButton,
|
374
495
|
{
|
@@ -385,7 +506,7 @@ const BulkLocaleActionModal = ({
|
|
385
506
|
name: locale
|
386
507
|
}
|
387
508
|
),
|
388
|
-
|
509
|
+
variant: "ghost",
|
389
510
|
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Pencil, {})
|
390
511
|
}
|
391
512
|
) })
|
@@ -394,6 +515,48 @@ const BulkLocaleActionModal = ({
|
|
394
515
|
] }) })
|
395
516
|
] });
|
396
517
|
};
|
518
|
+
const statusVariants = {
|
519
|
+
draft: "secondary",
|
520
|
+
published: "success",
|
521
|
+
modified: "alternative"
|
522
|
+
};
|
523
|
+
const LocaleOption = ({
|
524
|
+
isDraftAndPublishEnabled,
|
525
|
+
locale,
|
526
|
+
status,
|
527
|
+
entryExists
|
528
|
+
}) => {
|
529
|
+
const { formatMessage } = reactIntl.useIntl();
|
530
|
+
if (!entryExists) {
|
531
|
+
return formatMessage(
|
532
|
+
{
|
533
|
+
id: getTranslation("CMEditViewLocalePicker.locale.create"),
|
534
|
+
defaultMessage: "Create <bold>{locale}</bold> locale"
|
535
|
+
},
|
536
|
+
{
|
537
|
+
bold: (locale2) => /* @__PURE__ */ jsxRuntime.jsx("b", { children: locale2 }),
|
538
|
+
locale: locale.name
|
539
|
+
}
|
540
|
+
);
|
541
|
+
}
|
542
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", gap: 1, justifyContent: "space-between", children: [
|
543
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: locale.name }),
|
544
|
+
isDraftAndPublishEnabled ? /* @__PURE__ */ jsxRuntime.jsx(
|
545
|
+
designSystem.Status,
|
546
|
+
{
|
547
|
+
display: "flex",
|
548
|
+
paddingLeft: "6px",
|
549
|
+
paddingRight: "6px",
|
550
|
+
paddingTop: "2px",
|
551
|
+
paddingBottom: "2px",
|
552
|
+
showBullet: false,
|
553
|
+
size: "S",
|
554
|
+
variant: statusVariants[status],
|
555
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
556
|
+
}
|
557
|
+
) : null
|
558
|
+
] });
|
559
|
+
};
|
397
560
|
const LocalePickerAction = ({
|
398
561
|
document,
|
399
562
|
meta,
|
@@ -402,74 +565,74 @@ const LocalePickerAction = ({
|
|
402
565
|
documentId
|
403
566
|
}) => {
|
404
567
|
const { formatMessage } = reactIntl.useIntl();
|
405
|
-
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
568
|
+
const [{ query: query2 }, setQuery] = strapiAdmin.useQueryParams();
|
406
569
|
const { hasI18n, canCreate, canRead } = useI18n();
|
407
570
|
const { data: locales = [] } = useGetLocalesQuery();
|
408
|
-
const
|
571
|
+
const currentDesiredLocale = query2.plugins?.i18n?.locale;
|
572
|
+
const { schema } = strapiAdmin$1.unstable_useDocument({
|
573
|
+
model,
|
574
|
+
collectionType,
|
575
|
+
documentId,
|
576
|
+
params: { locale: currentDesiredLocale }
|
577
|
+
});
|
409
578
|
const handleSelect = React__namespace.useCallback(
|
410
579
|
(value) => {
|
411
580
|
setQuery({
|
412
581
|
plugins: {
|
413
|
-
...
|
582
|
+
...query2.plugins,
|
414
583
|
i18n: {
|
415
584
|
locale: value
|
416
585
|
}
|
417
586
|
}
|
418
587
|
});
|
419
588
|
},
|
420
|
-
[
|
589
|
+
[query2.plugins, setQuery]
|
421
590
|
);
|
422
591
|
React__namespace.useEffect(() => {
|
423
592
|
if (!Array.isArray(locales) || !hasI18n) {
|
424
593
|
return;
|
425
594
|
}
|
426
|
-
const currentDesiredLocale = query.plugins?.i18n?.locale;
|
427
595
|
const doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);
|
428
596
|
const defaultLocale = locales.find((locale) => locale.isDefault);
|
429
597
|
if (!doesLocaleExist && defaultLocale?.code) {
|
430
598
|
handleSelect(defaultLocale.code);
|
431
599
|
}
|
432
|
-
}, [handleSelect, hasI18n, locales,
|
433
|
-
|
434
|
-
return null;
|
435
|
-
}
|
436
|
-
const currentLocale = query.plugins?.i18n?.locale || locales.find((loc) => loc.isDefault)?.code;
|
600
|
+
}, [handleSelect, hasI18n, locales, currentDesiredLocale]);
|
601
|
+
const currentLocale = Array.isArray(locales) ? locales.find((locale) => locale.code === currentDesiredLocale) : void 0;
|
437
602
|
const allCurrentLocales = [
|
438
|
-
{ status: getDocumentStatus(document, meta), locale: currentLocale },
|
603
|
+
{ status: getDocumentStatus(document, meta), locale: currentLocale?.code },
|
439
604
|
...meta?.availableLocales ?? []
|
440
605
|
];
|
606
|
+
if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {
|
607
|
+
return null;
|
608
|
+
}
|
441
609
|
return {
|
442
610
|
label: formatMessage({
|
443
611
|
id: getTranslation("Settings.locales.modal.locales.label"),
|
444
612
|
defaultMessage: "Locales"
|
445
613
|
}),
|
446
614
|
options: locales.map((locale) => {
|
615
|
+
const entryWithLocaleExists = allCurrentLocales.some((doc) => doc.locale === locale.code);
|
447
616
|
const currentLocaleDoc = allCurrentLocales.find(
|
448
617
|
(doc) => "locale" in doc ? doc.locale === locale.code : false
|
449
618
|
);
|
450
|
-
const
|
451
|
-
const permissionsToCheck = currentLocaleDoc ? canCreate : canRead;
|
452
|
-
const statusVariant = status === "draft" ? "primary" : status === "published" ? "success" : "alternative";
|
619
|
+
const permissionsToCheck = currentLocaleDoc ? canRead : canCreate;
|
453
620
|
return {
|
454
621
|
disabled: !permissionsToCheck.includes(locale.code),
|
455
622
|
value: locale.code,
|
456
|
-
label:
|
457
|
-
|
458
|
-
designSystem.Status,
|
623
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(
|
624
|
+
LocaleOption,
|
459
625
|
{
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
paddingBottom: "2px",
|
465
|
-
showBullet: false,
|
466
|
-
size: "S",
|
467
|
-
variant: statusVariant,
|
468
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
626
|
+
isDraftAndPublishEnabled: !!schema?.options?.draftAndPublish,
|
627
|
+
locale,
|
628
|
+
status: currentLocaleDoc?.status,
|
629
|
+
entryExists: entryWithLocaleExists
|
469
630
|
}
|
470
|
-
)
|
631
|
+
),
|
632
|
+
startIcon: !entryWithLocaleExists ? /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}) : null
|
471
633
|
};
|
472
634
|
}),
|
635
|
+
customizeContent: () => currentLocale?.name,
|
473
636
|
onSelect: handleSelect,
|
474
637
|
value: currentLocale
|
475
638
|
};
|
@@ -485,6 +648,95 @@ const getDocumentStatus = (document, meta) => {
|
|
485
648
|
}
|
486
649
|
return docStatus;
|
487
650
|
};
|
651
|
+
const FillFromAnotherLocaleAction = ({
|
652
|
+
documentId,
|
653
|
+
meta,
|
654
|
+
model,
|
655
|
+
collectionType
|
656
|
+
}) => {
|
657
|
+
const { formatMessage } = reactIntl.useIntl();
|
658
|
+
const [{ query: query2 }] = strapiAdmin.useQueryParams();
|
659
|
+
const currentDesiredLocale = query2.plugins?.i18n?.locale;
|
660
|
+
const [localeSelected, setLocaleSelected] = React__namespace.useState(null);
|
661
|
+
const setValues = strapiAdmin.useForm("FillFromAnotherLocale", (state) => state.setValues);
|
662
|
+
const { getDocument } = strapiAdmin$1.unstable_useDocumentActions();
|
663
|
+
const { schema, components } = strapiAdmin$1.unstable_useDocument({
|
664
|
+
model,
|
665
|
+
documentId,
|
666
|
+
collectionType,
|
667
|
+
params: { locale: currentDesiredLocale }
|
668
|
+
});
|
669
|
+
const { data: locales = [] } = useGetLocalesQuery();
|
670
|
+
const availableLocales = Array.isArray(locales) ? locales.filter((locale) => meta?.availableLocales.some((l) => l.locale === locale.code)) : [];
|
671
|
+
const fillFromLocale = (onClose) => async () => {
|
672
|
+
const response = await getDocument({
|
673
|
+
collectionType,
|
674
|
+
model,
|
675
|
+
documentId,
|
676
|
+
params: { locale: localeSelected }
|
677
|
+
});
|
678
|
+
if (!response || !schema) {
|
679
|
+
return;
|
680
|
+
}
|
681
|
+
const { data } = response;
|
682
|
+
const cleanedData = cleanData(data, schema, components);
|
683
|
+
setValues(cleanedData);
|
684
|
+
onClose();
|
685
|
+
};
|
686
|
+
return {
|
687
|
+
type: "icon",
|
688
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}),
|
689
|
+
disabled: availableLocales.length === 0,
|
690
|
+
label: formatMessage({
|
691
|
+
id: getTranslation("CMEditViewCopyLocale.copy-text"),
|
692
|
+
defaultMessage: "Fill in from another locale"
|
693
|
+
}),
|
694
|
+
dialog: {
|
695
|
+
type: "dialog",
|
696
|
+
title: formatMessage({
|
697
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.title"),
|
698
|
+
defaultMessage: "Confirmation"
|
699
|
+
}),
|
700
|
+
content: ({ onClose }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
701
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 3, children: [
|
702
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.WarningCircle, { width: "24px", height: "24px", fill: "danger600" }),
|
703
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", children: formatMessage({
|
704
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.body"),
|
705
|
+
defaultMessage: "Your current content will be erased and filled by the content of the selected locale:"
|
706
|
+
}) }),
|
707
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { width: "100%", children: [
|
708
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
709
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.field.label"),
|
710
|
+
defaultMessage: "Locale"
|
711
|
+
}) }),
|
712
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
713
|
+
designSystem.SingleSelect,
|
714
|
+
{
|
715
|
+
value: localeSelected,
|
716
|
+
placeholder: formatMessage({
|
717
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.field.placeholder"),
|
718
|
+
defaultMessage: "Select one locale..."
|
719
|
+
}),
|
720
|
+
onChange: (value) => setLocaleSelected(value),
|
721
|
+
children: availableLocales.map((locale) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: locale.code, children: locale.name }, locale.code))
|
722
|
+
}
|
723
|
+
)
|
724
|
+
] })
|
725
|
+
] }) }),
|
726
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, width: "100%", children: [
|
727
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { flex: "auto", variant: "tertiary", onClick: onClose, children: formatMessage({
|
728
|
+
id: getTranslation("CMEditViewCopyLocale.cancel-text"),
|
729
|
+
defaultMessage: "No, cancel"
|
730
|
+
}) }),
|
731
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { flex: "auto", variant: "success", onClick: fillFromLocale(onClose), children: formatMessage({
|
732
|
+
id: getTranslation("CMEditViewCopyLocale.submit-text"),
|
733
|
+
defaultMessage: "Yes, fill in"
|
734
|
+
}) })
|
735
|
+
] }) })
|
736
|
+
] })
|
737
|
+
}
|
738
|
+
};
|
739
|
+
};
|
488
740
|
const DeleteLocaleAction = ({
|
489
741
|
document,
|
490
742
|
documentId,
|
@@ -496,16 +748,23 @@ const DeleteLocaleAction = ({
|
|
496
748
|
const { toggleNotification } = strapiAdmin.useNotification();
|
497
749
|
const { delete: deleteAction } = strapiAdmin$1.unstable_useDocumentActions();
|
498
750
|
const { hasI18n, canDelete } = useI18n();
|
751
|
+
const [{ query: query2 }] = strapiAdmin.useQueryParams();
|
752
|
+
const { data: locales = [] } = useGetLocalesQuery();
|
753
|
+
const currentDesiredLocale = query2.plugins?.i18n?.locale;
|
754
|
+
const locale = !("error" in locales) && locales.find((loc) => loc.code === currentDesiredLocale);
|
499
755
|
if (!hasI18n) {
|
500
756
|
return null;
|
501
757
|
}
|
502
758
|
return {
|
503
759
|
disabled: document?.locale && !canDelete.includes(document.locale) || !document || !document.id,
|
504
760
|
position: ["header", "table-row"],
|
505
|
-
label: formatMessage(
|
506
|
-
|
507
|
-
|
508
|
-
|
761
|
+
label: formatMessage(
|
762
|
+
{
|
763
|
+
id: getTranslation("actions.delete.label"),
|
764
|
+
defaultMessage: "Delete entry ({locale})"
|
765
|
+
},
|
766
|
+
{ locale: locale && locale.name }
|
767
|
+
),
|
509
768
|
icon: /* @__PURE__ */ jsxRuntime.jsx(StyledTrash, {}),
|
510
769
|
variant: "danger",
|
511
770
|
dialog: {
|
@@ -522,7 +781,12 @@ const DeleteLocaleAction = ({
|
|
522
781
|
}) })
|
523
782
|
] }),
|
524
783
|
onConfirm: async () => {
|
525
|
-
|
784
|
+
const unableToDelete = (
|
785
|
+
// We are unable to delete a collection type without a document ID
|
786
|
+
// & unable to delete generally if there is no document locale
|
787
|
+
collectionType !== "single-types" && !documentId || !document?.locale
|
788
|
+
);
|
789
|
+
if (unableToDelete) {
|
526
790
|
console.error(
|
527
791
|
"You're trying to delete a document without an id or locale, this is likely a bug with Strapi. Please open an issue."
|
528
792
|
);
|
@@ -548,37 +812,43 @@ const DeleteLocaleAction = ({
|
|
548
812
|
}
|
549
813
|
};
|
550
814
|
};
|
551
|
-
const
|
815
|
+
const BulkLocaleAction = ({
|
552
816
|
document: baseDocument,
|
553
817
|
documentId,
|
554
818
|
model,
|
555
|
-
collectionType
|
819
|
+
collectionType,
|
820
|
+
action
|
556
821
|
}) => {
|
557
822
|
const baseLocale = baseDocument?.locale ?? null;
|
558
|
-
const [{ query }] = strapiAdmin.useQueryParams();
|
559
|
-
const params = React__namespace.useMemo(() => strapiAdmin$1.buildValidParams(query), [query]);
|
560
|
-
const
|
823
|
+
const [{ query: query$1 }] = strapiAdmin.useQueryParams();
|
824
|
+
const params = React__namespace.useMemo(() => strapiAdmin$1.buildValidParams(query$1), [query$1]);
|
825
|
+
const isOnPublishedTab = query$1.status === "published";
|
561
826
|
const { formatMessage } = reactIntl.useIntl();
|
562
827
|
const { hasI18n, canPublish } = useI18n();
|
563
828
|
const { toggleNotification } = strapiAdmin.useNotification();
|
564
829
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
565
830
|
const [selectedRows, setSelectedRows] = React__namespace.useState([]);
|
566
831
|
const [isDraftRelationConfirmationOpen, setIsDraftRelationConfirmationOpen] = React__namespace.useState(false);
|
567
|
-
const { publishMany: publishManyAction } = strapiAdmin$1.unstable_useDocumentActions();
|
832
|
+
const { publishMany: publishManyAction, unpublishMany: unpublishManyAction } = strapiAdmin$1.unstable_useDocumentActions();
|
568
833
|
const {
|
569
834
|
document,
|
570
835
|
meta: documentMeta,
|
571
836
|
schema,
|
572
837
|
validate
|
573
|
-
} = strapiAdmin$1.unstable_useDocument(
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
838
|
+
} = strapiAdmin$1.unstable_useDocument(
|
839
|
+
{
|
840
|
+
model,
|
841
|
+
collectionType,
|
842
|
+
documentId,
|
843
|
+
params: {
|
844
|
+
locale: baseLocale
|
845
|
+
}
|
846
|
+
},
|
847
|
+
{
|
848
|
+
skip: !hasI18n || !baseLocale
|
579
849
|
}
|
580
|
-
|
581
|
-
const { data: localesMetadata = [] } = useGetLocalesQuery();
|
850
|
+
);
|
851
|
+
const { data: localesMetadata = [] } = useGetLocalesQuery(hasI18n ? void 0 : query.skipToken);
|
582
852
|
const headers = [
|
583
853
|
{
|
584
854
|
label: formatMessage({
|
@@ -627,12 +897,19 @@ const BulkLocalePublishAction = ({
|
|
627
897
|
}, {});
|
628
898
|
return [rowsFromMeta, errors];
|
629
899
|
}, [document, documentMeta?.availableLocales, validate]);
|
630
|
-
const
|
631
|
-
|
900
|
+
const isBulkPublish = action === "bulk-publish";
|
901
|
+
const localesForAction = selectedRows.reduce((acc, selectedRow) => {
|
902
|
+
const isValidLocale = (
|
903
|
+
// Validation errors are irrelevant if we are trying to unpublish
|
904
|
+
!isBulkPublish || !Object.keys(validationErrors).includes(selectedRow.locale)
|
905
|
+
);
|
906
|
+
const shouldAddLocale = isBulkPublish ? selectedRow.status !== "published" && isValidLocale : selectedRow.status !== "draft" && isValidLocale;
|
907
|
+
if (shouldAddLocale) {
|
632
908
|
acc.push(selectedRow.locale);
|
633
909
|
}
|
634
910
|
return acc;
|
635
911
|
}, []);
|
912
|
+
const enableDraftRelationsCount = false;
|
636
913
|
const {
|
637
914
|
data: draftRelationsCount = 0,
|
638
915
|
isLoading: isDraftRelationsLoading,
|
@@ -641,10 +918,10 @@ const BulkLocalePublishAction = ({
|
|
641
918
|
{
|
642
919
|
model,
|
643
920
|
documentIds: [documentId],
|
644
|
-
locale:
|
921
|
+
locale: localesForAction
|
645
922
|
},
|
646
923
|
{
|
647
|
-
skip: !
|
924
|
+
skip: !enableDraftRelationsCount
|
648
925
|
}
|
649
926
|
);
|
650
927
|
React__namespace.useEffect(() => {
|
@@ -670,7 +947,18 @@ const BulkLocalePublishAction = ({
|
|
670
947
|
documentIds: [documentId],
|
671
948
|
params: {
|
672
949
|
...params,
|
673
|
-
locale:
|
950
|
+
locale: localesForAction
|
951
|
+
}
|
952
|
+
});
|
953
|
+
setSelectedRows([]);
|
954
|
+
};
|
955
|
+
const unpublish = async () => {
|
956
|
+
await unpublishManyAction({
|
957
|
+
model,
|
958
|
+
documentIds: [documentId],
|
959
|
+
params: {
|
960
|
+
...params,
|
961
|
+
locale: localesForAction
|
674
962
|
}
|
675
963
|
});
|
676
964
|
setSelectedRows([]);
|
@@ -678,14 +966,12 @@ const BulkLocalePublishAction = ({
|
|
678
966
|
const handleAction = async () => {
|
679
967
|
if (draftRelationsCount > 0) {
|
680
968
|
setIsDraftRelationConfirmationOpen(true);
|
681
|
-
} else {
|
969
|
+
} else if (isBulkPublish) {
|
682
970
|
await publish();
|
971
|
+
} else {
|
972
|
+
await unpublish();
|
683
973
|
}
|
684
974
|
};
|
685
|
-
const isUnpublish = document?.status === "published";
|
686
|
-
if (isUnpublish) {
|
687
|
-
console.warn(["I18N"], "Bulk locale unpublish modal not implemented");
|
688
|
-
}
|
689
975
|
if (isDraftRelationConfirmationOpen) {
|
690
976
|
return {
|
691
977
|
label: formatMessage({
|
@@ -720,20 +1006,21 @@ const BulkLocalePublishAction = ({
|
|
720
1006
|
}
|
721
1007
|
};
|
722
1008
|
}
|
1009
|
+
const hasPermission = selectedRows.map(({ locale }) => locale).every((locale) => canPublish.includes(locale));
|
723
1010
|
return {
|
724
1011
|
label: formatMessage({
|
725
|
-
id: getTranslation("
|
726
|
-
defaultMessage: "Publish Multiple Locales
|
1012
|
+
id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? "publish" : "unpublish"}-title`),
|
1013
|
+
defaultMessage: `${isBulkPublish ? "Publish" : "Unpublish"} Multiple Locales`
|
727
1014
|
}),
|
728
|
-
|
729
|
-
|
1015
|
+
variant: isBulkPublish ? "secondary" : "danger",
|
1016
|
+
icon: isBulkPublish ? /* @__PURE__ */ jsxRuntime.jsx(icons.ListPlus, {}) : /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}),
|
1017
|
+
disabled: isOnPublishedTab || canPublish.length === 0,
|
730
1018
|
position: ["panel"],
|
731
|
-
variant: "secondary",
|
732
1019
|
dialog: {
|
733
1020
|
type: "modal",
|
734
1021
|
title: formatMessage({
|
735
|
-
id: getTranslation("
|
736
|
-
defaultMessage: "Publish Multiple Locales
|
1022
|
+
id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? "publish" : "unpublish"}-title`),
|
1023
|
+
defaultMessage: `${isBulkPublish ? "Publish" : "Unpublish"} Multiple Locales`
|
737
1024
|
}),
|
738
1025
|
content: () => {
|
739
1026
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
@@ -752,28 +1039,35 @@ const BulkLocalePublishAction = ({
|
|
752
1039
|
validationErrors,
|
753
1040
|
headers,
|
754
1041
|
rows,
|
755
|
-
localesMetadata
|
1042
|
+
localesMetadata,
|
1043
|
+
action: action ?? "bulk-publish"
|
756
1044
|
}
|
757
1045
|
)
|
758
1046
|
}
|
759
1047
|
);
|
760
1048
|
},
|
761
|
-
footer: () => /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
1049
|
+
footer: () => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Footer, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
762
1050
|
designSystem.Button,
|
763
1051
|
{
|
764
1052
|
loading: isDraftRelationsLoading,
|
765
|
-
disabled:
|
1053
|
+
disabled: !hasPermission || localesForAction.length === 0,
|
766
1054
|
variant: "default",
|
767
1055
|
onClick: handleAction,
|
768
1056
|
children: formatMessage({
|
769
|
-
id: "app.utils.publish",
|
770
|
-
defaultMessage: "Publish"
|
1057
|
+
id: isBulkPublish ? "app.utils.publish" : "app.utils.unpublish",
|
1058
|
+
defaultMessage: isBulkPublish ? "Publish" : "Unpublish"
|
771
1059
|
})
|
772
1060
|
}
|
773
1061
|
) })
|
774
1062
|
}
|
775
1063
|
};
|
776
1064
|
};
|
1065
|
+
const BulkLocalePublishAction = (props) => {
|
1066
|
+
return BulkLocaleAction({ action: "bulk-publish", ...props });
|
1067
|
+
};
|
1068
|
+
const BulkLocaleUnpublishAction = (props) => {
|
1069
|
+
return BulkLocaleAction({ action: "bulk-unpublish", ...props });
|
1070
|
+
};
|
777
1071
|
const StyledTrash = styledComponents.styled(icons.Trash)`
|
778
1072
|
path {
|
779
1073
|
fill: currentColor;
|
@@ -830,16 +1124,9 @@ const UnpublishModalAdditionalInfo = () => {
|
|
830
1124
|
}
|
831
1125
|
) });
|
832
1126
|
};
|
833
|
-
const Initializer = ({ setPlugin }) => {
|
834
|
-
const setPluginRef = React__namespace.useRef(setPlugin);
|
835
|
-
React__namespace.useEffect(() => {
|
836
|
-
setPluginRef.current(pluginId);
|
837
|
-
}, []);
|
838
|
-
return null;
|
839
|
-
};
|
840
1127
|
const LocalePicker = () => {
|
841
1128
|
const { formatMessage } = reactIntl.useIntl();
|
842
|
-
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
1129
|
+
const [{ query: query2 }, setQuery] = strapiAdmin.useQueryParams();
|
843
1130
|
const { hasI18n, canRead, canCreate } = useI18n();
|
844
1131
|
const { data: locales = [] } = useGetLocalesQuery(void 0, {
|
845
1132
|
skip: !hasI18n
|
@@ -849,25 +1136,25 @@ const LocalePicker = () => {
|
|
849
1136
|
setQuery(
|
850
1137
|
{
|
851
1138
|
page: 1,
|
852
|
-
plugins: { ...
|
1139
|
+
plugins: { ...query2.plugins, i18n: { locale: code } }
|
853
1140
|
},
|
854
1141
|
"push",
|
855
1142
|
replace
|
856
1143
|
);
|
857
1144
|
},
|
858
|
-
[
|
1145
|
+
[query2.plugins, setQuery]
|
859
1146
|
);
|
860
1147
|
React__namespace.useEffect(() => {
|
861
1148
|
if (!Array.isArray(locales) || !hasI18n) {
|
862
1149
|
return;
|
863
1150
|
}
|
864
|
-
const currentDesiredLocale =
|
1151
|
+
const currentDesiredLocale = query2.plugins?.i18n?.locale;
|
865
1152
|
const doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);
|
866
1153
|
const defaultLocale = locales.find((locale) => locale.isDefault);
|
867
1154
|
if (!doesLocaleExist && defaultLocale?.code) {
|
868
1155
|
handleChange(defaultLocale.code, true);
|
869
1156
|
}
|
870
|
-
}, [hasI18n, handleChange, locales,
|
1157
|
+
}, [hasI18n, handleChange, locales, query2.plugins?.i18n?.locale]);
|
871
1158
|
if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {
|
872
1159
|
return null;
|
873
1160
|
}
|
@@ -882,7 +1169,7 @@ const LocalePicker = () => {
|
|
882
1169
|
id: getTranslation("actions.select-locale"),
|
883
1170
|
defaultMessage: "Select locale"
|
884
1171
|
}),
|
885
|
-
value:
|
1172
|
+
value: query2.plugins?.i18n?.locale || locales.find((locale) => locale.isDefault)?.code,
|
886
1173
|
onChange: handleChange,
|
887
1174
|
children: displayedLocales.map((locale) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: locale.code, children: locale.name }, locale.id))
|
888
1175
|
}
|
@@ -1000,54 +1287,13 @@ const LocaleListCell = ({
|
|
1000
1287
|
return locale.name;
|
1001
1288
|
}).toSorted((a, b) => formatter.compare(a, b));
|
1002
1289
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Popover.Root, { children: [
|
1003
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
1004
|
-
|
1005
|
-
{
|
1006
|
-
|
1007
|
-
alignItems: "center",
|
1008
|
-
justifyContent: "center",
|
1009
|
-
height: "3.2rem",
|
1010
|
-
width: "3.2rem",
|
1011
|
-
children: [
|
1012
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", ellipsis: true, children: localesForDocument.join(", ") }),
|
1013
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, {}) })
|
1014
|
-
]
|
1015
|
-
}
|
1016
|
-
) }) }),
|
1290
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "ghost", type: "button", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { minWidth: "100%", alignItems: "center", justifyContent: "center", fontWeight: "regular", children: [
|
1291
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", ellipsis: true, marginRight: 2, children: localesForDocument.join(", ") }),
|
1292
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, { width: "1.2rem", height: "1.2rem" }) })
|
1293
|
+
] }) }) }),
|
1017
1294
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Content, { sideOffset: 16, children: /* @__PURE__ */ jsxRuntime.jsx("ul", { children: localesForDocument.map((name) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 3, tag: "li", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: name }) }, name)) }) })
|
1018
1295
|
] });
|
1019
1296
|
};
|
1020
|
-
const Button = styledComponents.styled.button`
|
1021
|
-
width: 100%;
|
1022
|
-
|
1023
|
-
svg {
|
1024
|
-
> g,
|
1025
|
-
path {
|
1026
|
-
fill: ${({ theme }) => theme.colors.neutral500};
|
1027
|
-
}
|
1028
|
-
}
|
1029
|
-
&:hover {
|
1030
|
-
svg {
|
1031
|
-
> g,
|
1032
|
-
path {
|
1033
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
1034
|
-
}
|
1035
|
-
}
|
1036
|
-
}
|
1037
|
-
&:active {
|
1038
|
-
svg {
|
1039
|
-
> g,
|
1040
|
-
path {
|
1041
|
-
fill: ${({ theme }) => theme.colors.neutral400};
|
1042
|
-
}
|
1043
|
-
}
|
1044
|
-
}
|
1045
|
-
`;
|
1046
|
-
const ActionWrapper = styledComponents.styled(designSystem.Flex)`
|
1047
|
-
svg {
|
1048
|
-
height: 0.4rem;
|
1049
|
-
}
|
1050
|
-
`;
|
1051
1297
|
const addColumnToTableHook = ({ displayedHeaders, layout }) => {
|
1052
1298
|
const { options } = layout;
|
1053
1299
|
const isFieldLocalized = doesPluginOptionsHaveI18nLocalized(options) ? options.i18n.localized : false;
|
@@ -1076,18 +1322,11 @@ const addColumnToTableHook = ({ displayedHeaders, layout }) => {
|
|
1076
1322
|
const addLocaleToReleasesHook = ({ displayedHeaders = [] }) => {
|
1077
1323
|
return {
|
1078
1324
|
displayedHeaders: [
|
1079
|
-
|
1080
|
-
// ...displayedHeaders,
|
1325
|
+
...displayedHeaders,
|
1081
1326
|
{
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
label: {
|
1086
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
1087
|
-
defaultMessage: "locale"
|
1088
|
-
},
|
1089
|
-
searchable: false,
|
1090
|
-
sortable: false
|
1327
|
+
label: {
|
1328
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
1329
|
+
defaultMessage: "locale"
|
1091
1330
|
},
|
1092
1331
|
name: "locale"
|
1093
1332
|
}
|
@@ -1180,9 +1419,6 @@ const localeMiddleware = (ctx) => (next) => (permissions) => {
|
|
1180
1419
|
return next(revisedPermissions);
|
1181
1420
|
};
|
1182
1421
|
const prefixPluginTranslations = (trad, pluginId2) => {
|
1183
|
-
if (!pluginId2) {
|
1184
|
-
throw new TypeError("pluginId can't be empty");
|
1185
|
-
}
|
1186
1422
|
return Object.keys(trad).reduce((acc, current) => {
|
1187
1423
|
acc[`${pluginId2}.${current}`] = trad[current];
|
1188
1424
|
return acc;
|
@@ -1235,8 +1471,6 @@ const index = {
|
|
1235
1471
|
app.addRBACMiddleware([localeMiddleware]);
|
1236
1472
|
app.registerPlugin({
|
1237
1473
|
id: pluginId,
|
1238
|
-
initializer: Initializer,
|
1239
|
-
isReady: false,
|
1240
1474
|
name: pluginId
|
1241
1475
|
});
|
1242
1476
|
},
|
@@ -1254,11 +1488,11 @@ const index = {
|
|
1254
1488
|
},
|
1255
1489
|
id: "internationalization",
|
1256
1490
|
to: "internationalization",
|
1257
|
-
Component: () => Promise.resolve().then(() => require("./SettingsPage-
|
1491
|
+
Component: () => Promise.resolve().then(() => require("./SettingsPage-Z94BBMrV.js")).then((mod) => ({ default: mod.ProtectedSettingsPage })),
|
1258
1492
|
permissions: PERMISSIONS.accessMain
|
1259
1493
|
});
|
1260
1494
|
const contentManager = app.getPlugin("content-manager");
|
1261
|
-
contentManager.apis.addDocumentHeaderAction([LocalePickerAction]);
|
1495
|
+
contentManager.apis.addDocumentHeaderAction([LocalePickerAction, FillFromAnotherLocaleAction]);
|
1262
1496
|
contentManager.apis.addDocumentAction((actions) => {
|
1263
1497
|
const indexOfDeleteAction = actions.findIndex((action) => action.type === "delete");
|
1264
1498
|
actions.splice(indexOfDeleteAction, 0, DeleteLocaleAction);
|
@@ -1266,6 +1500,7 @@ const index = {
|
|
1266
1500
|
});
|
1267
1501
|
contentManager.apis.addDocumentAction((actions) => {
|
1268
1502
|
actions.splice(2, 0, BulkLocalePublishAction);
|
1503
|
+
actions.splice(5, 0, BulkLocaleUnpublishAction);
|
1269
1504
|
return actions;
|
1270
1505
|
});
|
1271
1506
|
contentManager.injectComponent("listView", "actions", {
|
@@ -1371,7 +1606,7 @@ const index = {
|
|
1371
1606
|
async registerTrads({ locales }) {
|
1372
1607
|
const importedTrads = await Promise.all(
|
1373
1608
|
locales.map((locale) => {
|
1374
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-DtWiGdHl.js")), "./translations/dk.json": () => Promise.resolve().then(() => require("./dk-D8C-casx.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-
|
1609
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-DtWiGdHl.js")), "./translations/dk.json": () => Promise.resolve().then(() => require("./dk-D8C-casx.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-BKBz3tro.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-DS-XFGSw.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-BTjekDpq.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-DmcGUBQ3.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-Cn5RYonZ.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BMBgVL3s.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-CarUU76c.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-DSHIXAa3.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CukOviB0.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
|
1375
1610
|
return {
|
1376
1611
|
data: prefixPluginTranslations(data, pluginId),
|
1377
1612
|
locale
|
@@ -1395,4 +1630,4 @@ exports.useDeleteLocaleMutation = useDeleteLocaleMutation;
|
|
1395
1630
|
exports.useGetDefaultLocalesQuery = useGetDefaultLocalesQuery;
|
1396
1631
|
exports.useGetLocalesQuery = useGetLocalesQuery;
|
1397
1632
|
exports.useUpdateLocaleMutation = useUpdateLocaleMutation;
|
1398
|
-
//# sourceMappingURL=index-
|
1633
|
+
//# sourceMappingURL=index-BOvOaxo-.js.map
|