sanity-plugin-internationalized-array 5.2.4 → 5.3.0
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/README.md +13 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +130 -50
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -126,8 +126,18 @@ languages: async (client, {market = ``}) => {
|
|
|
126
126
|
The "Add translation" buttons can be positioned in one or multiple locations by configuring `buttonLocations`:
|
|
127
127
|
|
|
128
128
|
- `field` (default) Below the internationalized array field
|
|
129
|
-
- `
|
|
129
|
+
- `fieldMenu` One translate icon per field that opens a language menu
|
|
130
130
|
- `document` Above the document fields, these buttons will add a new language item to every internationalized array field that can be found at the **root of the document**. Nested internationalized arrays are not yet supported.
|
|
131
|
+
- `unstable__fieldAction` Inside a Field Action (still accepted in config; currently unstable)
|
|
132
|
+
|
|
133
|
+
All locations are additive, so `field`, `fieldMenu`, and `document` can be used together.
|
|
134
|
+
|
|
135
|
+

|
|
136
|
+
|
|
137
|
+
> [!WARNING]
|
|
138
|
+
> Do not use `unstable__fieldAction` on **this plugin 4.0.4 or later**. It crashes the document editor with `useFormValue must be used within a FormValueProvider` — on Studio 4 and above.
|
|
139
|
+
>
|
|
140
|
+
> The break is this plugin, not a Studio major. **4.0.4** ([#633](https://github.com/sanity-io/plugins/pull/633)) moved the language provider onto `document.components.unstable_layout`, so field actions now run outside `FormValueProvider` and throw. Last working plugin: **4.0.0** (and 3.x). Use `field`, `fieldMenu`, and/or `document` instead.
|
|
131
141
|
|
|
132
142
|
To control the "Add translation" button titles, configure `languageDisplay`. This also affects language field labels.
|
|
133
143
|
|
|
@@ -135,7 +145,7 @@ To control the "Add translation" button titles, configure `languageDisplay`. Thi
|
|
|
135
145
|
- `titleOnly` Shows the language title
|
|
136
146
|
- `titleAndCode` Shows the language title with the code in parentheses
|
|
137
147
|
|
|
138
|
-
The "Add all languages"
|
|
148
|
+
The "Add all languages" / "Add missing languages" control can be hidden with `buttonAddAll`. Under `field` that hides the bar below the per-language buttons. Under `fieldMenu` that hides the bulk item inside the language menu.
|
|
139
149
|
|
|
140
150
|
By default, opening a document reorders internationalized array items to match
|
|
141
151
|
the configured `languages` order. That can create a draft (and a history entry)
|
|
@@ -150,7 +160,7 @@ export default defineConfig({
|
|
|
150
160
|
plugins: [
|
|
151
161
|
internationalizedArray({
|
|
152
162
|
// ...other config
|
|
153
|
-
buttonLocations: ['field', '
|
|
163
|
+
buttonLocations: ['field', 'fieldMenu', 'document'], // default ['field'] — locations are additive
|
|
154
164
|
buttonAddAll: false, // default true
|
|
155
165
|
restoreOrder: false, // default true
|
|
156
166
|
languageDisplay: 'codeOnly', // codeOnly (default) | titleOnly | titleAndCode
|
package/dist/index.d.ts
CHANGED
|
@@ -125,12 +125,19 @@ type PluginConfig = {
|
|
|
125
125
|
*/
|
|
126
126
|
fieldTypes: (string | RuleTypeConstraint | FieldDefinition)[];
|
|
127
127
|
/**
|
|
128
|
-
* Locations where the "+ EN" add language buttons are visible
|
|
128
|
+
* Locations where the "+ EN" add language buttons are visible.
|
|
129
|
+
* `fieldMenu` is one translate icon per field that opens a
|
|
130
|
+
* language menu (compact; stable UI; no field actions). All locations are
|
|
131
|
+
* additive, so `field`, `fieldMenu`, and `document` can be combined.
|
|
132
|
+
* `unstable__fieldAction` is still accepted but crashes the editor from
|
|
133
|
+
* plugin 4.0.4 onward on Studio 4 and above.
|
|
129
134
|
* @defaultValue ['field']
|
|
130
135
|
* */
|
|
131
|
-
buttonLocations?: ('field' | 'unstable__fieldAction' | 'document')[];
|
|
136
|
+
buttonLocations?: ('field' | 'fieldMenu' | 'unstable__fieldAction' | 'document')[];
|
|
132
137
|
/**
|
|
133
|
-
* Show or hide the "Add missing languages"
|
|
138
|
+
* Show or hide the "Add all languages" / "Add missing languages" control.
|
|
139
|
+
* Under `field` this is the bar below the per-language buttons. Under
|
|
140
|
+
* `fieldMenu` it is the bulk item inside the language menu.
|
|
134
141
|
* @defaultValue true
|
|
135
142
|
* */
|
|
136
143
|
buttonAddAll?: boolean;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/cache.ts","../src/constants.ts","../src/plugin.tsx","../src/utils/internationalizedArrayLanguageFilter.ts"],"mappings":";;;KAEY;EACV,IAAI,KAAK;EACT;;KAGU;KAEA;EACV;EACA,MAAM;EACN,WAAW;EACX;EACA;EACA;EACA;EACA,aAAa,OAAO;EACpB;KAAU;IAAuB;OAAW;;;;;;;KAMlC;EACV;;EAEA;EACA;;iBAGc,iCACd,eACC,QAAQ;KAIC,2BAA2B;EACrC;EACA,QAAQ;;EAER;;;;EAIA;;KAGU,oBACV,QAAQ,cACR,eAAe,4BACZ,QAAQ;KAED;KAEA;;;;;EAKV;;;;;;;;;;;;;EAaA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BT,WAAW,aAAa;;;;;;;;;EASxB;;;;;;;;;;;;;;;;;;;;;;;;EAyBA,sBAAsB,qBAAqB
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/cache.ts","../src/constants.ts","../src/plugin.tsx","../src/utils/internationalizedArrayLanguageFilter.ts"],"mappings":";;;KAEY;EACV,IAAI,KAAK;EACT;;KAGU;KAEA;EACV;EACA,MAAM;EACN,WAAW;EACX;EACA;EACA;EACA;EACA,aAAa,OAAO;EACpB;KAAU;IAAuB;OAAW;;;;;;;KAMlC;EACV;;EAEA;EACA;;iBAGc,iCACd,eACC,QAAQ;KAIC,2BAA2B;EACrC;EACA,QAAQ;;EAER;;;;EAIA;;KAGU,oBACV,QAAQ,cACR,eAAe,4BACZ,QAAQ;KAED;KAEA;;;;;EAKV;;;;;;;;;;;;;EAaA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BT,WAAW,aAAa;;;;;;;;;EASxB;;;;;;;;;;;;;;;;;;;;;;;;EAyBA,sBAAsB,qBAAqB;;;;;;;;;;EAU3C;;;;;;;EAOA;;;;;;;;;;;EAWA;;;;;EAKA,kBAAkB;;;;;;;;;;EAUlB,0BAA0B;;;;;;;;;;;;EAY1B;IACE,eAAe,SAAS;IACxB,mBAAmB;;;cCnKV;;;;;;;;;;;;;;;;;;;;;;;;cCJA;cCZA,yCAAsB,OAAA;;;;;cCJtB,uCAAoC,eAChC,kBAAgB,SACtB,cAAc,eAAa,+BACP,aAChB,qCAAmC,WACrC"}
|
package/dist/index.js
CHANGED
|
@@ -7,17 +7,17 @@ import { useToast } from "@sanity/ui/toast";
|
|
|
7
7
|
import { randomKey } from "@sanity/util/content";
|
|
8
8
|
import { useDocumentPane } from "sanity/structure";
|
|
9
9
|
import { AddIcon } from "@sanity/icons/Add";
|
|
10
|
-
import { createContext, createElement, use, useCallback, useContext, useDeferredValue, useEffect } from "react";
|
|
10
|
+
import { createContext, createElement, use, useCallback, useContext, useDeferredValue, useEffect, useId } from "react";
|
|
11
11
|
import get from "lodash-es/get.js";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { TranslateIcon } from "@sanity/icons/Translate";
|
|
14
14
|
import camelCase from "lodash-es/camelCase.js";
|
|
15
15
|
import upperFirst from "lodash-es/upperFirst.js";
|
|
16
16
|
import { EventsContext } from "sanity/_singletons";
|
|
17
|
+
import { Menu, MenuButton, MenuDivider, MenuItem } from "@sanity/ui/menu";
|
|
17
18
|
import { Code } from "@sanity/ui/code";
|
|
18
19
|
import { WarningOutlineIcon } from "@sanity/icons/WarningOutline";
|
|
19
20
|
import { RemoveCircleIcon } from "@sanity/icons/RemoveCircle";
|
|
20
|
-
import { Menu, MenuButton, MenuItem } from "@sanity/ui/menu";
|
|
21
21
|
import { Tooltip } from "@sanity/ui/tooltip";
|
|
22
22
|
const namespace = "sanity-plugin-internationalized-array", functionKeyCache = /* @__PURE__ */ new WeakMap(), promiseCache = /* @__PURE__ */ new Map(), functionCache = /* @__PURE__ */ new Map();
|
|
23
23
|
function stringifyCacheKey(key) {
|
|
@@ -437,7 +437,11 @@ function checkAllLanguagesArePresent(languages, value) {
|
|
|
437
437
|
* or `"Add missing languages"` (plural) depending on how many are left.
|
|
438
438
|
*/
|
|
439
439
|
function createAddAllTitle(value, languages) {
|
|
440
|
-
|
|
440
|
+
if (value?.length) {
|
|
441
|
+
let languagesInUse = new Set(value.map((item) => item[LANGUAGE_FIELD_NAME]));
|
|
442
|
+
return `Add missing ${languages.filter((language) => !languagesInUse.has(language.id)).length === 1 ? "language" : "languages"}`;
|
|
443
|
+
}
|
|
444
|
+
return languages.length === 1 && languages[0] ? `Add ${languages[0].title} Field` : "Add all languages";
|
|
441
445
|
}
|
|
442
446
|
function isInternationalizedArrayItemType(type) {
|
|
443
447
|
return type.startsWith("internationalizedArray") && type.endsWith("Value");
|
|
@@ -577,7 +581,66 @@ const internationalizedArrayLanguageFilter = (enclosingType, _member, selectedLa
|
|
|
577
581
|
return !language || languages.find((l) => l.id === language) ? language ? selectedLanguageIds.includes(language) : !1 : !0;
|
|
578
582
|
}
|
|
579
583
|
return !0;
|
|
580
|
-
}
|
|
584
|
+
};
|
|
585
|
+
/**
|
|
586
|
+
* One translate-icon button that opens a language menu — the `fieldMenu`
|
|
587
|
+
* location. Compact, uses only stable `@sanity/ui`, and stays visible even
|
|
588
|
+
* when every language is already present.
|
|
589
|
+
*/
|
|
590
|
+
function CompactAddButton(props) {
|
|
591
|
+
let $ = c(27), { readOnly, languagesInUse, handleClick, onAddAll, buttonAddAll, addAllTitle, allFilteredLanguagesArePresent } = props, { languageDisplay, filteredLanguages: languages } = useInternationalizedArrayContext(), menuId = useId();
|
|
592
|
+
if (!languages.length) return null;
|
|
593
|
+
let t0;
|
|
594
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = {
|
|
595
|
+
portal: !0,
|
|
596
|
+
placement: "bottom-end"
|
|
597
|
+
}, $[0] = t0) : t0 = $[0];
|
|
598
|
+
let t1;
|
|
599
|
+
$[1] === readOnly ? t1 = $[2] : (t1 = /* @__PURE__ */ jsx(Button, {
|
|
600
|
+
mode: "bleed",
|
|
601
|
+
tone: "default",
|
|
602
|
+
fontSize: 1,
|
|
603
|
+
padding: 2,
|
|
604
|
+
icon: TranslateIcon,
|
|
605
|
+
"aria-label": "Add translation",
|
|
606
|
+
title: "Add translation",
|
|
607
|
+
"data-testid": "add-translation-menu",
|
|
608
|
+
disabled: readOnly
|
|
609
|
+
}), $[1] = readOnly, $[2] = t1);
|
|
610
|
+
let t2;
|
|
611
|
+
if ($[3] !== handleClick || $[4] !== languageDisplay || $[5] !== languages || $[6] !== languagesInUse || $[7] !== readOnly) {
|
|
612
|
+
let t3;
|
|
613
|
+
$[9] !== handleClick || $[10] !== languageDisplay || $[11] !== languagesInUse || $[12] !== readOnly ? (t3 = (language) => /* @__PURE__ */ jsx(MenuItem, {
|
|
614
|
+
text: getLanguageDisplay(languageDisplay, language.title, language.id),
|
|
615
|
+
icon: AddIcon,
|
|
616
|
+
disabled: readOnly || languagesInUse.includes(language.id),
|
|
617
|
+
"data-testid": `field-menu-add-${language.id}`,
|
|
618
|
+
onClick: () => handleClick(language.id)
|
|
619
|
+
}, language.id), $[9] = handleClick, $[10] = languageDisplay, $[11] = languagesInUse, $[12] = readOnly, $[13] = t3) : t3 = $[13], t2 = languages.map(t3), $[3] = handleClick, $[4] = languageDisplay, $[5] = languages, $[6] = languagesInUse, $[7] = readOnly, $[8] = t2;
|
|
620
|
+
} else t2 = $[8];
|
|
621
|
+
let t3;
|
|
622
|
+
$[14] !== addAllTitle || $[15] !== allFilteredLanguagesArePresent || $[16] !== buttonAddAll || $[17] !== onAddAll || $[18] !== readOnly ? (t3 = buttonAddAll ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuDivider, {}), /* @__PURE__ */ jsx(MenuItem, {
|
|
623
|
+
text: addAllTitle,
|
|
624
|
+
icon: TranslateIcon,
|
|
625
|
+
disabled: readOnly || allFilteredLanguagesArePresent,
|
|
626
|
+
"data-testid": "field-menu-add-all",
|
|
627
|
+
onClick: onAddAll
|
|
628
|
+
})] }) : null, $[14] = addAllTitle, $[15] = allFilteredLanguagesArePresent, $[16] = buttonAddAll, $[17] = onAddAll, $[18] = readOnly, $[19] = t3) : t3 = $[19];
|
|
629
|
+
let t4;
|
|
630
|
+
$[20] !== t2 || $[21] !== t3 ? (t4 = /* @__PURE__ */ jsxs(Menu, { children: [t2, t3] }), $[20] = t2, $[21] = t3, $[22] = t4) : t4 = $[22];
|
|
631
|
+
let t5;
|
|
632
|
+
return $[23] !== menuId || $[24] !== t1 || $[25] !== t4 ? (t5 = /* @__PURE__ */ jsx(Flex, {
|
|
633
|
+
justify: "flex-end",
|
|
634
|
+
"data-testid": "field-menu",
|
|
635
|
+
children: /* @__PURE__ */ jsx(MenuButton, {
|
|
636
|
+
id: menuId,
|
|
637
|
+
popover: t0,
|
|
638
|
+
button: t1,
|
|
639
|
+
menu: t4
|
|
640
|
+
})
|
|
641
|
+
}), $[23] = menuId, $[24] = t1, $[25] = t4, $[26] = t5) : t5 = $[26], t5;
|
|
642
|
+
}
|
|
643
|
+
const schemaExample = { languages: [{
|
|
581
644
|
id: "en",
|
|
582
645
|
title: "English"
|
|
583
646
|
}, {
|
|
@@ -718,9 +781,10 @@ function isPristineDocument(events) {
|
|
|
718
781
|
* - **Language filter integration**: When `@sanity/language-filter` is active
|
|
719
782
|
* for the current document type, array members are filtered to only show
|
|
720
783
|
* languages matching the user's selection.
|
|
721
|
-
* - **Adding languages**: Exposes per-language buttons
|
|
722
|
-
* missing languages" button (controlled
|
|
723
|
-
* `buttonLocations`
|
|
784
|
+
* - **Adding languages**: Exposes per-language buttons, an optional compact
|
|
785
|
+
* `fieldMenu`, and an "Add all / Add missing languages" button (controlled
|
|
786
|
+
* by `buttonAddAll` and `buttonLocations`). Dispatches `setIfMissing` +
|
|
787
|
+
* `insert` patches.
|
|
724
788
|
* - **Default languages**: Automatically adds entries for languages listed in
|
|
725
789
|
* `defaultLanguages` when those entries are missing. Seeds brand-new
|
|
726
790
|
* documents once the events store reports they are pristine (no history),
|
|
@@ -740,7 +804,7 @@ function isPristineDocument(events) {
|
|
|
740
804
|
* no entries and the add buttons are not visible.
|
|
741
805
|
*/
|
|
742
806
|
function InternationalizedArray(props) {
|
|
743
|
-
let $ = c(
|
|
807
|
+
let $ = c(122), { members, value: _value, schemaType, onChange, readOnly: documentReadOnly } = props, value = _value, t0;
|
|
744
808
|
$[0] === value ? t0 = $[1] : (t0 = value?.filter(_temp$1) ?? [], $[0] = value, $[1] = t0);
|
|
745
809
|
let itemsNeedingMigration = t0, shouldMigrateArray = itemsNeedingMigration.length > 0, toast = useToast(), getFormValue = useGetFormValue(), { languages, filteredLanguages, defaultLanguages, buttonAddAll, buttonLocations, restoreOrder, languageFilter: builtInLanguageFilter } = useInternationalizedArrayContext(), { selectedLanguageIds, options: languageFilterOptions } = useLanguageFilterStudioContext(), t1;
|
|
746
810
|
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t1 = ["_type"], $[2] = t1) : t1 = $[2];
|
|
@@ -859,44 +923,27 @@ function InternationalizedArray(props) {
|
|
|
859
923
|
readOnly
|
|
860
924
|
], $[61] = allKeysAreLanguages, $[62] = handleRestoreOrder, $[63] = languagesOutOfOrder, $[64] = readOnly, $[65] = restoreOrder, $[66] = t16, $[67] = t17) : (t16 = $[66], t17 = $[67]), useEffect(t16, t17);
|
|
861
925
|
let t18;
|
|
862
|
-
$[68] !==
|
|
863
|
-
|
|
864
|
-
|
|
926
|
+
if ($[68] !== addedLanguages || $[69] !== filteredLanguages) {
|
|
927
|
+
let t19;
|
|
928
|
+
$[71] === addedLanguages ? t19 = $[72] : (t19 = (language_4) => addedLanguages.includes(language_4.id), $[71] = addedLanguages, $[72] = t19), t18 = filteredLanguages.every(t19), $[68] = addedLanguages, $[69] = filteredLanguages, $[70] = t18;
|
|
929
|
+
} else t18 = $[70];
|
|
930
|
+
let allFilteredLanguagesArePresent = t18, t19;
|
|
931
|
+
$[73] !== filteredLanguages || $[74] !== handleAddLanguages ? (t19 = () => {
|
|
865
932
|
handleAddLanguages(filteredLanguages.map(_temp5));
|
|
866
|
-
}, $[
|
|
933
|
+
}, $[73] = filteredLanguages, $[74] = handleAddLanguages, $[75] = t19) : t19 = $[75];
|
|
867
934
|
let addAllMissingLanguages = t19;
|
|
868
935
|
if (!languagesAreValid) {
|
|
869
936
|
let t20;
|
|
870
|
-
return $[
|
|
937
|
+
return $[76] === Symbol.for("react.memo_cache_sentinel") ? (t20 = /* @__PURE__ */ jsx(Feedback, {}), $[76] = t20) : t20 = $[76], t20;
|
|
871
938
|
}
|
|
872
|
-
let t20;
|
|
873
|
-
$[
|
|
874
|
-
let
|
|
875
|
-
$[80] !==
|
|
876
|
-
let
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
...props,
|
|
881
|
-
key: member_0.key,
|
|
882
|
-
member: member_0
|
|
883
|
-
}) : /* @__PURE__ */ jsx(MemberItemError, { member: member_0 }, member_0.key), $[86] = props, $[87] = t23), t22 = filteredMembers.map(t23), $[83] = filteredMembers, $[84] = props, $[85] = t22;
|
|
884
|
-
} else t22 = $[85];
|
|
885
|
-
let t23;
|
|
886
|
-
$[88] === itemsNeedingMigration ? t23 = $[89] : (t23 = /* @__PURE__ */ jsx(MigrationBanner, { itemsNeedingMigration }), $[88] = itemsNeedingMigration, $[89] = t23);
|
|
887
|
-
let t24;
|
|
888
|
-
$[90] !== addButtonsAreVisible || $[91] !== fieldHasMembers ? (t24 = !addButtonsAreVisible && !fieldHasMembers ? /* @__PURE__ */ jsx(Card, {
|
|
889
|
-
border: !0,
|
|
890
|
-
tone: "transparent",
|
|
891
|
-
padding: 3,
|
|
892
|
-
radius: 2,
|
|
893
|
-
children: /* @__PURE__ */ jsx(Text, {
|
|
894
|
-
size: 1,
|
|
895
|
-
children: "This internationalized field currently has no translations."
|
|
896
|
-
})
|
|
897
|
-
}) : null, $[90] = addButtonsAreVisible, $[91] = fieldHasMembers, $[92] = t24) : t24 = $[92];
|
|
898
|
-
let t25;
|
|
899
|
-
$[93] !== addAllMissingLanguages || $[94] !== addAllTitle || $[95] !== addButtonsAreVisible || $[96] !== addedLanguages || $[97] !== allLanguagesArePresent || $[98] !== buttonAddAll || $[99] !== handleAddLanguages || $[100] !== readOnly ? (t25 = addButtonsAreVisible ? /* @__PURE__ */ jsxs(Stack, {
|
|
939
|
+
let canAddLanguages = !shouldMigrateArray && filteredLanguages?.length > 0, t20;
|
|
940
|
+
$[77] !== buttonLocations || $[78] !== canAddLanguages ? (t20 = canAddLanguages && buttonLocations.includes("fieldMenu"), $[77] = buttonLocations, $[78] = canAddLanguages, $[79] = t20) : t20 = $[79];
|
|
941
|
+
let showFieldMenu = t20, t21;
|
|
942
|
+
$[80] !== allFilteredLanguagesArePresent || $[81] !== buttonLocations || $[82] !== canAddLanguages ? (t21 = canAddLanguages && buttonLocations.includes("field") && !allFilteredLanguagesArePresent, $[80] = allFilteredLanguagesArePresent, $[81] = buttonLocations, $[82] = canAddLanguages, $[83] = t21) : t21 = $[83];
|
|
943
|
+
let showFieldButtons = t21, fieldHasMembers = members?.length > 0, t22;
|
|
944
|
+
$[84] !== filteredLanguages || $[85] !== value ? (t22 = createAddAllTitle(value, filteredLanguages), $[84] = filteredLanguages, $[85] = value, $[86] = t22) : t22 = $[86];
|
|
945
|
+
let addAllTitle = t22, t23;
|
|
946
|
+
$[87] !== addAllMissingLanguages || $[88] !== addAllTitle || $[89] !== addedLanguages || $[90] !== allFilteredLanguagesArePresent || $[91] !== buttonAddAll || $[92] !== handleAddLanguages || $[93] !== readOnly || $[94] !== showFieldButtons ? (t23 = showFieldButtons ? /* @__PURE__ */ jsxs(Stack, {
|
|
900
947
|
gap: 2,
|
|
901
948
|
children: [/* @__PURE__ */ jsx(AddButtons, {
|
|
902
949
|
languagesInUse: addedLanguages,
|
|
@@ -906,25 +953,58 @@ function InternationalizedArray(props) {
|
|
|
906
953
|
tone: "primary",
|
|
907
954
|
mode: "ghost",
|
|
908
955
|
"data-testid": "add-all-languages",
|
|
909
|
-
disabled: readOnly ||
|
|
956
|
+
disabled: readOnly || allFilteredLanguagesArePresent,
|
|
910
957
|
icon: AddIcon,
|
|
911
958
|
text: addAllTitle,
|
|
912
959
|
onClick: addAllMissingLanguages
|
|
913
960
|
}) : null]
|
|
914
|
-
}) : null, $[
|
|
961
|
+
}) : null, $[87] = addAllMissingLanguages, $[88] = addAllTitle, $[89] = addedLanguages, $[90] = allFilteredLanguagesArePresent, $[91] = buttonAddAll, $[92] = handleAddLanguages, $[93] = readOnly, $[94] = showFieldButtons, $[95] = t23) : t23 = $[95];
|
|
962
|
+
let fieldButtons = t23, t24;
|
|
963
|
+
$[96] !== addAllMissingLanguages || $[97] !== addAllTitle || $[98] !== addedLanguages || $[99] !== allFilteredLanguagesArePresent || $[100] !== buttonAddAll || $[101] !== handleAddLanguages || $[102] !== readOnly || $[103] !== showFieldMenu ? (t24 = showFieldMenu ? /* @__PURE__ */ jsx(CompactAddButton, {
|
|
964
|
+
languagesInUse: addedLanguages,
|
|
965
|
+
readOnly,
|
|
966
|
+
handleClick: handleAddLanguages,
|
|
967
|
+
onAddAll: addAllMissingLanguages,
|
|
968
|
+
buttonAddAll,
|
|
969
|
+
addAllTitle,
|
|
970
|
+
allFilteredLanguagesArePresent
|
|
971
|
+
}) : null, $[96] = addAllMissingLanguages, $[97] = addAllTitle, $[98] = addedLanguages, $[99] = allFilteredLanguagesArePresent, $[100] = buttonAddAll, $[101] = handleAddLanguages, $[102] = readOnly, $[103] = showFieldMenu, $[104] = t24) : t24 = $[104];
|
|
972
|
+
let t25;
|
|
973
|
+
if ($[105] !== filteredMembers || $[106] !== props) {
|
|
974
|
+
let t26;
|
|
975
|
+
$[108] === props ? t26 = $[109] : (t26 = (member_0) => member_0.kind === "item" ? /* @__PURE__ */ createElement(ArrayOfObjectsItem, {
|
|
976
|
+
...props,
|
|
977
|
+
key: member_0.key,
|
|
978
|
+
member: member_0
|
|
979
|
+
}) : /* @__PURE__ */ jsx(MemberItemError, { member: member_0 }, member_0.key), $[108] = props, $[109] = t26), t25 = filteredMembers.map(t26), $[105] = filteredMembers, $[106] = props, $[107] = t25;
|
|
980
|
+
} else t25 = $[107];
|
|
915
981
|
let t26;
|
|
916
|
-
|
|
982
|
+
$[110] === itemsNeedingMigration ? t26 = $[111] : (t26 = /* @__PURE__ */ jsx(MigrationBanner, { itemsNeedingMigration }), $[110] = itemsNeedingMigration, $[111] = t26);
|
|
983
|
+
let t27;
|
|
984
|
+
$[112] !== fieldHasMembers || $[113] !== showFieldButtons || $[114] !== showFieldMenu ? (t27 = !showFieldMenu && !showFieldButtons && !fieldHasMembers ? /* @__PURE__ */ jsx(Card, {
|
|
985
|
+
border: !0,
|
|
986
|
+
tone: "transparent",
|
|
987
|
+
padding: 3,
|
|
988
|
+
radius: 2,
|
|
989
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
990
|
+
size: 1,
|
|
991
|
+
children: "This internationalized field currently has no translations."
|
|
992
|
+
})
|
|
993
|
+
}) : null, $[112] = fieldHasMembers, $[113] = showFieldButtons, $[114] = showFieldMenu, $[115] = t27) : t27 = $[115];
|
|
994
|
+
let t28;
|
|
995
|
+
return $[116] !== fieldButtons || $[117] !== t24 || $[118] !== t25 || $[119] !== t26 || $[120] !== t27 ? (t28 = /* @__PURE__ */ jsxs(Stack, {
|
|
917
996
|
gap: 2,
|
|
918
997
|
children: [
|
|
919
|
-
t22,
|
|
920
|
-
t23,
|
|
921
998
|
t24,
|
|
922
|
-
t25
|
|
999
|
+
t25,
|
|
1000
|
+
t26,
|
|
1001
|
+
t27,
|
|
1002
|
+
fieldButtons
|
|
923
1003
|
]
|
|
924
|
-
}), $[
|
|
1004
|
+
}), $[116] = fieldButtons, $[117] = t24, $[118] = t25, $[119] = t26, $[120] = t27, $[121] = t28) : t28 = $[121], t28;
|
|
925
1005
|
}
|
|
926
|
-
function _temp5(
|
|
927
|
-
return
|
|
1006
|
+
function _temp5(language_5) {
|
|
1007
|
+
return language_5.id;
|
|
928
1008
|
}
|
|
929
1009
|
function _temp4$1(item) {
|
|
930
1010
|
return item.id && item.title;
|