@strapi/i18n 0.0.0-experimental.826f263c58b6886b849d3f03b81f7a530bc51c91 → 0.0.0-experimental.82afe56cecefd0078d534e25909834ecf5fdd404
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-0FFSTUW2.mjs → SettingsPage-B-KzAqT3.mjs} +95 -108
- package/dist/_chunks/SettingsPage-B-KzAqT3.mjs.map +1 -0
- package/dist/_chunks/{SettingsPage-DnLLGeBa.js → SettingsPage-hyOi94O9.js} +94 -108
- package/dist/_chunks/SettingsPage-hyOi94O9.js.map +1 -0
- package/dist/_chunks/{de-DtWiGdHl.js → de-BOhNX_-5.js} +1 -2
- package/dist/_chunks/de-BOhNX_-5.js.map +1 -0
- package/dist/_chunks/{de-9eCAqqrB.mjs → de-D80IRBP9.mjs} +1 -2
- package/dist/_chunks/de-D80IRBP9.mjs.map +1 -0
- package/dist/_chunks/{dk-2qBjxt-P.mjs → dk-CJ6Zzz78.mjs} +1 -2
- package/dist/_chunks/dk-CJ6Zzz78.mjs.map +1 -0
- package/dist/_chunks/{dk-D8C-casx.js → dk-cjXm0p3m.js} +1 -2
- package/dist/_chunks/dk-cjXm0p3m.js.map +1 -0
- package/dist/_chunks/{en-18tWw4P6.mjs → en-BTyF7WVW.mjs} +12 -4
- package/dist/_chunks/en-BTyF7WVW.mjs.map +1 -0
- package/dist/_chunks/{en-Kv6y9zPQ.js → en-UlC0jh2t.js} +12 -4
- package/dist/_chunks/en-UlC0jh2t.js.map +1 -0
- package/dist/_chunks/{es-DlmMVaBG.mjs → es-V8WnPN7w.mjs} +1 -2
- package/dist/_chunks/es-V8WnPN7w.mjs.map +1 -0
- package/dist/_chunks/{es-DS-XFGSw.js → es-hr9b_HLp.js} +1 -2
- package/dist/_chunks/es-hr9b_HLp.js.map +1 -0
- package/dist/_chunks/{fr-BTjekDpq.js → fr-BFmBbE0H.js} +1 -2
- package/dist/_chunks/fr-BFmBbE0H.js.map +1 -0
- package/dist/_chunks/{fr-3S6ke71d.mjs → fr-F94noFiV.mjs} +1 -2
- package/dist/_chunks/fr-F94noFiV.mjs.map +1 -0
- package/dist/_chunks/{index-BddUXwss.mjs → index-BcYj5jo9.mjs} +476 -275
- package/dist/_chunks/index-BcYj5jo9.mjs.map +1 -0
- package/dist/_chunks/{index-DtEKsPcR.js → index-C8NzsAKp.js} +483 -283
- package/dist/_chunks/index-C8NzsAKp.js.map +1 -0
- package/dist/_chunks/{ko-DmcGUBQ3.js → ko-C40pNQ9b.js} +1 -2
- package/dist/_chunks/ko-C40pNQ9b.js.map +1 -0
- package/dist/_chunks/{ko-qTjQ8IMw.mjs → ko-CF-P3Car.mjs} +1 -2
- package/dist/_chunks/ko-CF-P3Car.mjs.map +1 -0
- package/dist/_chunks/{pl-B67TSHqT.mjs → pl-Dxr9RUmD.mjs} +1 -2
- package/dist/_chunks/pl-Dxr9RUmD.mjs.map +1 -0
- package/dist/_chunks/{pl-Cn5RYonZ.js → pl-JtWBy-JQ.js} +1 -2
- package/dist/_chunks/pl-JtWBy-JQ.js.map +1 -0
- package/dist/_chunks/{ru-hagMa57T.mjs → ru-B-4sVwXN.mjs} +1 -2
- package/dist/_chunks/ru-B-4sVwXN.mjs.map +1 -0
- package/dist/_chunks/{ru-BMBgVL3s.js → ru-COSWt3Nu.js} +1 -2
- package/dist/_chunks/ru-COSWt3Nu.js.map +1 -0
- package/dist/_chunks/{tr-CarUU76c.js → tr-BVj1O5ch.js} +1 -2
- package/dist/_chunks/tr-BVj1O5ch.js.map +1 -0
- package/dist/_chunks/{tr-Dw_jmkG-.mjs → tr-Ccu6Yj11.mjs} +1 -2
- package/dist/_chunks/tr-Ccu6Yj11.mjs.map +1 -0
- package/dist/_chunks/{zh-57YM4amO.mjs → zh-BIz395Ms.mjs} +1 -2
- package/dist/_chunks/zh-BIz395Ms.mjs.map +1 -0
- package/dist/_chunks/{zh-Hans-Dyc-aR-h.mjs → zh-Hans-Bfo6_TCM.mjs} +1 -2
- package/dist/_chunks/zh-Hans-Bfo6_TCM.mjs.map +1 -0
- package/dist/_chunks/{zh-Hans-DSHIXAa3.js → zh-Hans-DIEm_EMC.js} +1 -2
- package/dist/_chunks/zh-Hans-DIEm_EMC.js.map +1 -0
- package/dist/_chunks/{zh-CukOviB0.js → zh-wkBPBkhc.js} +1 -2
- package/dist/_chunks/zh-wkBPBkhc.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/components/EditLocale.d.ts +5 -4
- package/dist/admin/src/components/LocaleListCell.d.ts +4 -4
- 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 +418 -478
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +419 -478
- 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 -14
- package/dist/_chunks/SettingsPage-0FFSTUW2.mjs.map +0 -1
- package/dist/_chunks/SettingsPage-DnLLGeBa.js.map +0 -1
- package/dist/_chunks/de-9eCAqqrB.mjs.map +0 -1
- package/dist/_chunks/de-DtWiGdHl.js.map +0 -1
- package/dist/_chunks/dk-2qBjxt-P.mjs.map +0 -1
- package/dist/_chunks/dk-D8C-casx.js.map +0 -1
- package/dist/_chunks/en-18tWw4P6.mjs.map +0 -1
- package/dist/_chunks/en-Kv6y9zPQ.js.map +0 -1
- package/dist/_chunks/es-DS-XFGSw.js.map +0 -1
- package/dist/_chunks/es-DlmMVaBG.mjs.map +0 -1
- package/dist/_chunks/fr-3S6ke71d.mjs.map +0 -1
- package/dist/_chunks/fr-BTjekDpq.js.map +0 -1
- package/dist/_chunks/index-BddUXwss.mjs.map +0 -1
- package/dist/_chunks/index-DtEKsPcR.js.map +0 -1
- package/dist/_chunks/ko-DmcGUBQ3.js.map +0 -1
- package/dist/_chunks/ko-qTjQ8IMw.mjs.map +0 -1
- package/dist/_chunks/pl-B67TSHqT.mjs.map +0 -1
- package/dist/_chunks/pl-Cn5RYonZ.js.map +0 -1
- package/dist/_chunks/ru-BMBgVL3s.js.map +0 -1
- package/dist/_chunks/ru-hagMa57T.mjs.map +0 -1
- package/dist/_chunks/tr-CarUU76c.js.map +0 -1
- package/dist/_chunks/tr-Dw_jmkG-.mjs.map +0 -1
- package/dist/_chunks/zh-57YM4amO.mjs.map +0 -1
- package/dist/_chunks/zh-CukOviB0.js.map +0 -1
- package/dist/_chunks/zh-Hans-DSHIXAa3.js.map +0 -1
- package/dist/_chunks/zh-Hans-Dyc-aR-h.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");
|
@@ -14,8 +15,7 @@ const qs = require("qs");
|
|
14
15
|
const omit = require("lodash/omit");
|
15
16
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
16
17
|
function _interopNamespace(e) {
|
17
|
-
if (e && e.__esModule)
|
18
|
-
return e;
|
18
|
+
if (e && e.__esModule) return e;
|
19
19
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
20
20
|
if (e) {
|
21
21
|
for (const k in e) {
|
@@ -36,13 +36,20 @@ const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
36
36
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
37
37
|
const qs__namespace = /* @__PURE__ */ _interopNamespace(qs);
|
38
38
|
const omit__default = /* @__PURE__ */ _interopDefault(omit);
|
39
|
-
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
39
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
40
40
|
const v = glob[path];
|
41
41
|
if (v) {
|
42
42
|
return typeof v === "function" ? v() : Promise.resolve(v);
|
43
43
|
}
|
44
44
|
return new Promise((_, reject) => {
|
45
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
45
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
46
|
+
reject.bind(
|
47
|
+
null,
|
48
|
+
new Error(
|
49
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
50
|
+
)
|
51
|
+
)
|
52
|
+
);
|
46
53
|
});
|
47
54
|
};
|
48
55
|
const pluginId = "i18n";
|
@@ -71,9 +78,7 @@ const CheckboxConfirmation = ({
|
|
71
78
|
};
|
72
79
|
const handleConfirm = () => {
|
73
80
|
onChange({ target: { name, value: false, type: "checkbox" } });
|
74
|
-
setIsOpen(false);
|
75
81
|
};
|
76
|
-
const handleToggle = () => setIsOpen((prev) => !prev);
|
77
82
|
const label = intlLabel.id ? formatMessage(
|
78
83
|
{ id: intlLabel.id, defaultMessage: intlLabel.defaultMessage },
|
79
84
|
{ ...intlLabel.values }
|
@@ -82,35 +87,36 @@ const CheckboxConfirmation = ({
|
|
82
87
|
{ id: description.id, defaultMessage: description.defaultMessage },
|
83
88
|
{ ...description.values }
|
84
89
|
) : "";
|
85
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
90
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
|
86
91
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { hint, name, children: [
|
87
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Checkbox, {
|
92
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Checkbox, { onCheckedChange: handleChange, checked: value, children: label }),
|
88
93
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
89
94
|
] }),
|
90
|
-
|
91
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
92
|
-
|
95
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
|
96
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: formatMessage({
|
97
|
+
id: getTranslation("CheckboxConfirmation.Modal.title"),
|
98
|
+
defaultMessage: "Disable localization"
|
99
|
+
}) }),
|
100
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { icon: /* @__PURE__ */ jsxRuntime.jsx(icons.WarningCircle, {}), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
101
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(TextAlignTypography, { children: formatMessage({
|
93
102
|
id: getTranslation("CheckboxConfirmation.Modal.content"),
|
94
103
|
defaultMessage: "Disabling localization will engender the deletion of all your content but the one associated to your default locale (if existing)."
|
95
104
|
}) }) }),
|
96
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "semiBold",
|
105
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "semiBold", children: formatMessage({
|
97
106
|
id: getTranslation("CheckboxConfirmation.Modal.body"),
|
98
107
|
defaultMessage: "Do you want to disable it?"
|
99
108
|
}) }) })
|
100
109
|
] }) }),
|
101
|
-
/* @__PURE__ */ jsxRuntime.
|
102
|
-
designSystem.
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
}) })
|
112
|
-
}
|
113
|
-
)
|
110
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
|
111
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", children: formatMessage({
|
112
|
+
id: "components.popUpWarning.button.cancel",
|
113
|
+
defaultMessage: "No, cancel"
|
114
|
+
}) }) }),
|
115
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Action, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "danger-light", onClick: handleConfirm, children: formatMessage({
|
116
|
+
id: getTranslation("CheckboxConfirmation.Modal.button-confirm"),
|
117
|
+
defaultMessage: "Yes, disable"
|
118
|
+
}) }) })
|
119
|
+
] })
|
114
120
|
] })
|
115
121
|
] });
|
116
122
|
};
|
@@ -161,7 +167,7 @@ const useI18n = () => {
|
|
161
167
|
model: params.slug
|
162
168
|
},
|
163
169
|
{
|
164
|
-
skip:
|
170
|
+
skip: true
|
165
171
|
}
|
166
172
|
);
|
167
173
|
if (doesPluginOptionsHaveI18nLocalized(schema?.pluginOptions)) {
|
@@ -241,10 +247,94 @@ const relationsApi = i18nApi.injectEndpoints({
|
|
241
247
|
})
|
242
248
|
});
|
243
249
|
const { useGetManyDraftRelationCountQuery } = relationsApi;
|
250
|
+
const cleanData = (data, schema, components) => {
|
251
|
+
const cleanedData = removeFields(data, [
|
252
|
+
"createdAt",
|
253
|
+
"createdBy",
|
254
|
+
"updatedAt",
|
255
|
+
"updatedBy",
|
256
|
+
"id",
|
257
|
+
"documentId",
|
258
|
+
"publishedAt",
|
259
|
+
"strapi_stage",
|
260
|
+
"strapi_assignee",
|
261
|
+
"locale",
|
262
|
+
"status"
|
263
|
+
]);
|
264
|
+
const cleanedDataWithoutPasswordAndRelation = recursiveRemoveFieldTypes(
|
265
|
+
cleanedData,
|
266
|
+
schema,
|
267
|
+
components,
|
268
|
+
["relation", "password"]
|
269
|
+
);
|
270
|
+
return cleanedDataWithoutPasswordAndRelation;
|
271
|
+
};
|
272
|
+
const removeFields = (data, fields) => {
|
273
|
+
return Object.keys(data).reduce((acc, current) => {
|
274
|
+
if (fields.includes(current)) {
|
275
|
+
return acc;
|
276
|
+
}
|
277
|
+
acc[current] = data[current];
|
278
|
+
return acc;
|
279
|
+
}, {});
|
280
|
+
};
|
281
|
+
const recursiveRemoveFieldTypes = (data, schema, components, fields) => {
|
282
|
+
return Object.keys(data).reduce((acc, current) => {
|
283
|
+
const attribute = schema.attributes[current] ?? { type: void 0 };
|
284
|
+
if (fields.includes(attribute.type)) {
|
285
|
+
return acc;
|
286
|
+
}
|
287
|
+
if (attribute.type === "dynamiczone") {
|
288
|
+
acc[current] = data[current].map((componentValue, index2) => {
|
289
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
290
|
+
componentValue,
|
291
|
+
components[componentValue.__component],
|
292
|
+
components,
|
293
|
+
fields
|
294
|
+
);
|
295
|
+
return {
|
296
|
+
...rest,
|
297
|
+
__temp_key__: index2 + 1
|
298
|
+
};
|
299
|
+
});
|
300
|
+
} else if (attribute.type === "component") {
|
301
|
+
const { repeatable, component } = attribute;
|
302
|
+
if (repeatable) {
|
303
|
+
acc[current] = (data[current] ?? []).map((compoData, index2) => {
|
304
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
305
|
+
compoData,
|
306
|
+
components[component],
|
307
|
+
components,
|
308
|
+
fields
|
309
|
+
);
|
310
|
+
return {
|
311
|
+
...rest,
|
312
|
+
__temp_key__: index2 + 1
|
313
|
+
};
|
314
|
+
});
|
315
|
+
} else {
|
316
|
+
const { id: _, ...rest } = recursiveRemoveFieldTypes(
|
317
|
+
data[current] ?? {},
|
318
|
+
components[component],
|
319
|
+
components,
|
320
|
+
fields
|
321
|
+
);
|
322
|
+
acc[current] = rest;
|
323
|
+
}
|
324
|
+
} else {
|
325
|
+
acc[current] = data[current];
|
326
|
+
}
|
327
|
+
return acc;
|
328
|
+
}, {});
|
329
|
+
};
|
244
330
|
const isErrorMessageDescriptor = (object) => {
|
245
331
|
return typeof object === "object" && object !== null && "id" in object && "defaultMessage" in object;
|
246
332
|
};
|
247
|
-
const EntryValidationText = ({
|
333
|
+
const EntryValidationText = ({
|
334
|
+
status = "draft",
|
335
|
+
validationErrors,
|
336
|
+
action
|
337
|
+
}) => {
|
248
338
|
const { formatMessage } = reactIntl.useIntl();
|
249
339
|
const getErrorStr = (key, value) => {
|
250
340
|
if (typeof value === "string") {
|
@@ -278,30 +368,63 @@ const EntryValidationText = ({ status = "draft", validationErrors }) => {
|
|
278
368
|
) })
|
279
369
|
] });
|
280
370
|
}
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
371
|
+
const getStatusMessage = () => {
|
372
|
+
if (action === "bulk-publish") {
|
373
|
+
if (status === "published") {
|
374
|
+
return {
|
375
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
376
|
+
text: formatMessage({
|
377
|
+
id: "content-manager.bulk-publish.already-published",
|
378
|
+
defaultMessage: "Already Published"
|
379
|
+
}),
|
380
|
+
textColor: "success600",
|
381
|
+
fontWeight: "bold"
|
382
|
+
};
|
383
|
+
} else if (status === "modified") {
|
384
|
+
return {
|
385
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowsCounterClockwise, { fill: "alternative600" }),
|
386
|
+
text: formatMessage({
|
387
|
+
id: "app.utils.ready-to-publish-changes",
|
388
|
+
defaultMessage: "Ready to publish changes"
|
389
|
+
})
|
390
|
+
};
|
391
|
+
} else {
|
392
|
+
return {
|
393
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
394
|
+
text: formatMessage({
|
395
|
+
id: "app.utils.ready-to-publish",
|
396
|
+
defaultMessage: "Ready to publish"
|
397
|
+
})
|
398
|
+
};
|
399
|
+
}
|
400
|
+
} else {
|
401
|
+
if (status === "draft") {
|
402
|
+
return {
|
403
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
404
|
+
text: formatMessage({
|
405
|
+
id: "content-manager.bulk-unpublish.already-unpublished",
|
406
|
+
defaultMessage: "Already Unpublished"
|
407
|
+
}),
|
408
|
+
textColor: "success600",
|
409
|
+
fontWeight: "bold"
|
410
|
+
};
|
411
|
+
} else {
|
412
|
+
return {
|
413
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
414
|
+
text: formatMessage({
|
415
|
+
id: "app.utils.ready-to-unpublish-changes",
|
416
|
+
defaultMessage: "Ready to unpublish"
|
417
|
+
}),
|
418
|
+
textColor: "success600",
|
419
|
+
fontWeight: "bold"
|
420
|
+
};
|
421
|
+
}
|
422
|
+
}
|
423
|
+
};
|
424
|
+
const { icon, text, textColor = "success600", fontWeight = "normal" } = getStatusMessage();
|
299
425
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
300
|
-
|
301
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children:
|
302
|
-
id: "app.utils.ready-to-publish",
|
303
|
-
defaultMessage: "Ready to publish"
|
304
|
-
}) })
|
426
|
+
icon,
|
427
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor, fontWeight, children: text })
|
305
428
|
] });
|
306
429
|
};
|
307
430
|
const BoldChunk = (chunks) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: chunks });
|
@@ -309,7 +432,8 @@ const BulkLocaleActionModal = ({
|
|
309
432
|
headers,
|
310
433
|
rows,
|
311
434
|
localesMetadata,
|
312
|
-
validationErrors = {}
|
435
|
+
validationErrors = {},
|
436
|
+
action
|
313
437
|
}) => {
|
314
438
|
const { formatMessage } = reactIntl.useIntl();
|
315
439
|
const selectedRows = strapiAdmin.useTable(
|
@@ -322,27 +446,29 @@ const BulkLocaleActionModal = ({
|
|
322
446
|
return acc;
|
323
447
|
}, {});
|
324
448
|
const localesWithErrors = Object.keys(validationErrors);
|
325
|
-
const
|
449
|
+
const publishedCount = selectedRows.filter(
|
326
450
|
({ locale }) => currentStatusByLocale[locale] === "published"
|
327
451
|
).length;
|
328
|
-
const
|
452
|
+
const draftCount = selectedRows.filter(
|
329
453
|
({ locale }) => (currentStatusByLocale[locale] === "draft" || currentStatusByLocale[locale] === "modified") && !localesWithErrors.includes(locale)
|
330
454
|
).length;
|
331
455
|
const withErrorsCount = localesWithErrors.length;
|
456
|
+
const messageId = action === "bulk-publish" ? "content-manager.containers.list.selectedEntriesModal.selectedCount.publish" : "content-manager.containers.list.selectedEntriesModal.selectedCount.unpublish";
|
457
|
+
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.";
|
332
458
|
return formatMessage(
|
333
459
|
{
|
334
|
-
id:
|
335
|
-
defaultMessage
|
460
|
+
id: messageId,
|
461
|
+
defaultMessage
|
336
462
|
},
|
337
463
|
{
|
338
464
|
withErrorsCount,
|
339
|
-
|
340
|
-
|
465
|
+
draftCount,
|
466
|
+
publishedCount,
|
341
467
|
b: BoldChunk
|
342
468
|
}
|
343
469
|
);
|
344
470
|
};
|
345
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
471
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Body, { children: [
|
346
472
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: getFormattedCountMessage() }),
|
347
473
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 5, children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Content, { children: [
|
348
474
|
/* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Head, { children: [
|
@@ -363,13 +489,12 @@ const BulkLocaleActionModal = ({
|
|
363
489
|
paddingRight: "6px",
|
364
490
|
paddingTop: "2px",
|
365
491
|
paddingBottom: "2px",
|
366
|
-
showBullet: false,
|
367
492
|
size: "S",
|
368
493
|
variant: statusVariant,
|
369
494
|
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
370
495
|
}
|
371
496
|
) }) }),
|
372
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(EntryValidationText, { validationErrors: error, status }) }),
|
497
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(EntryValidationText, { validationErrors: error, status, action }) }),
|
373
498
|
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
374
499
|
designSystem.IconButton,
|
375
500
|
{
|
@@ -386,7 +511,7 @@ const BulkLocaleActionModal = ({
|
|
386
511
|
name: locale
|
387
512
|
}
|
388
513
|
),
|
389
|
-
|
514
|
+
variant: "ghost",
|
390
515
|
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Pencil, {})
|
391
516
|
}
|
392
517
|
) })
|
@@ -395,6 +520,47 @@ const BulkLocaleActionModal = ({
|
|
395
520
|
] }) })
|
396
521
|
] });
|
397
522
|
};
|
523
|
+
const statusVariants = {
|
524
|
+
draft: "secondary",
|
525
|
+
published: "success",
|
526
|
+
modified: "alternative"
|
527
|
+
};
|
528
|
+
const LocaleOption = ({
|
529
|
+
isDraftAndPublishEnabled,
|
530
|
+
locale,
|
531
|
+
status,
|
532
|
+
entryExists
|
533
|
+
}) => {
|
534
|
+
const { formatMessage } = reactIntl.useIntl();
|
535
|
+
if (!entryExists) {
|
536
|
+
return formatMessage(
|
537
|
+
{
|
538
|
+
id: getTranslation("CMEditViewLocalePicker.locale.create"),
|
539
|
+
defaultMessage: "Create <bold>{locale}</bold> locale"
|
540
|
+
},
|
541
|
+
{
|
542
|
+
bold: (locale2) => /* @__PURE__ */ jsxRuntime.jsx("b", { children: locale2 }),
|
543
|
+
locale: locale.name
|
544
|
+
}
|
545
|
+
);
|
546
|
+
}
|
547
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", gap: 1, justifyContent: "space-between", children: [
|
548
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: locale.name }),
|
549
|
+
isDraftAndPublishEnabled ? /* @__PURE__ */ jsxRuntime.jsx(
|
550
|
+
designSystem.Status,
|
551
|
+
{
|
552
|
+
display: "flex",
|
553
|
+
paddingLeft: "6px",
|
554
|
+
paddingRight: "6px",
|
555
|
+
paddingTop: "2px",
|
556
|
+
paddingBottom: "2px",
|
557
|
+
size: "S",
|
558
|
+
variant: statusVariants[status],
|
559
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
560
|
+
}
|
561
|
+
) : null
|
562
|
+
] });
|
563
|
+
};
|
398
564
|
const LocalePickerAction = ({
|
399
565
|
document,
|
400
566
|
meta,
|
@@ -403,74 +569,77 @@ const LocalePickerAction = ({
|
|
403
569
|
documentId
|
404
570
|
}) => {
|
405
571
|
const { formatMessage } = reactIntl.useIntl();
|
406
|
-
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
572
|
+
const [{ query: query2 }, setQuery] = strapiAdmin.useQueryParams();
|
407
573
|
const { hasI18n, canCreate, canRead } = useI18n();
|
408
574
|
const { data: locales = [] } = useGetLocalesQuery();
|
409
|
-
const
|
575
|
+
const currentDesiredLocale = query2.plugins?.i18n?.locale;
|
576
|
+
const { schema } = strapiAdmin$1.unstable_useDocument({
|
577
|
+
model,
|
578
|
+
collectionType,
|
579
|
+
documentId,
|
580
|
+
params: { locale: currentDesiredLocale }
|
581
|
+
});
|
410
582
|
const handleSelect = React__namespace.useCallback(
|
411
583
|
(value) => {
|
412
584
|
setQuery({
|
413
585
|
plugins: {
|
414
|
-
...
|
586
|
+
...query2.plugins,
|
415
587
|
i18n: {
|
416
588
|
locale: value
|
417
589
|
}
|
418
590
|
}
|
419
591
|
});
|
420
592
|
},
|
421
|
-
[
|
593
|
+
[query2.plugins, setQuery]
|
422
594
|
);
|
423
595
|
React__namespace.useEffect(() => {
|
424
596
|
if (!Array.isArray(locales) || !hasI18n) {
|
425
597
|
return;
|
426
598
|
}
|
427
|
-
const currentDesiredLocale = query.plugins?.i18n?.locale;
|
428
599
|
const doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);
|
429
600
|
const defaultLocale = locales.find((locale) => locale.isDefault);
|
430
601
|
if (!doesLocaleExist && defaultLocale?.code) {
|
431
602
|
handleSelect(defaultLocale.code);
|
432
603
|
}
|
433
|
-
}, [handleSelect, hasI18n, locales,
|
604
|
+
}, [handleSelect, hasI18n, locales, currentDesiredLocale]);
|
605
|
+
const currentLocale = Array.isArray(locales) ? locales.find((locale) => locale.code === currentDesiredLocale) : void 0;
|
606
|
+
const allCurrentLocales = [
|
607
|
+
{ status: getDocumentStatus(document, meta), locale: currentLocale?.code },
|
608
|
+
...document?.localizations ?? []
|
609
|
+
];
|
434
610
|
if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {
|
435
611
|
return null;
|
436
612
|
}
|
437
|
-
const
|
438
|
-
|
439
|
-
|
440
|
-
...meta?.availableLocales ?? []
|
441
|
-
];
|
613
|
+
const displayedLocales = locales.filter((locale) => {
|
614
|
+
return canRead.includes(locale.code);
|
615
|
+
});
|
442
616
|
return {
|
443
617
|
label: formatMessage({
|
444
618
|
id: getTranslation("Settings.locales.modal.locales.label"),
|
445
619
|
defaultMessage: "Locales"
|
446
620
|
}),
|
447
|
-
options:
|
621
|
+
options: displayedLocales.map((locale) => {
|
622
|
+
const entryWithLocaleExists = allCurrentLocales.some((doc) => doc.locale === locale.code);
|
448
623
|
const currentLocaleDoc = allCurrentLocales.find(
|
449
624
|
(doc) => "locale" in doc ? doc.locale === locale.code : false
|
450
625
|
);
|
451
|
-
const
|
452
|
-
const permissionsToCheck = currentLocaleDoc ? canCreate : canRead;
|
453
|
-
const statusVariant = status === "draft" ? "primary" : status === "published" ? "success" : "alternative";
|
626
|
+
const permissionsToCheck = currentLocaleDoc ? canRead : canCreate;
|
454
627
|
return {
|
455
628
|
disabled: !permissionsToCheck.includes(locale.code),
|
456
629
|
value: locale.code,
|
457
|
-
label:
|
458
|
-
|
459
|
-
designSystem.Status,
|
630
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(
|
631
|
+
LocaleOption,
|
460
632
|
{
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
paddingBottom: "2px",
|
466
|
-
showBullet: false,
|
467
|
-
size: "S",
|
468
|
-
variant: statusVariant,
|
469
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
633
|
+
isDraftAndPublishEnabled: !!schema?.options?.draftAndPublish,
|
634
|
+
locale,
|
635
|
+
status: currentLocaleDoc?.status,
|
636
|
+
entryExists: entryWithLocaleExists
|
470
637
|
}
|
471
|
-
)
|
638
|
+
),
|
639
|
+
startIcon: !entryWithLocaleExists ? /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}) : null
|
472
640
|
};
|
473
641
|
}),
|
642
|
+
customizeContent: () => currentLocale?.name,
|
474
643
|
onSelect: handleSelect,
|
475
644
|
value: currentLocale
|
476
645
|
};
|
@@ -486,6 +655,99 @@ const getDocumentStatus = (document, meta) => {
|
|
486
655
|
}
|
487
656
|
return docStatus;
|
488
657
|
};
|
658
|
+
const FillFromAnotherLocaleAction = ({
|
659
|
+
documentId,
|
660
|
+
meta,
|
661
|
+
model,
|
662
|
+
collectionType
|
663
|
+
}) => {
|
664
|
+
const { formatMessage } = reactIntl.useIntl();
|
665
|
+
const [{ query: query2 }] = strapiAdmin.useQueryParams();
|
666
|
+
const { hasI18n } = useI18n();
|
667
|
+
const currentDesiredLocale = query2.plugins?.i18n?.locale;
|
668
|
+
const [localeSelected, setLocaleSelected] = React__namespace.useState(null);
|
669
|
+
const setValues = strapiAdmin.useForm("FillFromAnotherLocale", (state) => state.setValues);
|
670
|
+
const { getDocument } = strapiAdmin$1.unstable_useDocumentActions();
|
671
|
+
const { schema, components } = strapiAdmin$1.unstable_useDocument({
|
672
|
+
model,
|
673
|
+
documentId,
|
674
|
+
collectionType,
|
675
|
+
params: { locale: currentDesiredLocale }
|
676
|
+
});
|
677
|
+
const { data: locales = [] } = useGetLocalesQuery();
|
678
|
+
const availableLocales = Array.isArray(locales) ? locales.filter((locale) => meta?.availableLocales.some((l) => l.locale === locale.code)) : [];
|
679
|
+
const fillFromLocale = (onClose) => async () => {
|
680
|
+
const response = await getDocument({
|
681
|
+
collectionType,
|
682
|
+
model,
|
683
|
+
documentId,
|
684
|
+
params: { locale: localeSelected }
|
685
|
+
});
|
686
|
+
if (!response || !schema) {
|
687
|
+
return;
|
688
|
+
}
|
689
|
+
const { data } = response;
|
690
|
+
const cleanedData = cleanData(data, schema, components);
|
691
|
+
setValues(cleanedData);
|
692
|
+
onClose();
|
693
|
+
};
|
694
|
+
if (!hasI18n) {
|
695
|
+
return null;
|
696
|
+
}
|
697
|
+
return {
|
698
|
+
type: "icon",
|
699
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}),
|
700
|
+
disabled: availableLocales.length === 0,
|
701
|
+
label: formatMessage({
|
702
|
+
id: getTranslation("CMEditViewCopyLocale.copy-text"),
|
703
|
+
defaultMessage: "Fill in from another locale"
|
704
|
+
}),
|
705
|
+
dialog: {
|
706
|
+
type: "dialog",
|
707
|
+
title: formatMessage({
|
708
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.title"),
|
709
|
+
defaultMessage: "Confirmation"
|
710
|
+
}),
|
711
|
+
content: ({ onClose }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
712
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 3, children: [
|
713
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.WarningCircle, { width: "24px", height: "24px", fill: "danger600" }),
|
714
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", children: formatMessage({
|
715
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.body"),
|
716
|
+
defaultMessage: "Your current content will be erased and filled by the content of the selected locale:"
|
717
|
+
}) }),
|
718
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { width: "100%", children: [
|
719
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
720
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.field.label"),
|
721
|
+
defaultMessage: "Locale"
|
722
|
+
}) }),
|
723
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
724
|
+
designSystem.SingleSelect,
|
725
|
+
{
|
726
|
+
value: localeSelected,
|
727
|
+
placeholder: formatMessage({
|
728
|
+
id: getTranslation("CMEditViewCopyLocale.dialog.field.placeholder"),
|
729
|
+
defaultMessage: "Select one locale..."
|
730
|
+
}),
|
731
|
+
onChange: (value) => setLocaleSelected(value),
|
732
|
+
children: availableLocales.map((locale) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: locale.code, children: locale.name }, locale.code))
|
733
|
+
}
|
734
|
+
)
|
735
|
+
] })
|
736
|
+
] }) }),
|
737
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, width: "100%", children: [
|
738
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { flex: "auto", variant: "tertiary", onClick: onClose, children: formatMessage({
|
739
|
+
id: getTranslation("CMEditViewCopyLocale.cancel-text"),
|
740
|
+
defaultMessage: "No, cancel"
|
741
|
+
}) }),
|
742
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { flex: "auto", variant: "success", onClick: fillFromLocale(onClose), children: formatMessage({
|
743
|
+
id: getTranslation("CMEditViewCopyLocale.submit-text"),
|
744
|
+
defaultMessage: "Yes, fill in"
|
745
|
+
}) })
|
746
|
+
] }) })
|
747
|
+
] })
|
748
|
+
}
|
749
|
+
};
|
750
|
+
};
|
489
751
|
const DeleteLocaleAction = ({
|
490
752
|
document,
|
491
753
|
documentId,
|
@@ -497,16 +759,23 @@ const DeleteLocaleAction = ({
|
|
497
759
|
const { toggleNotification } = strapiAdmin.useNotification();
|
498
760
|
const { delete: deleteAction } = strapiAdmin$1.unstable_useDocumentActions();
|
499
761
|
const { hasI18n, canDelete } = useI18n();
|
762
|
+
const [{ query: query2 }] = strapiAdmin.useQueryParams();
|
763
|
+
const { data: locales = [] } = useGetLocalesQuery();
|
764
|
+
const currentDesiredLocale = query2.plugins?.i18n?.locale;
|
765
|
+
const locale = !("error" in locales) && locales.find((loc) => loc.code === currentDesiredLocale);
|
500
766
|
if (!hasI18n) {
|
501
767
|
return null;
|
502
768
|
}
|
503
769
|
return {
|
504
770
|
disabled: document?.locale && !canDelete.includes(document.locale) || !document || !document.id,
|
505
771
|
position: ["header", "table-row"],
|
506
|
-
label: formatMessage(
|
507
|
-
|
508
|
-
|
509
|
-
|
772
|
+
label: formatMessage(
|
773
|
+
{
|
774
|
+
id: getTranslation("actions.delete.label"),
|
775
|
+
defaultMessage: "Delete entry ({locale})"
|
776
|
+
},
|
777
|
+
{ locale: locale && locale.name }
|
778
|
+
),
|
510
779
|
icon: /* @__PURE__ */ jsxRuntime.jsx(StyledTrash, {}),
|
511
780
|
variant: "danger",
|
512
781
|
dialog: {
|
@@ -523,7 +792,12 @@ const DeleteLocaleAction = ({
|
|
523
792
|
}) })
|
524
793
|
] }),
|
525
794
|
onConfirm: async () => {
|
526
|
-
|
795
|
+
const unableToDelete = (
|
796
|
+
// We are unable to delete a collection type without a document ID
|
797
|
+
// & unable to delete generally if there is no document locale
|
798
|
+
collectionType !== "single-types" && !documentId || !document?.locale
|
799
|
+
);
|
800
|
+
if (unableToDelete) {
|
527
801
|
console.error(
|
528
802
|
"You're trying to delete a document without an id or locale, this is likely a bug with Strapi. Please open an issue."
|
529
803
|
);
|
@@ -549,37 +823,39 @@ const DeleteLocaleAction = ({
|
|
549
823
|
}
|
550
824
|
};
|
551
825
|
};
|
552
|
-
const
|
553
|
-
document
|
826
|
+
const BulkLocaleAction = ({
|
827
|
+
document,
|
554
828
|
documentId,
|
555
829
|
model,
|
556
|
-
collectionType
|
830
|
+
collectionType,
|
831
|
+
action
|
557
832
|
}) => {
|
558
|
-
const
|
559
|
-
const [{ query }] = strapiAdmin.useQueryParams();
|
560
|
-
const params = React__namespace.useMemo(() => strapiAdmin$1.buildValidParams(query), [query]);
|
561
|
-
const
|
833
|
+
const locale = document?.locale ?? null;
|
834
|
+
const [{ query: query$1 }] = strapiAdmin.useQueryParams();
|
835
|
+
const params = React__namespace.useMemo(() => strapiAdmin$1.buildValidParams(query$1), [query$1]);
|
836
|
+
const isOnPublishedTab = query$1.status === "published";
|
562
837
|
const { formatMessage } = reactIntl.useIntl();
|
563
838
|
const { hasI18n, canPublish } = useI18n();
|
564
839
|
const { toggleNotification } = strapiAdmin.useNotification();
|
565
840
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
566
841
|
const [selectedRows, setSelectedRows] = React__namespace.useState([]);
|
567
|
-
const [
|
568
|
-
const { publishMany: publishManyAction } = strapiAdmin$1.unstable_useDocumentActions();
|
569
|
-
const {
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
842
|
+
const [isDraftRelationConfirmationOpen, setIsDraftRelationConfirmationOpen] = React__namespace.useState(false);
|
843
|
+
const { publishMany: publishManyAction, unpublishMany: unpublishManyAction } = strapiAdmin$1.unstable_useDocumentActions();
|
844
|
+
const { schema, validate } = strapiAdmin$1.unstable_useDocument(
|
845
|
+
{
|
846
|
+
model,
|
847
|
+
collectionType,
|
848
|
+
documentId,
|
849
|
+
params: {
|
850
|
+
locale
|
851
|
+
}
|
852
|
+
},
|
853
|
+
{
|
854
|
+
// No need to fetch the document, the data is already available in the `document` prop
|
855
|
+
skip: true
|
580
856
|
}
|
581
|
-
|
582
|
-
const { data: localesMetadata = [] } = useGetLocalesQuery();
|
857
|
+
);
|
858
|
+
const { data: localesMetadata = [] } = useGetLocalesQuery(hasI18n ? void 0 : query.skipToken);
|
583
859
|
const headers = [
|
584
860
|
{
|
585
861
|
label: formatMessage({
|
@@ -604,18 +880,19 @@ const BulkLocalePublishAction = ({
|
|
604
880
|
}
|
605
881
|
];
|
606
882
|
const [rows, validationErrors] = React__namespace.useMemo(() => {
|
607
|
-
if (!document
|
883
|
+
if (!document) {
|
608
884
|
return [[], {}];
|
609
885
|
}
|
610
|
-
const
|
611
|
-
|
612
|
-
|
886
|
+
const localizations = document.localizations ?? [];
|
887
|
+
const locales = localizations.map((doc) => {
|
888
|
+
const { locale: locale2, status } = doc;
|
889
|
+
return { locale: locale2, status };
|
613
890
|
});
|
614
|
-
|
891
|
+
locales.unshift({
|
615
892
|
locale: document.locale,
|
616
893
|
status: document.status
|
617
894
|
});
|
618
|
-
const allDocuments = [document, ...
|
895
|
+
const allDocuments = [document, ...localizations];
|
619
896
|
const errors = allDocuments.reduce((errs, document2) => {
|
620
897
|
if (!document2) {
|
621
898
|
return errs;
|
@@ -626,14 +903,21 @@ const BulkLocalePublishAction = ({
|
|
626
903
|
}
|
627
904
|
return errs;
|
628
905
|
}, {});
|
629
|
-
return [
|
630
|
-
}, [document,
|
631
|
-
const
|
632
|
-
|
906
|
+
return [locales, errors];
|
907
|
+
}, [document, validate]);
|
908
|
+
const isBulkPublish = action === "bulk-publish";
|
909
|
+
const localesForAction = selectedRows.reduce((acc, selectedRow) => {
|
910
|
+
const isValidLocale = (
|
911
|
+
// Validation errors are irrelevant if we are trying to unpublish
|
912
|
+
!isBulkPublish || !Object.keys(validationErrors).includes(selectedRow.locale)
|
913
|
+
);
|
914
|
+
const shouldAddLocale = isBulkPublish ? selectedRow.status !== "published" && isValidLocale : selectedRow.status !== "draft" && isValidLocale;
|
915
|
+
if (shouldAddLocale) {
|
633
916
|
acc.push(selectedRow.locale);
|
634
917
|
}
|
635
918
|
return acc;
|
636
919
|
}, []);
|
920
|
+
const enableDraftRelationsCount = false;
|
637
921
|
const {
|
638
922
|
data: draftRelationsCount = 0,
|
639
923
|
isLoading: isDraftRelationsLoading,
|
@@ -642,10 +926,10 @@ const BulkLocalePublishAction = ({
|
|
642
926
|
{
|
643
927
|
model,
|
644
928
|
documentIds: [documentId],
|
645
|
-
locale:
|
929
|
+
locale: localesForAction
|
646
930
|
},
|
647
931
|
{
|
648
|
-
skip: !
|
932
|
+
skip: !enableDraftRelationsCount
|
649
933
|
}
|
650
934
|
);
|
651
935
|
React__namespace.useEffect(() => {
|
@@ -671,23 +955,32 @@ const BulkLocalePublishAction = ({
|
|
671
955
|
documentIds: [documentId],
|
672
956
|
params: {
|
673
957
|
...params,
|
674
|
-
locale:
|
958
|
+
locale: localesForAction
|
959
|
+
}
|
960
|
+
});
|
961
|
+
setSelectedRows([]);
|
962
|
+
};
|
963
|
+
const unpublish = async () => {
|
964
|
+
await unpublishManyAction({
|
965
|
+
model,
|
966
|
+
documentIds: [documentId],
|
967
|
+
params: {
|
968
|
+
...params,
|
969
|
+
locale: localesForAction
|
675
970
|
}
|
676
971
|
});
|
677
972
|
setSelectedRows([]);
|
678
973
|
};
|
679
974
|
const handleAction = async () => {
|
680
975
|
if (draftRelationsCount > 0) {
|
681
|
-
|
682
|
-
} else {
|
976
|
+
setIsDraftRelationConfirmationOpen(true);
|
977
|
+
} else if (isBulkPublish) {
|
683
978
|
await publish();
|
979
|
+
} else {
|
980
|
+
await unpublish();
|
684
981
|
}
|
685
982
|
};
|
686
|
-
|
687
|
-
if (isUnpublish) {
|
688
|
-
console.warn(["I18N"], "Bulk locale unpublish modal not implemented");
|
689
|
-
}
|
690
|
-
if (isConfirmationOpen) {
|
983
|
+
if (isDraftRelationConfirmationOpen) {
|
691
984
|
return {
|
692
985
|
label: formatMessage({
|
693
986
|
id: "app.components.ConfirmDialog.title",
|
@@ -696,11 +989,11 @@ const BulkLocalePublishAction = ({
|
|
696
989
|
variant: "danger",
|
697
990
|
dialog: {
|
698
991
|
onCancel: () => {
|
699
|
-
|
992
|
+
setIsDraftRelationConfirmationOpen(false);
|
700
993
|
},
|
701
994
|
onConfirm: async () => {
|
702
995
|
await publish();
|
703
|
-
|
996
|
+
setIsDraftRelationConfirmationOpen(false);
|
704
997
|
},
|
705
998
|
type: "dialog",
|
706
999
|
title: formatMessage({
|
@@ -710,27 +1003,32 @@ const BulkLocalePublishAction = ({
|
|
710
1003
|
content: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "center", gap: 2, children: [
|
711
1004
|
/* @__PURE__ */ jsxRuntime.jsx(icons.WarningCircle, { width: "2.4rem", height: "2.4rem", fill: "danger600" }),
|
712
1005
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", children: formatMessage({
|
713
|
-
id: "
|
714
|
-
defaultMessage: "
|
1006
|
+
id: getTranslation("CMEditViewBulkLocale.draft-relation-warning"),
|
1007
|
+
defaultMessage: "Some locales are related to draft entries. Publishing them could leave broken links in your app."
|
1008
|
+
}) }),
|
1009
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", children: formatMessage({
|
1010
|
+
id: getTranslation("CMEditViewBulkLocale.continue-confirmation"),
|
1011
|
+
defaultMessage: "Are you sure you want to continue?"
|
715
1012
|
}) })
|
716
1013
|
] })
|
717
1014
|
}
|
718
1015
|
};
|
719
1016
|
}
|
1017
|
+
const hasPermission = selectedRows.map(({ locale: locale2 }) => locale2).every((locale2) => canPublish.includes(locale2));
|
720
1018
|
return {
|
721
1019
|
label: formatMessage({
|
722
|
-
id: getTranslation("
|
723
|
-
defaultMessage: "Publish Multiple Locales
|
1020
|
+
id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? "publish" : "unpublish"}-title`),
|
1021
|
+
defaultMessage: `${isBulkPublish ? "Publish" : "Unpublish"} Multiple Locales`
|
724
1022
|
}),
|
725
|
-
|
726
|
-
|
1023
|
+
variant: isBulkPublish ? "secondary" : "danger",
|
1024
|
+
icon: isBulkPublish ? /* @__PURE__ */ jsxRuntime.jsx(icons.ListPlus, {}) : /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}),
|
1025
|
+
disabled: isOnPublishedTab || canPublish.length === 0,
|
727
1026
|
position: ["panel"],
|
728
|
-
variant: "secondary",
|
729
1027
|
dialog: {
|
730
1028
|
type: "modal",
|
731
1029
|
title: formatMessage({
|
732
|
-
id: getTranslation("
|
733
|
-
defaultMessage: "Publish Multiple Locales
|
1030
|
+
id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? "publish" : "unpublish"}-title`),
|
1031
|
+
defaultMessage: `${isBulkPublish ? "Publish" : "Unpublish"} Multiple Locales`
|
734
1032
|
}),
|
735
1033
|
content: () => {
|
736
1034
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
@@ -749,28 +1047,35 @@ const BulkLocalePublishAction = ({
|
|
749
1047
|
validationErrors,
|
750
1048
|
headers,
|
751
1049
|
rows,
|
752
|
-
localesMetadata
|
1050
|
+
localesMetadata,
|
1051
|
+
action: action ?? "bulk-publish"
|
753
1052
|
}
|
754
1053
|
)
|
755
1054
|
}
|
756
1055
|
);
|
757
1056
|
},
|
758
|
-
footer: () => /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
1057
|
+
footer: () => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Footer, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
759
1058
|
designSystem.Button,
|
760
1059
|
{
|
761
1060
|
loading: isDraftRelationsLoading,
|
762
|
-
disabled:
|
1061
|
+
disabled: !hasPermission || localesForAction.length === 0,
|
763
1062
|
variant: "default",
|
764
1063
|
onClick: handleAction,
|
765
1064
|
children: formatMessage({
|
766
|
-
id: "app.utils.publish",
|
767
|
-
defaultMessage: "Publish"
|
1065
|
+
id: isBulkPublish ? "app.utils.publish" : "app.utils.unpublish",
|
1066
|
+
defaultMessage: isBulkPublish ? "Publish" : "Unpublish"
|
768
1067
|
})
|
769
1068
|
}
|
770
1069
|
) })
|
771
1070
|
}
|
772
1071
|
};
|
773
1072
|
};
|
1073
|
+
const BulkLocalePublishAction = (props) => {
|
1074
|
+
return BulkLocaleAction({ action: "bulk-publish", ...props });
|
1075
|
+
};
|
1076
|
+
const BulkLocaleUnpublishAction = (props) => {
|
1077
|
+
return BulkLocaleAction({ action: "bulk-unpublish", ...props });
|
1078
|
+
};
|
774
1079
|
const StyledTrash = styledComponents.styled(icons.Trash)`
|
775
1080
|
path {
|
776
1081
|
fill: currentColor;
|
@@ -827,16 +1132,9 @@ const UnpublishModalAdditionalInfo = () => {
|
|
827
1132
|
}
|
828
1133
|
) });
|
829
1134
|
};
|
830
|
-
const Initializer = ({ setPlugin }) => {
|
831
|
-
const setPluginRef = React__namespace.useRef(setPlugin);
|
832
|
-
React__namespace.useEffect(() => {
|
833
|
-
setPluginRef.current(pluginId);
|
834
|
-
}, []);
|
835
|
-
return null;
|
836
|
-
};
|
837
1135
|
const LocalePicker = () => {
|
838
1136
|
const { formatMessage } = reactIntl.useIntl();
|
839
|
-
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
1137
|
+
const [{ query: query2 }, setQuery] = strapiAdmin.useQueryParams();
|
840
1138
|
const { hasI18n, canRead, canCreate } = useI18n();
|
841
1139
|
const { data: locales = [] } = useGetLocalesQuery(void 0, {
|
842
1140
|
skip: !hasI18n
|
@@ -846,25 +1144,25 @@ const LocalePicker = () => {
|
|
846
1144
|
setQuery(
|
847
1145
|
{
|
848
1146
|
page: 1,
|
849
|
-
plugins: { ...
|
1147
|
+
plugins: { ...query2.plugins, i18n: { locale: code } }
|
850
1148
|
},
|
851
1149
|
"push",
|
852
1150
|
replace
|
853
1151
|
);
|
854
1152
|
},
|
855
|
-
[
|
1153
|
+
[query2.plugins, setQuery]
|
856
1154
|
);
|
857
1155
|
React__namespace.useEffect(() => {
|
858
1156
|
if (!Array.isArray(locales) || !hasI18n) {
|
859
1157
|
return;
|
860
1158
|
}
|
861
|
-
const currentDesiredLocale =
|
1159
|
+
const currentDesiredLocale = query2.plugins?.i18n?.locale;
|
862
1160
|
const doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);
|
863
1161
|
const defaultLocale = locales.find((locale) => locale.isDefault);
|
864
1162
|
if (!doesLocaleExist && defaultLocale?.code) {
|
865
1163
|
handleChange(defaultLocale.code, true);
|
866
1164
|
}
|
867
|
-
}, [hasI18n, handleChange, locales,
|
1165
|
+
}, [hasI18n, handleChange, locales, query2.plugins?.i18n?.locale]);
|
868
1166
|
if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {
|
869
1167
|
return null;
|
870
1168
|
}
|
@@ -879,7 +1177,7 @@ const LocalePicker = () => {
|
|
879
1177
|
id: getTranslation("actions.select-locale"),
|
880
1178
|
defaultMessage: "Select locale"
|
881
1179
|
}),
|
882
|
-
value:
|
1180
|
+
value: query2.plugins?.i18n?.locale || locales.find((locale) => locale.isDefault)?.code,
|
883
1181
|
onChange: handleChange,
|
884
1182
|
children: displayedLocales.map((locale) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: locale.code, children: locale.name }, locale.id))
|
885
1183
|
}
|
@@ -893,7 +1191,7 @@ const PERMISSIONS = {
|
|
893
1191
|
read: [{ action: "plugin::i18n.locale.read", subject: null }]
|
894
1192
|
};
|
895
1193
|
const mutateEditViewHook = ({ layout }) => {
|
896
|
-
if ("i18n" in layout.options
|
1194
|
+
if (!("i18n" in layout.options) || typeof layout.options.i18n === "object" && layout.options.i18n !== null && "localized" in layout.options.i18n && !layout.options.i18n.localized) {
|
897
1195
|
return { layout };
|
898
1196
|
}
|
899
1197
|
const components = Object.entries(layout.components).reduce(
|
@@ -939,7 +1237,7 @@ const doesFieldHaveI18nPluginOpt = (pluginOpts) => {
|
|
939
1237
|
const LabelAction = ({ title, icon }) => {
|
940
1238
|
const { formatMessage } = reactIntl.useIntl();
|
941
1239
|
return /* @__PURE__ */ jsxRuntime.jsxs(Span, { tag: "span", children: [
|
942
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { tag: "span", children:
|
1240
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { tag: "span", children: formatMessage(title) }),
|
943
1241
|
React__namespace.cloneElement(icon, {
|
944
1242
|
"aria-hidden": true,
|
945
1243
|
focusable: false
|
@@ -959,35 +1257,16 @@ const Span = styledComponents.styled(designSystem.Flex)`
|
|
959
1257
|
}
|
960
1258
|
}
|
961
1259
|
`;
|
962
|
-
const LocaleListCell = ({
|
963
|
-
documentId,
|
964
|
-
locale: currentLocale,
|
965
|
-
collectionType,
|
966
|
-
model
|
967
|
-
}) => {
|
968
|
-
const { meta, isLoading } = strapiAdmin$1.unstable_useDocument({
|
969
|
-
documentId,
|
970
|
-
collectionType,
|
971
|
-
model,
|
972
|
-
params: {
|
973
|
-
locale: currentLocale
|
974
|
-
}
|
975
|
-
});
|
1260
|
+
const LocaleListCell = ({ locale: currentLocale, localizations }) => {
|
976
1261
|
const { locale: language } = reactIntl.useIntl();
|
977
|
-
const [visible, setVisible] = React__namespace.useState(false);
|
978
|
-
const buttonRef = React__namespace.useRef(null);
|
979
1262
|
const { data: locales = [] } = useGetLocalesQuery();
|
980
|
-
const handleTogglePopover = (e) => {
|
981
|
-
e.stopPropagation();
|
982
|
-
setVisible((prev) => !prev);
|
983
|
-
};
|
984
1263
|
const formatter = designSystem.useCollator(language, {
|
985
1264
|
sensitivity: "base"
|
986
1265
|
});
|
987
|
-
if (!Array.isArray(locales) ||
|
1266
|
+
if (!Array.isArray(locales) || !localizations) {
|
988
1267
|
return null;
|
989
1268
|
}
|
990
|
-
const availableLocales =
|
1269
|
+
const availableLocales = localizations.map((loc) => loc.locale);
|
991
1270
|
const localesForDocument = locales.reduce((acc, locale) => {
|
992
1271
|
const createdLocale = [currentLocale, ...availableLocales].find((loc) => {
|
993
1272
|
return loc === locale.code;
|
@@ -1002,64 +1281,14 @@ const LocaleListCell = ({
|
|
1002
1281
|
}
|
1003
1282
|
return locale.name;
|
1004
1283
|
}).toSorted((a, b) => formatter.compare(a, b));
|
1005
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
1006
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
1007
|
-
|
1008
|
-
{
|
1009
|
-
|
1010
|
-
|
1011
|
-
justifyContent: "center",
|
1012
|
-
height: "3.2rem",
|
1013
|
-
width: "3.2rem",
|
1014
|
-
children: [
|
1015
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", ellipsis: true, children: localesForDocument.join(", ") }),
|
1016
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, {}) })
|
1017
|
-
]
|
1018
|
-
}
|
1019
|
-
),
|
1020
|
-
visible && /* @__PURE__ */ jsxRuntime.jsx(
|
1021
|
-
designSystem.Popover,
|
1022
|
-
{
|
1023
|
-
onDismiss: () => setVisible(false),
|
1024
|
-
source: buttonRef,
|
1025
|
-
spacing: 16,
|
1026
|
-
centered: true,
|
1027
|
-
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)) })
|
1028
|
-
}
|
1029
|
-
)
|
1284
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Popover.Root, { children: [
|
1285
|
+
/* @__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: [
|
1286
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", ellipsis: true, marginRight: 2, children: localesForDocument.join(", ") }),
|
1287
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, { width: "1.2rem", height: "1.2rem" }) })
|
1288
|
+
] }) }) }),
|
1289
|
+
/* @__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)) }) })
|
1030
1290
|
] });
|
1031
1291
|
};
|
1032
|
-
const Button = styledComponents.styled.button`
|
1033
|
-
width: 100%;
|
1034
|
-
|
1035
|
-
svg {
|
1036
|
-
> g,
|
1037
|
-
path {
|
1038
|
-
fill: ${({ theme }) => theme.colors.neutral500};
|
1039
|
-
}
|
1040
|
-
}
|
1041
|
-
&:hover {
|
1042
|
-
svg {
|
1043
|
-
> g,
|
1044
|
-
path {
|
1045
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
1046
|
-
}
|
1047
|
-
}
|
1048
|
-
}
|
1049
|
-
&:active {
|
1050
|
-
svg {
|
1051
|
-
> g,
|
1052
|
-
path {
|
1053
|
-
fill: ${({ theme }) => theme.colors.neutral400};
|
1054
|
-
}
|
1055
|
-
}
|
1056
|
-
}
|
1057
|
-
`;
|
1058
|
-
const ActionWrapper = styledComponents.styled(designSystem.Flex)`
|
1059
|
-
svg {
|
1060
|
-
height: 0.4rem;
|
1061
|
-
}
|
1062
|
-
`;
|
1063
1292
|
const addColumnToTableHook = ({ displayedHeaders, layout }) => {
|
1064
1293
|
const { options } = layout;
|
1065
1294
|
const isFieldLocalized = doesPluginOptionsHaveI18nLocalized(options) ? options.i18n.localized : false;
|
@@ -1088,18 +1317,11 @@ const addColumnToTableHook = ({ displayedHeaders, layout }) => {
|
|
1088
1317
|
const addLocaleToReleasesHook = ({ displayedHeaders = [] }) => {
|
1089
1318
|
return {
|
1090
1319
|
displayedHeaders: [
|
1091
|
-
|
1092
|
-
// ...displayedHeaders,
|
1320
|
+
...displayedHeaders,
|
1093
1321
|
{
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
label: {
|
1098
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
1099
|
-
defaultMessage: "locale"
|
1100
|
-
},
|
1101
|
-
searchable: false,
|
1102
|
-
sortable: false
|
1322
|
+
label: {
|
1323
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
1324
|
+
defaultMessage: "locale"
|
1103
1325
|
},
|
1104
1326
|
name: "locale"
|
1105
1327
|
}
|
@@ -1192,9 +1414,6 @@ const localeMiddleware = (ctx) => (next) => (permissions) => {
|
|
1192
1414
|
return next(revisedPermissions);
|
1193
1415
|
};
|
1194
1416
|
const prefixPluginTranslations = (trad, pluginId2) => {
|
1195
|
-
if (!pluginId2) {
|
1196
|
-
throw new TypeError("pluginId can't be empty");
|
1197
|
-
}
|
1198
1417
|
return Object.keys(trad).reduce((acc, current) => {
|
1199
1418
|
acc[`${pluginId2}.${current}`] = trad[current];
|
1200
1419
|
return acc;
|
@@ -1247,8 +1466,6 @@ const index = {
|
|
1247
1466
|
app.addRBACMiddleware([localeMiddleware]);
|
1248
1467
|
app.registerPlugin({
|
1249
1468
|
id: pluginId,
|
1250
|
-
initializer: Initializer,
|
1251
|
-
isReady: false,
|
1252
1469
|
name: pluginId
|
1253
1470
|
});
|
1254
1471
|
},
|
@@ -1266,11 +1483,11 @@ const index = {
|
|
1266
1483
|
},
|
1267
1484
|
id: "internationalization",
|
1268
1485
|
to: "internationalization",
|
1269
|
-
Component: () => Promise.resolve().then(() => require("./SettingsPage-
|
1486
|
+
Component: () => Promise.resolve().then(() => require("./SettingsPage-hyOi94O9.js")).then((mod) => ({ default: mod.ProtectedSettingsPage })),
|
1270
1487
|
permissions: PERMISSIONS.accessMain
|
1271
1488
|
});
|
1272
1489
|
const contentManager = app.getPlugin("content-manager");
|
1273
|
-
contentManager.apis.addDocumentHeaderAction([LocalePickerAction]);
|
1490
|
+
contentManager.apis.addDocumentHeaderAction([LocalePickerAction, FillFromAnotherLocaleAction]);
|
1274
1491
|
contentManager.apis.addDocumentAction((actions) => {
|
1275
1492
|
const indexOfDeleteAction = actions.findIndex((action) => action.type === "delete");
|
1276
1493
|
actions.splice(indexOfDeleteAction, 0, DeleteLocaleAction);
|
@@ -1278,6 +1495,7 @@ const index = {
|
|
1278
1495
|
});
|
1279
1496
|
contentManager.apis.addDocumentAction((actions) => {
|
1280
1497
|
actions.splice(2, 0, BulkLocalePublishAction);
|
1498
|
+
actions.splice(5, 0, BulkLocaleUnpublishAction);
|
1281
1499
|
return actions;
|
1282
1500
|
});
|
1283
1501
|
contentManager.injectComponent("listView", "actions", {
|
@@ -1327,24 +1545,6 @@ const index = {
|
|
1327
1545
|
}
|
1328
1546
|
});
|
1329
1547
|
ctbFormsAPI.extendFields(LOCALIZED_FIELDS, {
|
1330
|
-
validator: (args) => ({
|
1331
|
-
i18n: yup__namespace.object().shape({
|
1332
|
-
localized: yup__namespace.bool().test({
|
1333
|
-
name: "ensure-unique-localization",
|
1334
|
-
message: getTranslation("plugin.schema.i18n.ensure-unique-localization"),
|
1335
|
-
test(value) {
|
1336
|
-
if (value === void 0 || value) {
|
1337
|
-
return true;
|
1338
|
-
}
|
1339
|
-
const unique = get__default.default(args, ["3", "modifiedData", "unique"], null);
|
1340
|
-
if (unique && !value) {
|
1341
|
-
return false;
|
1342
|
-
}
|
1343
|
-
return true;
|
1344
|
-
}
|
1345
|
-
})
|
1346
|
-
})
|
1347
|
-
}),
|
1348
1548
|
form: {
|
1349
1549
|
advanced({ contentTypeSchema, forTarget, type, step }) {
|
1350
1550
|
if (forTarget !== "contentType") {
|
@@ -1383,7 +1583,7 @@ const index = {
|
|
1383
1583
|
async registerTrads({ locales }) {
|
1384
1584
|
const importedTrads = await Promise.all(
|
1385
1585
|
locales.map((locale) => {
|
1386
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-
|
1586
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-BOhNX_-5.js")), "./translations/dk.json": () => Promise.resolve().then(() => require("./dk-cjXm0p3m.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-UlC0jh2t.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-hr9b_HLp.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-BFmBbE0H.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-C40pNQ9b.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-JtWBy-JQ.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-COSWt3Nu.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-BVj1O5ch.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-DIEm_EMC.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-wkBPBkhc.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
1387
1587
|
return {
|
1388
1588
|
data: prefixPluginTranslations(data, pluginId),
|
1389
1589
|
locale
|
@@ -1407,4 +1607,4 @@ exports.useDeleteLocaleMutation = useDeleteLocaleMutation;
|
|
1407
1607
|
exports.useGetDefaultLocalesQuery = useGetDefaultLocalesQuery;
|
1408
1608
|
exports.useGetLocalesQuery = useGetLocalesQuery;
|
1409
1609
|
exports.useUpdateLocaleMutation = useUpdateLocaleMutation;
|
1410
|
-
//# sourceMappingURL=index-
|
1610
|
+
//# sourceMappingURL=index-C8NzsAKp.js.map
|