|
65 | 65 | if(show.layout.sections[0] && ( |
66 | 66 | show.sectionHasField(show.layout.sections[0], 'entityList') |
67 | 67 | || show.layout.sections[0].title |
68 | | - || show.sectionCommands(show.layout.sections[0])?.flat().length |
| 68 | + || show.sectionAllowedCommands(show.layout.sections[0])?.flat().length |
69 | 69 | ) |
70 | 70 | || !show.layout.sections.length) { |
71 | 71 | return [ |
|
207 | 207 | </template> |
208 | 208 | <template v-else> |
209 | 209 | <RootCard> |
210 | | - <template v-if="section.title || i == 0 || section.collapsable || show.sectionCommands(section)?.flat().length"> |
| 210 | + <template v-if="section.title || i == 0 || section.collapsable || show.sectionAllowedCommands(section)?.flat().length"> |
211 | 211 | <RootCardHeader class="data-overflowing-viewport:sticky" :collapsed="collapsed"> |
212 | 212 | <div class="flex flex-wrap gap-4"> |
213 | 213 | <div class="flex gap-4"> |
|
225 | 225 | </Button> |
226 | 226 | </template> |
227 | 227 | </div> |
228 | | - <template v-if="show.sectionCommands(section)?.flat().length"> |
229 | | - <div class="ml-auto flex -my-1 justify-end" :class="{ 'invisible': collapsed }" |
230 | | - role="group" |
231 | | - :aria-label="__('sharp::show.section_menu.aria_label', { title: section.title })" |
232 | | - > |
233 | | - <DropdownMenu> |
234 | | - <DropdownMenuTrigger as-child> |
235 | | - <Button class="h-8" size="sm" variant="outline"> |
236 | | - {{ __('sharp::entity_list.commands.instance.label') }} |
237 | | - <DropdownChevronDown /> |
238 | | - </Button> |
239 | | - </DropdownMenuTrigger> |
240 | | - <DropdownMenuContent> |
241 | | - <CommandDropdownItems |
242 | | - :commands="show.sectionCommands(section)" |
243 | | - @select="onCommand" |
244 | | - /> |
245 | | - </DropdownMenuContent> |
246 | | - </DropdownMenu> |
247 | | - </div> |
248 | | - </template> |
249 | 228 | <template v-if="i == 0"> |
250 | 229 | <div class="ml-auto flex flex-wrap -my-1 justify-end gap-2" |
251 | 230 | :class="{ 'invisible': collapsed }" |
|
324 | 303 | </template> |
325 | 304 |
|
326 | 305 | <CommandDropdownItems |
327 | | - :commands="show.allowedInstanceCommands" |
| 306 | + :commands="show.dropdownInstanceCommands" |
328 | 307 | @select="onCommand" |
329 | 308 | /> |
| 309 | + |
330 | 310 | <template v-if="show.authorizations.delete"> |
331 | | - <template v-if="show.allowedInstanceCommands?.flat().length"> |
| 311 | + <template v-if="show.dropdownInstanceCommands?.flat().length"> |
332 | 312 | <DropdownMenuSeparator /> |
333 | 313 | </template> |
334 | 314 | <DropdownMenuItem class="text-destructive" @click="onDelete"> |
|
338 | 318 | </DropdownMenuContent> |
339 | 319 | </DropdownMenu> |
340 | 320 | </template> |
| 321 | + <template v-for="command in show.primaryInstanceCommands"> |
| 322 | + <Button class="h-8" size="sm" @click="onCommand(command)"> |
| 323 | + {{ command.label }} |
| 324 | + </Button> |
| 325 | + </template> |
341 | 326 | <template v-if="show.authorizations.update"> |
342 | 327 | <Button class="h-8 pointer-events-auto" size="sm" :disabled="isReordering" as-child> |
343 | 328 | <Link :as="isReordering ? 'button' : 'a'" :href="show.config.formEditUrl"> |
|
349 | 334 | </template> |
350 | 335 | </div> |
351 | 336 | </template> |
| 337 | + <template v-else> |
| 338 | + <template v-if="show.sectionAllowedCommands(section)?.flat().length"> |
| 339 | + <div class="ml-auto flex -my-1 justify-end gap-2" :class="{ 'invisible': collapsed }" |
| 340 | + role="group" |
| 341 | + :aria-label="__('sharp::show.section_menu.aria_label', { title: section.title })" |
| 342 | + > |
| 343 | + <template v-if="show.sectionDropdownCommands(section)?.flat().length"> |
| 344 | + <DropdownMenu> |
| 345 | + <DropdownMenuTrigger as-child> |
| 346 | + <Button class="h-8" size="sm" variant="outline"> |
| 347 | + {{ __('sharp::entity_list.commands.instance.label') }} |
| 348 | + <DropdownChevronDown /> |
| 349 | + </Button> |
| 350 | + </DropdownMenuTrigger> |
| 351 | + <DropdownMenuContent> |
| 352 | + <CommandDropdownItems |
| 353 | + :commands="show.sectionDropdownCommands(section)" |
| 354 | + @select="onCommand" |
| 355 | + /> |
| 356 | + </DropdownMenuContent> |
| 357 | + </DropdownMenu> |
| 358 | + </template> |
| 359 | + <template v-for="command in show.sectionPrimaryCommands(section)"> |
| 360 | + <Button class="h-8" size="sm" @click="onCommand(command)"> |
| 361 | + {{ command.label }} |
| 362 | + </Button> |
| 363 | + </template> |
| 364 | + </div> |
| 365 | + </template> |
| 366 | + </template> |
352 | 367 | </div> |
353 | 368 | </RootCardHeader> |
354 | 369 | </template> |
|
0 commit comments