runeforge 0.0.38 → 0.0.39
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.
|
@@ -109,9 +109,6 @@
|
|
|
109
109
|
const allowSelection = $derived(
|
|
110
110
|
allowDelete || customBulkActions.some((action) => !isViewBasedBulkAction(action))
|
|
111
111
|
);
|
|
112
|
-
const hasCollapsibleActions = $derived(
|
|
113
|
-
enableExport || customBulkActions.length > 0 || allowDelete
|
|
114
|
-
);
|
|
115
112
|
|
|
116
113
|
let selected = new SvelteSet<number>();
|
|
117
114
|
let pendingDeletion = $state<T[] | null>(null);
|
|
@@ -412,102 +409,103 @@
|
|
|
412
409
|
breadcrumbs={[{ label: labelMany, icon: entityIcon, link: { href: '#' }, prominent: true }]}
|
|
413
410
|
>
|
|
414
411
|
{#snippet buttons()}
|
|
415
|
-
<div bind:this={toolbarEl} class="flex flex-wrap items-center gap-2 overflow-hidden">
|
|
412
|
+
<div bind:this={toolbarEl} class="flex min-w-0 flex-wrap items-center gap-2 overflow-hidden">
|
|
416
413
|
{#if toolbarCollapsed}
|
|
417
414
|
{#if search}
|
|
418
415
|
<SearchInput config={search} />
|
|
419
416
|
{/if}
|
|
420
417
|
|
|
421
|
-
{
|
|
418
|
+
{@const CreateIcon = icons.create}
|
|
419
|
+
<Button
|
|
420
|
+
variant="ghost"
|
|
421
|
+
class="btn-square"
|
|
422
|
+
popovertarget="actions-menu-{actionsMenuId}"
|
|
423
|
+
style="anchor-name:--actions-anchor-{actionsMenuId}"
|
|
424
|
+
aria-label={strings.actions}
|
|
425
|
+
title={strings.actions}
|
|
426
|
+
>
|
|
427
|
+
<span class="text-lg leading-none" aria-hidden="true">⋯</span>
|
|
428
|
+
</Button>
|
|
429
|
+
<div
|
|
430
|
+
popover="auto"
|
|
431
|
+
id="actions-menu-{actionsMenuId}"
|
|
432
|
+
style="position-anchor:--actions-anchor-{actionsMenuId}"
|
|
433
|
+
class="dropdown dropdown-end w-56 rounded-box border border-base-content/10 bg-base-100 p-1 shadow-lg"
|
|
434
|
+
bind:this={actionsPopoverEl}
|
|
435
|
+
>
|
|
422
436
|
<Button
|
|
423
437
|
variant="ghost"
|
|
424
|
-
class="btn-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
438
|
+
class="btn-sm w-full justify-start"
|
|
439
|
+
onclick={() => {
|
|
440
|
+
actionsPopoverEl?.hidePopover();
|
|
441
|
+
handleCreate();
|
|
442
|
+
}}
|
|
429
443
|
>
|
|
430
|
-
<
|
|
444
|
+
<CreateIcon class="size-4" />
|
|
445
|
+
{creation.label || `${strings.create} ${labelOne}`}
|
|
431
446
|
</Button>
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
447
|
+
|
|
448
|
+
{#if allowDelete}
|
|
449
|
+
<Button
|
|
450
|
+
variant="ghost"
|
|
451
|
+
class="btn-sm w-full justify-start text-error"
|
|
452
|
+
disabled={selected.size === 0}
|
|
453
|
+
onclick={() => {
|
|
454
|
+
actionsPopoverEl?.hidePopover();
|
|
455
|
+
handleDelete();
|
|
456
|
+
}}
|
|
457
|
+
>
|
|
458
|
+
{deleteLabel} ({selected.size})
|
|
459
|
+
</Button>
|
|
460
|
+
{/if}
|
|
461
|
+
|
|
462
|
+
{#if enableExport}
|
|
463
|
+
<Button
|
|
464
|
+
variant="ghost"
|
|
465
|
+
class="btn-sm w-full justify-start"
|
|
466
|
+
onclick={() => {
|
|
467
|
+
actionsPopoverEl?.hidePopover();
|
|
468
|
+
handleExport('csv');
|
|
469
|
+
}}
|
|
470
|
+
>
|
|
471
|
+
{strings.exportCsv}
|
|
472
|
+
</Button>
|
|
473
|
+
{#if xlsx}
|
|
440
474
|
<Button
|
|
441
475
|
variant="ghost"
|
|
442
476
|
class="btn-sm w-full justify-start"
|
|
443
477
|
onclick={() => {
|
|
444
478
|
actionsPopoverEl?.hidePopover();
|
|
445
|
-
handleExport('
|
|
479
|
+
handleExport('xlsx');
|
|
446
480
|
}}
|
|
447
481
|
>
|
|
448
|
-
{strings.
|
|
482
|
+
{strings.exportExcel}
|
|
449
483
|
</Button>
|
|
450
|
-
{#if xlsx}
|
|
451
|
-
<Button
|
|
452
|
-
variant="ghost"
|
|
453
|
-
class="btn-sm w-full justify-start"
|
|
454
|
-
onclick={() => {
|
|
455
|
-
actionsPopoverEl?.hidePopover();
|
|
456
|
-
handleExport('xlsx');
|
|
457
|
-
}}
|
|
458
|
-
>
|
|
459
|
-
{strings.exportExcel}
|
|
460
|
-
</Button>
|
|
461
|
-
{/if}
|
|
462
484
|
{/if}
|
|
485
|
+
{/if}
|
|
463
486
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
<Button
|
|
469
|
-
variant="ghost"
|
|
470
|
-
class="btn-sm w-full justify-start"
|
|
471
|
-
disabled={!isView && selected.size === 0}
|
|
472
|
-
title={bulkAction.tooltip}
|
|
473
|
-
onclick={() => {
|
|
474
|
-
actionsPopoverEl?.hidePopover();
|
|
475
|
-
handleBulkAction(bulkAction);
|
|
476
|
-
}}
|
|
477
|
-
>
|
|
478
|
-
<BulkIcon class="size-4" />
|
|
479
|
-
{bulkAction.label ?? bulkAction.tooltip}{#if !isView}
|
|
480
|
-
({selected.size})
|
|
481
|
-
{/if}
|
|
482
|
-
</Button>
|
|
483
|
-
{/if}
|
|
484
|
-
{/each}
|
|
485
|
-
|
|
486
|
-
{#if allowDelete}
|
|
487
|
+
{#each customBulkActions as bulkAction, i (i)}
|
|
488
|
+
{#if bulkAction.condition?.(selectedItems) ?? true}
|
|
489
|
+
{@const BulkIcon = bulkAction.icon}
|
|
490
|
+
{@const isView = isViewBasedBulkAction(bulkAction)}
|
|
487
491
|
<Button
|
|
488
492
|
variant="ghost"
|
|
489
|
-
class="btn-sm w-full justify-start
|
|
490
|
-
disabled={selected.size === 0}
|
|
493
|
+
class="btn-sm w-full justify-start"
|
|
494
|
+
disabled={!isView && selected.size === 0}
|
|
495
|
+
title={bulkAction.tooltip}
|
|
491
496
|
onclick={() => {
|
|
492
497
|
actionsPopoverEl?.hidePopover();
|
|
493
|
-
|
|
498
|
+
handleBulkAction(bulkAction);
|
|
494
499
|
}}
|
|
495
500
|
>
|
|
496
|
-
|
|
501
|
+
<BulkIcon class="size-4" />
|
|
502
|
+
{bulkAction.label ?? bulkAction.tooltip}{#if !isView}
|
|
503
|
+
({selected.size})
|
|
504
|
+
{/if}
|
|
497
505
|
</Button>
|
|
498
506
|
{/if}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
{@const CreateIcon = icons.create}
|
|
503
|
-
<Button variant="primary" onclick={handleCreate}>
|
|
504
|
-
<CreateIcon class="size-5" />
|
|
505
|
-
{#if creation.label}
|
|
506
|
-
<span>{creation.label}</span>
|
|
507
|
-
{:else}
|
|
508
|
-
<span>{strings.create}<span class="hidden sm:inline"> {labelOne}</span></span>
|
|
509
|
-
{/if}
|
|
510
|
-
</Button>
|
|
507
|
+
{/each}
|
|
508
|
+
</div>
|
|
511
509
|
{:else}
|
|
512
510
|
{@render toolbarButtons(false)}
|
|
513
511
|
{/if}
|
|
@@ -515,8 +513,8 @@
|
|
|
515
513
|
|
|
516
514
|
<div
|
|
517
515
|
bind:this={toolbarMeasureEl}
|
|
518
|
-
class="pointer-events-none invisible
|
|
519
|
-
style="left:-9999px; top:-9999px;"
|
|
516
|
+
class="pointer-events-none invisible fixed flex items-center gap-2 whitespace-nowrap"
|
|
517
|
+
style="left:-9999px; top:-9999px; width:max-content;"
|
|
520
518
|
aria-hidden="true"
|
|
521
519
|
>
|
|
522
520
|
{@render toolbarButtons(true)}
|