9
9
}}</b-alert
10
10
>
11
11
<template v-if =" rows " >
12
- <b-form-checkbox v-model =" showEntryLetters" class =" m-2" >{{
13
- $t("Afficher des lettres au lieu des numéros de pages")
14
- }}</b-form-checkbox >
12
+ <b-form-checkbox
13
+ v-model =" showEntryLetters"
14
+ :disabled =" hasEntrycodesLongerThanFirstColumnMaxWidth"
15
+ class =" m-2"
16
+ >{{
17
+ $t("Afficher des lettres au lieu des numéros de pages")
18
+ }}</b-form-checkbox
19
+ >
15
20
<b-form-checkbox v-model =" showHorizontalScroll" class =" m-2" >{{
16
21
$t("Afficher la barre de défilement horizontale")
17
22
}}</b-form-checkbox >
@@ -60,17 +65,6 @@ const isCopied = ref(false);
60
65
61
66
const columnWidths = [12 , 14 , 3 , 2 , 1 , 4 , 4 , 4 , 4 , 4 ];
62
67
63
- const text = computed (() =>
64
- [Object .values (issueRow .value )]
65
- .concat ((rows .value || []).map (Object .values ))
66
- .map ((row ) =>
67
- row
68
- .map ((text , idx ) => String (text || " " ).padEnd (columnWidths [idx ] || 0 ))
69
- .join (" " ),
70
- )
71
- .join (" \n " ),
72
- );
73
-
74
68
const copyToClipboard = () => {
75
69
navigator .clipboard .writeText (text .value );
76
70
isCopied .value = true ;
@@ -112,6 +106,40 @@ const issuecode = computed(
112
106
` ${issue .value ! .publicationcode .split (" /" )[1 ]} ${issue .value ! .issuenumber } ` ,
113
107
);
114
108
109
+ const entrycodesWithPageNumbers = computed (() =>
110
+ indexation .value ! .entries .map (
111
+ (entry , idx ) =>
112
+ ` ${issuecode .value }${
113
+ idx === 0
114
+ ? String .fromCharCode (97 + idx )
115
+ : ` p${String (entry .position ).padStart (3 , " 0" )} `
116
+ } ` ,
117
+ ),
118
+ );
119
+
120
+ const entrycodesWithLetters = computed (() =>
121
+ indexation .value ! .entries .map (
122
+ (_entry , idx ) => ` ${issuecode .value }${String .fromCharCode (97 + idx )} ` ,
123
+ ),
124
+ );
125
+
126
+ const hasEntrycodesLongerThanFirstColumnMaxWidth = computed (() =>
127
+ entrycodesWithPageNumbers .value .some (
128
+ (entrycode ) => entrycode .length > columnWidths [0 ],
129
+ ),
130
+ );
131
+
132
+ watch (
133
+ hasEntrycodesLongerThanFirstColumnMaxWidth ,
134
+ (value ) => {
135
+ if (value ) {
136
+ debugger ;
137
+ showEntryLetters .value = true ;
138
+ }
139
+ },
140
+ { immediate: true },
141
+ );
142
+
115
143
const issueRow = computed (() => ({
116
144
issuecode: issuecode .value ,
117
145
details: [
@@ -137,10 +165,14 @@ const rows = computed(() =>
137
165
({ storycode }) => storycode === entry .acceptedStory ?.storycode ,
138
166
);
139
167
return {
140
- entrycode: ` ${issuecode .value }${(idx === 0 || showEntryLetters .value
141
- ? String .fromCharCode (97 + idx )
142
- : ` p${String (entry .position )} `
143
- ).padStart (3 , " 0" )} ` ,
168
+ entrycode:
169
+ idx === 0 ||
170
+ (showEntryLetters .value &&
171
+ ! hasEntrycodesLongerThanFirstColumnMaxWidth .value )
172
+ ? entrycodesWithLetters .value [idx ]
173
+ : hasEntrycodesLongerThanFirstColumnMaxWidth .value
174
+ ? " ->"
175
+ : entrycodesWithPageNumbers .value [idx ],
144
176
storycode: entry .acceptedStory ?.storycode || " " ,
145
177
pg: String (getEntryPages (indexation .value ! , entry .id ).length ),
146
178
la:
@@ -157,11 +189,26 @@ const rows = computed(() =>
157
189
]),
158
190
) as { plot: string ; writer: string ; artist: string ; ink: string }),
159
191
hero: " " , // story!.printedhero,
160
- title: entry .title ,
192
+ title: ` ${entry .title || " " }${
193
+ hasEntrycodesLongerThanFirstColumnMaxWidth .value && idx > 0
194
+ ? ` [entrycode:${entrycodesWithPageNumbers .value [idx ]}] `
195
+ : " "
196
+ } ` ,
161
197
};
162
198
}),
163
199
);
164
200
201
+ const text = computed (() =>
202
+ [Object .values (issueRow .value )]
203
+ .concat ((rows .value || []).map (Object .values ))
204
+ .map ((row ) =>
205
+ row
206
+ .map ((text , idx ) => String (text || " " ).padEnd (columnWidths [idx ] || 0 ))
207
+ .join (" " ),
208
+ )
209
+ .join (" \n " ),
210
+ );
211
+
165
212
watch (
166
213
acceptedStories ,
167
214
async (value ) => {
0 commit comments