@firecms/collection_editor 3.4.0-canary.cb27f16 → 3.4.0-canary.ce97da7

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/dist/index.umd.js CHANGED
@@ -17761,6 +17761,270 @@
17761
17761
  widget_group_group: "Group",
17762
17762
  widget_group_array: "Array"
17763
17763
  };
17764
+ function useCollectionEditorPlugin({
17765
+ collectionConfigController,
17766
+ configPermissions,
17767
+ reservedGroups,
17768
+ extraView,
17769
+ getUser,
17770
+ collectionInference,
17771
+ getData,
17772
+ onAnalyticsEvent,
17773
+ includeIntroView = true,
17774
+ pathSuggestions,
17775
+ generateCollection
17776
+ }) {
17777
+ return {
17778
+ key: "collection_editor",
17779
+ loading: collectionConfigController.loading,
17780
+ provider: {
17781
+ Component: ConfigControllerProvider,
17782
+ props: {
17783
+ collectionConfigController,
17784
+ configPermissions,
17785
+ collectionInference,
17786
+ reservedGroups,
17787
+ extraView,
17788
+ getUser,
17789
+ getData,
17790
+ onAnalyticsEvent,
17791
+ pathSuggestions,
17792
+ generateCollection
17793
+ }
17794
+ },
17795
+ homePage: {
17796
+ additionalActions: /* @__PURE__ */ jsxRuntime.jsx(NewCollectionButton, {}),
17797
+ additionalChildrenStart: includeIntroView ? /* @__PURE__ */ jsxRuntime.jsx(IntroWidget, {}) : void 0,
17798
+ CollectionActions: HomePageEditorCollectionAction,
17799
+ AdditionalCards: NewCollectionCard,
17800
+ allowDragAndDrop: true,
17801
+ navigationEntries: collectionConfigController.navigationEntries,
17802
+ onNavigationEntriesUpdate: collectionConfigController.saveNavigationEntries
17803
+ },
17804
+ collectionView: {
17805
+ CollectionActionsStart: EditorCollectionActionStart,
17806
+ CollectionActions: EditorCollectionAction,
17807
+ HeaderAction: CollectionViewHeaderAction,
17808
+ AddColumnComponent: PropertyAddColumnComponent,
17809
+ onColumnsReorder: collectionConfigController.updatePropertiesOrder,
17810
+ onKanbanColumnsReorder: collectionConfigController.updateKanbanColumnsOrder,
17811
+ KanbanSetupComponent: KanbanSetupAction,
17812
+ AddKanbanColumnComponent: AddKanbanColumnAction
17813
+ },
17814
+ form: {
17815
+ ActionsTop: EditorEntityAction
17816
+ },
17817
+ i18n: {
17818
+ // Only English is bundled; the rest load when that language is selected.
17819
+ // Seven languages of strings in every plugin bundle is dead weight for
17820
+ // the six nobody is reading.
17821
+ en: collectionEditorTranslationsEn,
17822
+ es: () => Promise.resolve().then(() => es).then((m) => m.collectionEditorTranslationsEs),
17823
+ de: () => Promise.resolve().then(() => de).then((m_0) => m_0.collectionEditorTranslationsDe),
17824
+ fr: () => Promise.resolve().then(() => fr).then((m_1) => m_1.collectionEditorTranslationsFr),
17825
+ it: () => Promise.resolve().then(() => it).then((m_2) => m_2.collectionEditorTranslationsIt),
17826
+ hi: () => Promise.resolve().then(() => hi).then((m_3) => m_3.collectionEditorTranslationsHi),
17827
+ pt: () => Promise.resolve().then(() => pt).then((m_4) => m_4.collectionEditorTranslationsPt)
17828
+ }
17829
+ };
17830
+ }
17831
+ function IntroWidget() {
17832
+ const $ = reactCompilerRuntime.c(24);
17833
+ const navigation = core.useNavigationController();
17834
+ if (!navigation.topLevelNavigation) {
17835
+ throw Error("Navigation not ready in FireCMSHomePage");
17836
+ }
17837
+ const authController = core.useAuthController();
17838
+ const {
17839
+ t
17840
+ } = core.useTranslation();
17841
+ const collectionEditorController = useCollectionEditorController();
17842
+ let t0;
17843
+ if ($[0] !== authController || $[1] !== collectionEditorController) {
17844
+ t0 = collectionEditorController.configPermissions ? collectionEditorController.configPermissions({
17845
+ user: authController.user
17846
+ }).createCollections : true;
17847
+ $[0] = authController;
17848
+ $[1] = collectionEditorController;
17849
+ $[2] = t0;
17850
+ } else {
17851
+ t0 = $[2];
17852
+ }
17853
+ const canCreateCollections = t0;
17854
+ if (!navigation.initialised || (navigation.collections ?? []).length > 0) {
17855
+ return null;
17856
+ }
17857
+ let t1;
17858
+ if ($[3] !== t) {
17859
+ t1 = t("no_collections_found");
17860
+ $[3] = t;
17861
+ $[4] = t1;
17862
+ } else {
17863
+ t1 = $[4];
17864
+ }
17865
+ let t2;
17866
+ if ($[5] !== t1) {
17867
+ t2 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", className: "uppercase", children: t1 });
17868
+ $[5] = t1;
17869
+ $[6] = t2;
17870
+ } else {
17871
+ t2 = $[6];
17872
+ }
17873
+ let t3;
17874
+ if ($[7] !== t) {
17875
+ t3 = t("start_building_collections");
17876
+ $[7] = t;
17877
+ $[8] = t3;
17878
+ } else {
17879
+ t3 = $[8];
17880
+ }
17881
+ let t4;
17882
+ if ($[9] !== t3) {
17883
+ t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { children: t3 });
17884
+ $[9] = t3;
17885
+ $[10] = t4;
17886
+ } else {
17887
+ t4 = $[10];
17888
+ }
17889
+ let t5;
17890
+ if ($[11] !== canCreateCollections || $[12] !== collectionEditorController || $[13] !== t) {
17891
+ t5 = canCreateCollections && /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { onClick: collectionEditorController && canCreateCollections ? () => collectionEditorController.createCollection({
17892
+ parentCollectionIds: [],
17893
+ redirect: true,
17894
+ sourceClick: "new_collection_card"
17895
+ }) : void 0, children: [
17896
+ /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}),
17897
+ t("create_first_collection")
17898
+ ] });
17899
+ $[11] = canCreateCollections;
17900
+ $[12] = collectionEditorController;
17901
+ $[13] = t;
17902
+ $[14] = t5;
17903
+ } else {
17904
+ t5 = $[14];
17905
+ }
17906
+ let t6;
17907
+ if ($[15] !== t) {
17908
+ t6 = t("define_collections_programmatically");
17909
+ $[15] = t;
17910
+ $[16] = t6;
17911
+ } else {
17912
+ t6 = $[16];
17913
+ }
17914
+ let t7;
17915
+ if ($[17] !== t6) {
17916
+ t7 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { color: "secondary", children: t6 });
17917
+ $[17] = t6;
17918
+ $[18] = t7;
17919
+ } else {
17920
+ t7 = $[18];
17921
+ }
17922
+ let t8;
17923
+ if ($[19] !== t2 || $[20] !== t4 || $[21] !== t5 || $[22] !== t7) {
17924
+ t8 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Paper, { className: "my-4 px-4 py-6 flex flex-col bg-white dark:bg-surface-accent-800 gap-2", children: [
17925
+ t2,
17926
+ t4,
17927
+ t5,
17928
+ t7
17929
+ ] });
17930
+ $[19] = t2;
17931
+ $[20] = t4;
17932
+ $[21] = t5;
17933
+ $[22] = t7;
17934
+ $[23] = t8;
17935
+ } else {
17936
+ t8 = $[23];
17937
+ }
17938
+ return t8;
17939
+ }
17940
+ const mergeCollections = (baseCollections, backendCollections = [], modifyCollection) => {
17941
+ const markAsEditable = (c) => {
17942
+ core.makePropertiesEditable(c.properties);
17943
+ c.subcollections?.forEach(markAsEditable);
17944
+ };
17945
+ backendCollections.forEach(markAsEditable);
17946
+ const result = core.joinCollectionLists(baseCollections, backendCollections, [], modifyCollection);
17947
+ result.sort((a, b) => {
17948
+ const indexA = baseCollections.findIndex((c) => c.id === a.id);
17949
+ const indexB = baseCollections.findIndex((c) => c.id === b.id);
17950
+ if (indexA === -1 && indexB === -1) {
17951
+ return 0;
17952
+ }
17953
+ if (indexA === -1) {
17954
+ return 1;
17955
+ }
17956
+ if (indexB === -1) {
17957
+ return -1;
17958
+ }
17959
+ return indexA - indexB;
17960
+ });
17961
+ return result;
17962
+ };
17963
+ function MissingReferenceWidget(t0) {
17964
+ const $ = reactCompilerRuntime.c(12);
17965
+ const {
17966
+ path: pathProp
17967
+ } = t0;
17968
+ const navigation = core.useNavigationController();
17969
+ const path = getLastSegment(pathProp);
17970
+ let t1;
17971
+ if ($[0] !== navigation || $[1] !== pathProp) {
17972
+ t1 = navigation.getParentCollectionIds(pathProp);
17973
+ $[0] = navigation;
17974
+ $[1] = pathProp;
17975
+ $[2] = t1;
17976
+ } else {
17977
+ t1 = $[2];
17978
+ }
17979
+ const parentCollectionIds = t1;
17980
+ const collectionEditor = useCollectionEditorController();
17981
+ const t2 = "No collection for path: " + path;
17982
+ let t3;
17983
+ if ($[3] !== t2) {
17984
+ t3 = /* @__PURE__ */ jsxRuntime.jsx(core.ErrorView, { error: t2 });
17985
+ $[3] = t2;
17986
+ $[4] = t3;
17987
+ } else {
17988
+ t3 = $[4];
17989
+ }
17990
+ let t4;
17991
+ if ($[5] !== collectionEditor || $[6] !== parentCollectionIds || $[7] !== path) {
17992
+ t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { className: "mx-2", size: "small", onClick: () => {
17993
+ collectionEditor.createCollection({
17994
+ initialValues: {
17995
+ path,
17996
+ name: core.prettifyIdentifier(path)
17997
+ },
17998
+ parentCollectionIds,
17999
+ redirect: false,
18000
+ sourceClick: "missing_reference"
18001
+ });
18002
+ }, children: "Create" });
18003
+ $[5] = collectionEditor;
18004
+ $[6] = parentCollectionIds;
18005
+ $[7] = path;
18006
+ $[8] = t4;
18007
+ } else {
18008
+ t4 = $[8];
18009
+ }
18010
+ let t5;
18011
+ if ($[9] !== t3 || $[10] !== t4) {
18012
+ t5 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-1 flex flex-col items-center", children: [
18013
+ t3,
18014
+ t4
18015
+ ] });
18016
+ $[9] = t3;
18017
+ $[10] = t4;
18018
+ $[11] = t5;
18019
+ } else {
18020
+ t5 = $[11];
18021
+ }
18022
+ return t5;
18023
+ }
18024
+ function getLastSegment(path) {
18025
+ const segments = path.split("/");
18026
+ return segments[segments.length - 1];
18027
+ }
17764
18028
  const collectionEditorTranslationsEs = {
17765
18029
  file_upload_config: "Configuración de subida de archivos",
17766
18030
  file_type_images: "Imágenes",
@@ -17883,6 +18147,10 @@
17883
18147
  widget_group_group: "Grupo",
17884
18148
  widget_group_array: "Lista"
17885
18149
  };
18150
+ const es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18151
+ __proto__: null,
18152
+ collectionEditorTranslationsEs
18153
+ }, Symbol.toStringTag, { value: "Module" }));
17886
18154
  const collectionEditorTranslationsDe = {
17887
18155
  file_upload_config: "Dateiupload-Konfiguration",
17888
18156
  file_type_images: "Bilder",
@@ -18005,6 +18273,10 @@
18005
18273
  widget_group_group: "Gruppe",
18006
18274
  widget_group_array: "Array"
18007
18275
  };
18276
+ const de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18277
+ __proto__: null,
18278
+ collectionEditorTranslationsDe
18279
+ }, Symbol.toStringTag, { value: "Module" }));
18008
18280
  const collectionEditorTranslationsFr = {
18009
18281
  file_upload_config: "Configuration du téléchargement de fichiers",
18010
18282
  file_type_images: "Images",
@@ -18127,6 +18399,10 @@
18127
18399
  widget_group_group: "Groupe",
18128
18400
  widget_group_array: "Liste"
18129
18401
  };
18402
+ const fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18403
+ __proto__: null,
18404
+ collectionEditorTranslationsFr
18405
+ }, Symbol.toStringTag, { value: "Module" }));
18130
18406
  const collectionEditorTranslationsIt = {
18131
18407
  file_upload_config: "Configurazione caricamento file",
18132
18408
  file_type_images: "Immagini",
@@ -18249,6 +18525,10 @@
18249
18525
  widget_group_group: "Gruppo",
18250
18526
  widget_group_array: "Lista"
18251
18527
  };
18528
+ const it = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18529
+ __proto__: null,
18530
+ collectionEditorTranslationsIt
18531
+ }, Symbol.toStringTag, { value: "Module" }));
18252
18532
  const collectionEditorTranslationsHi = {
18253
18533
  file_upload_config: "फ़ाइल अपलोड कॉन्फ़िगरेशन",
18254
18534
  file_type_images: "चित्र",
@@ -18371,6 +18651,10 @@
18371
18651
  widget_group_group: "समूह",
18372
18652
  widget_group_array: "सूची"
18373
18653
  };
18654
+ const hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18655
+ __proto__: null,
18656
+ collectionEditorTranslationsHi
18657
+ }, Symbol.toStringTag, { value: "Module" }));
18374
18658
  const collectionEditorTranslationsPt = {
18375
18659
  file_upload_config: "Configuração de upload de arquivo",
18376
18660
  file_type_images: "Imagens",
@@ -18493,343 +18777,10 @@
18493
18777
  widget_group_group: "Grupo",
18494
18778
  widget_group_array: "Lista"
18495
18779
  };
18496
- function useCollectionEditorPlugin(t0) {
18497
- const $ = reactCompilerRuntime.c(28);
18498
- const {
18499
- collectionConfigController,
18500
- configPermissions,
18501
- reservedGroups,
18502
- extraView,
18503
- getUser,
18504
- collectionInference,
18505
- getData,
18506
- onAnalyticsEvent,
18507
- includeIntroView: t1,
18508
- pathSuggestions,
18509
- generateCollection
18510
- } = t0;
18511
- const includeIntroView = t1 === void 0 ? true : t1;
18512
- let t2;
18513
- if ($[0] !== collectionConfigController || $[1] !== collectionInference || $[2] !== configPermissions || $[3] !== extraView || $[4] !== generateCollection || $[5] !== getData || $[6] !== getUser || $[7] !== onAnalyticsEvent || $[8] !== pathSuggestions || $[9] !== reservedGroups) {
18514
- t2 = {
18515
- Component: ConfigControllerProvider,
18516
- props: {
18517
- collectionConfigController,
18518
- configPermissions,
18519
- collectionInference,
18520
- reservedGroups,
18521
- extraView,
18522
- getUser,
18523
- getData,
18524
- onAnalyticsEvent,
18525
- pathSuggestions,
18526
- generateCollection
18527
- }
18528
- };
18529
- $[0] = collectionConfigController;
18530
- $[1] = collectionInference;
18531
- $[2] = configPermissions;
18532
- $[3] = extraView;
18533
- $[4] = generateCollection;
18534
- $[5] = getData;
18535
- $[6] = getUser;
18536
- $[7] = onAnalyticsEvent;
18537
- $[8] = pathSuggestions;
18538
- $[9] = reservedGroups;
18539
- $[10] = t2;
18540
- } else {
18541
- t2 = $[10];
18542
- }
18543
- let t3;
18544
- if ($[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
18545
- t3 = /* @__PURE__ */ jsxRuntime.jsx(NewCollectionButton, {});
18546
- $[11] = t3;
18547
- } else {
18548
- t3 = $[11];
18549
- }
18550
- let t4;
18551
- if ($[12] !== includeIntroView) {
18552
- t4 = includeIntroView ? /* @__PURE__ */ jsxRuntime.jsx(IntroWidget, {}) : void 0;
18553
- $[12] = includeIntroView;
18554
- $[13] = t4;
18555
- } else {
18556
- t4 = $[13];
18557
- }
18558
- let t5;
18559
- if ($[14] !== collectionConfigController.navigationEntries || $[15] !== collectionConfigController.saveNavigationEntries || $[16] !== t4) {
18560
- t5 = {
18561
- additionalActions: t3,
18562
- additionalChildrenStart: t4,
18563
- CollectionActions: HomePageEditorCollectionAction,
18564
- AdditionalCards: NewCollectionCard,
18565
- allowDragAndDrop: true,
18566
- navigationEntries: collectionConfigController.navigationEntries,
18567
- onNavigationEntriesUpdate: collectionConfigController.saveNavigationEntries
18568
- };
18569
- $[14] = collectionConfigController.navigationEntries;
18570
- $[15] = collectionConfigController.saveNavigationEntries;
18571
- $[16] = t4;
18572
- $[17] = t5;
18573
- } else {
18574
- t5 = $[17];
18575
- }
18576
- let t6;
18577
- if ($[18] !== collectionConfigController.updateKanbanColumnsOrder || $[19] !== collectionConfigController.updatePropertiesOrder) {
18578
- t6 = {
18579
- CollectionActionsStart: EditorCollectionActionStart,
18580
- CollectionActions: EditorCollectionAction,
18581
- HeaderAction: CollectionViewHeaderAction,
18582
- AddColumnComponent: PropertyAddColumnComponent,
18583
- onColumnsReorder: collectionConfigController.updatePropertiesOrder,
18584
- onKanbanColumnsReorder: collectionConfigController.updateKanbanColumnsOrder,
18585
- KanbanSetupComponent: KanbanSetupAction,
18586
- AddKanbanColumnComponent: AddKanbanColumnAction
18587
- };
18588
- $[18] = collectionConfigController.updateKanbanColumnsOrder;
18589
- $[19] = collectionConfigController.updatePropertiesOrder;
18590
- $[20] = t6;
18591
- } else {
18592
- t6 = $[20];
18593
- }
18594
- let t7;
18595
- let t8;
18596
- if ($[21] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
18597
- t7 = {
18598
- ActionsTop: EditorEntityAction
18599
- };
18600
- t8 = {
18601
- en: collectionEditorTranslationsEn,
18602
- es: collectionEditorTranslationsEs,
18603
- de: collectionEditorTranslationsDe,
18604
- fr: collectionEditorTranslationsFr,
18605
- it: collectionEditorTranslationsIt,
18606
- hi: collectionEditorTranslationsHi,
18607
- pt: collectionEditorTranslationsPt
18608
- };
18609
- $[21] = t7;
18610
- $[22] = t8;
18611
- } else {
18612
- t7 = $[21];
18613
- t8 = $[22];
18614
- }
18615
- let t9;
18616
- if ($[23] !== collectionConfigController.loading || $[24] !== t2 || $[25] !== t5 || $[26] !== t6) {
18617
- t9 = {
18618
- key: "collection_editor",
18619
- loading: collectionConfigController.loading,
18620
- provider: t2,
18621
- homePage: t5,
18622
- collectionView: t6,
18623
- form: t7,
18624
- i18n: t8
18625
- };
18626
- $[23] = collectionConfigController.loading;
18627
- $[24] = t2;
18628
- $[25] = t5;
18629
- $[26] = t6;
18630
- $[27] = t9;
18631
- } else {
18632
- t9 = $[27];
18633
- }
18634
- return t9;
18635
- }
18636
- function IntroWidget() {
18637
- const $ = reactCompilerRuntime.c(24);
18638
- const navigation = core.useNavigationController();
18639
- if (!navigation.topLevelNavigation) {
18640
- throw Error("Navigation not ready in FireCMSHomePage");
18641
- }
18642
- const authController = core.useAuthController();
18643
- const {
18644
- t
18645
- } = core.useTranslation();
18646
- const collectionEditorController = useCollectionEditorController();
18647
- let t0;
18648
- if ($[0] !== authController || $[1] !== collectionEditorController) {
18649
- t0 = collectionEditorController.configPermissions ? collectionEditorController.configPermissions({
18650
- user: authController.user
18651
- }).createCollections : true;
18652
- $[0] = authController;
18653
- $[1] = collectionEditorController;
18654
- $[2] = t0;
18655
- } else {
18656
- t0 = $[2];
18657
- }
18658
- const canCreateCollections = t0;
18659
- if (!navigation.initialised || (navigation.collections ?? []).length > 0) {
18660
- return null;
18661
- }
18662
- let t1;
18663
- if ($[3] !== t) {
18664
- t1 = t("no_collections_found");
18665
- $[3] = t;
18666
- $[4] = t1;
18667
- } else {
18668
- t1 = $[4];
18669
- }
18670
- let t2;
18671
- if ($[5] !== t1) {
18672
- t2 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", className: "uppercase", children: t1 });
18673
- $[5] = t1;
18674
- $[6] = t2;
18675
- } else {
18676
- t2 = $[6];
18677
- }
18678
- let t3;
18679
- if ($[7] !== t) {
18680
- t3 = t("start_building_collections");
18681
- $[7] = t;
18682
- $[8] = t3;
18683
- } else {
18684
- t3 = $[8];
18685
- }
18686
- let t4;
18687
- if ($[9] !== t3) {
18688
- t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { children: t3 });
18689
- $[9] = t3;
18690
- $[10] = t4;
18691
- } else {
18692
- t4 = $[10];
18693
- }
18694
- let t5;
18695
- if ($[11] !== canCreateCollections || $[12] !== collectionEditorController || $[13] !== t) {
18696
- t5 = canCreateCollections && /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { onClick: collectionEditorController && canCreateCollections ? () => collectionEditorController.createCollection({
18697
- parentCollectionIds: [],
18698
- redirect: true,
18699
- sourceClick: "new_collection_card"
18700
- }) : void 0, children: [
18701
- /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}),
18702
- t("create_first_collection")
18703
- ] });
18704
- $[11] = canCreateCollections;
18705
- $[12] = collectionEditorController;
18706
- $[13] = t;
18707
- $[14] = t5;
18708
- } else {
18709
- t5 = $[14];
18710
- }
18711
- let t6;
18712
- if ($[15] !== t) {
18713
- t6 = t("define_collections_programmatically");
18714
- $[15] = t;
18715
- $[16] = t6;
18716
- } else {
18717
- t6 = $[16];
18718
- }
18719
- let t7;
18720
- if ($[17] !== t6) {
18721
- t7 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { color: "secondary", children: t6 });
18722
- $[17] = t6;
18723
- $[18] = t7;
18724
- } else {
18725
- t7 = $[18];
18726
- }
18727
- let t8;
18728
- if ($[19] !== t2 || $[20] !== t4 || $[21] !== t5 || $[22] !== t7) {
18729
- t8 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Paper, { className: "my-4 px-4 py-6 flex flex-col bg-white dark:bg-surface-accent-800 gap-2", children: [
18730
- t2,
18731
- t4,
18732
- t5,
18733
- t7
18734
- ] });
18735
- $[19] = t2;
18736
- $[20] = t4;
18737
- $[21] = t5;
18738
- $[22] = t7;
18739
- $[23] = t8;
18740
- } else {
18741
- t8 = $[23];
18742
- }
18743
- return t8;
18744
- }
18745
- const mergeCollections = (baseCollections, backendCollections = [], modifyCollection) => {
18746
- const markAsEditable = (c) => {
18747
- core.makePropertiesEditable(c.properties);
18748
- c.subcollections?.forEach(markAsEditable);
18749
- };
18750
- backendCollections.forEach(markAsEditable);
18751
- const result = core.joinCollectionLists(baseCollections, backendCollections, [], modifyCollection);
18752
- result.sort((a, b) => {
18753
- const indexA = baseCollections.findIndex((c) => c.id === a.id);
18754
- const indexB = baseCollections.findIndex((c) => c.id === b.id);
18755
- if (indexA === -1 && indexB === -1) {
18756
- return 0;
18757
- }
18758
- if (indexA === -1) {
18759
- return 1;
18760
- }
18761
- if (indexB === -1) {
18762
- return -1;
18763
- }
18764
- return indexA - indexB;
18765
- });
18766
- return result;
18767
- };
18768
- function MissingReferenceWidget(t0) {
18769
- const $ = reactCompilerRuntime.c(12);
18770
- const {
18771
- path: pathProp
18772
- } = t0;
18773
- const navigation = core.useNavigationController();
18774
- const path = getLastSegment(pathProp);
18775
- let t1;
18776
- if ($[0] !== navigation || $[1] !== pathProp) {
18777
- t1 = navigation.getParentCollectionIds(pathProp);
18778
- $[0] = navigation;
18779
- $[1] = pathProp;
18780
- $[2] = t1;
18781
- } else {
18782
- t1 = $[2];
18783
- }
18784
- const parentCollectionIds = t1;
18785
- const collectionEditor = useCollectionEditorController();
18786
- const t2 = "No collection for path: " + path;
18787
- let t3;
18788
- if ($[3] !== t2) {
18789
- t3 = /* @__PURE__ */ jsxRuntime.jsx(core.ErrorView, { error: t2 });
18790
- $[3] = t2;
18791
- $[4] = t3;
18792
- } else {
18793
- t3 = $[4];
18794
- }
18795
- let t4;
18796
- if ($[5] !== collectionEditor || $[6] !== parentCollectionIds || $[7] !== path) {
18797
- t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { className: "mx-2", size: "small", onClick: () => {
18798
- collectionEditor.createCollection({
18799
- initialValues: {
18800
- path,
18801
- name: core.prettifyIdentifier(path)
18802
- },
18803
- parentCollectionIds,
18804
- redirect: false,
18805
- sourceClick: "missing_reference"
18806
- });
18807
- }, children: "Create" });
18808
- $[5] = collectionEditor;
18809
- $[6] = parentCollectionIds;
18810
- $[7] = path;
18811
- $[8] = t4;
18812
- } else {
18813
- t4 = $[8];
18814
- }
18815
- let t5;
18816
- if ($[9] !== t3 || $[10] !== t4) {
18817
- t5 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-1 flex flex-col items-center", children: [
18818
- t3,
18819
- t4
18820
- ] });
18821
- $[9] = t3;
18822
- $[10] = t4;
18823
- $[11] = t5;
18824
- } else {
18825
- t5 = $[11];
18826
- }
18827
- return t5;
18828
- }
18829
- function getLastSegment(path) {
18830
- const segments = path.split("/");
18831
- return segments[segments.length - 1];
18832
- }
18780
+ const pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18781
+ __proto__: null,
18782
+ collectionEditorTranslationsPt
18783
+ }, Symbol.toStringTag, { value: "Module" }));
18833
18784
  exports2.CollectionGenerationApiError = CollectionGenerationApiError;
18834
18785
  exports2.DEFAULT_COLLECTION_GENERATION_ENDPOINT = DEFAULT_COLLECTION_GENERATION_ENDPOINT;
18835
18786
  exports2.MissingReferenceWidget = MissingReferenceWidget;