@@ -424,6 +424,7 @@ export default {
424424 allRelatedDocs: [],
425425 allRelatedDocsKnown: false ,
426426 docTypesSeen: [],
427+ relatedDocTypes: [],
427428 searchField: {
428429 label: this .$t (' apostrophe:searchLocales' ),
429430 placeholder: ` ${ this .$t (' apostrophe:searchLocales' )} ...`
@@ -516,32 +517,6 @@ export default {
516517 .filter (locale => ! this .isCurrentLocale (locale) && this .canEditLocale (locale))
517518 .length ;
518519 },
519- relatedDocTypes () {
520- if (this .isBatchMode ) {
521- return this .getRelatedSchemaTypes (this .batchOptions .checkedTypes );
522- }
523-
524- const types = {};
525- for (const doc of this .relatedDocs ) {
526- if (! types[doc .type ]) {
527- types[doc .type ] = {
528- value: doc .type ,
529- count: 0 ,
530- readOnly: false
531- };
532- }
533- types[doc .type ].count ++ ;
534- }
535- for (const type of Object .values (types)) {
536- const baseLabel = this .plural (type .value );
537- type .label = {
538- key: ' apostrophe:typeWithCount' ,
539- type: this .$t (baseLabel),
540- count: type .count
541- };
542- }
543- return Object .values (types);
544- },
545520 relatedDocTypesField () {
546521 return {
547522 name: ' related-doc-types-to-localize' ,
@@ -609,17 +584,6 @@ export default {
609584 }
610585 }
611586 }
612- },
613- relatedDocTypes (newVal ) {
614- if (! this .isBatchMode ) {
615- return ;
616- }
617- for (const item of newVal) {
618- if (! this .docTypesSeen .includes (item .value )) {
619- this .docTypesSeen .push (item .value );
620- this .wizard .values .relatedDocTypesToLocalize .data .push (item .value );
621- }
622- }
623587 }
624588 },
625589 async mounted () {
@@ -629,6 +593,7 @@ export default {
629593 if (this .isBatchMode ) {
630594 this .wizard .step = this .visibleStepNames [0 ];
631595 this .wizard .busy = false ;
596+ this .setRelatedDocTypes ();
632597 } else {
633598 try {
634599 this .fullDoc = await apos .http .get (
@@ -657,6 +622,40 @@ export default {
657622 }
658623 },
659624 methods: {
625+ setRelatedDocTypes () {
626+ if (this .isBatchMode ) {
627+ this .relatedDocTypes = this .getRelatedSchemaTypes (this .batchOptions .checkedTypes );
628+ for (const item of this .relatedDocTypes ) {
629+ if (! this .docTypesSeen .includes (item .value )) {
630+ this .docTypesSeen .push (item .value );
631+ this .wizard .values .relatedDocTypesToLocalize .data .push (item .value );
632+ }
633+ }
634+ return ;
635+ }
636+
637+ const types = {};
638+ for (const doc of this .relatedDocs ) {
639+ if (! types[doc .type ]) {
640+ types[doc .type ] = {
641+ value: doc .type ,
642+ count: 0 ,
643+ readOnly: false
644+ };
645+ }
646+ types[doc .type ].count ++ ;
647+ }
648+ for (const type of Object .values (types)) {
649+ const baseLabel = this .plural (type .value );
650+ type .label = {
651+ key: ' apostrophe:typeWithCount' ,
652+ type: this .$t (baseLabel),
653+ count: type .count
654+ };
655+ }
656+ this .relatedDocTypes = Object .values (types);
657+
658+ },
660659 normalizeConfig () {
661660 if (this .isBatchMode ) {
662661 this .toLocalizeChoices = this .toLocalizeChoicesBatch ;
@@ -1156,6 +1155,17 @@ export default {
11561155 }
11571156 this.relatedDocs = relatedDocs;
11581157 this.wizard.busy = status;
1158+
1159+ for (const doc of this.relatedDocs) {
1160+ if (!this.docTypesSeen.includes(doc.type)) {
1161+ this.docTypesSeen.push(doc.type);
1162+ if (apos.modules[doc.type].relatedDocument) {
1163+ this.wizard.values.relatedDocTypesToLocalize.data.push(doc.type);
1164+ }
1165+ }
1166+ }
1167+
1168+ this.setRelatedDocTypes();
11591169 },
11601170 wait(time) {
11611171 return new Promise((resolve) => {
0 commit comments