runeforge 0.0.41 → 0.0.43
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.
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
let {
|
|
6
6
|
title = '',
|
|
7
7
|
onClose,
|
|
8
|
+
closeOnClickOutside = true,
|
|
9
|
+
onClickOutside,
|
|
8
10
|
children,
|
|
9
11
|
class: additionalClass,
|
|
10
12
|
width,
|
|
@@ -14,6 +16,10 @@
|
|
|
14
16
|
}: {
|
|
15
17
|
title?: string;
|
|
16
18
|
onClose?: () => void;
|
|
19
|
+
/** Whether clicking the backdrop (outside the modal box) closes the modal. */
|
|
20
|
+
closeOnClickOutside?: boolean;
|
|
21
|
+
/** Callback invoked when clicking outside the modal. Defaults to `onClose`. */
|
|
22
|
+
onClickOutside?: () => void;
|
|
17
23
|
children: Snippet;
|
|
18
24
|
/** Extra classes merged onto the modal box, e.g. Tailwind size utilities
|
|
19
25
|
* like `max-w-4xl` or `w-11/12`. */
|
|
@@ -26,6 +32,8 @@
|
|
|
26
32
|
maxHeight?: string;
|
|
27
33
|
} = $props();
|
|
28
34
|
|
|
35
|
+
const handleClickOutside = $derived(onClickOutside ?? onClose);
|
|
36
|
+
|
|
29
37
|
const boxStyle = $derived(
|
|
30
38
|
[
|
|
31
39
|
width ? `width:${width}` : '',
|
|
@@ -59,9 +67,9 @@
|
|
|
59
67
|
{@render children()}
|
|
60
68
|
</div>
|
|
61
69
|
|
|
62
|
-
{#if
|
|
70
|
+
{#if closeOnClickOutside && handleClickOutside}
|
|
63
71
|
<div class="modal-backdrop">
|
|
64
|
-
<button onclick={
|
|
72
|
+
<button onclick={handleClickOutside} aria-label="Cerrar"></button>
|
|
65
73
|
</div>
|
|
66
74
|
{/if}
|
|
67
75
|
</dialog>
|
|
@@ -2,6 +2,10 @@ import type { Snippet } from 'svelte';
|
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
title?: string;
|
|
4
4
|
onClose?: () => void;
|
|
5
|
+
/** Whether clicking the backdrop (outside the modal box) closes the modal. */
|
|
6
|
+
closeOnClickOutside?: boolean;
|
|
7
|
+
/** Callback invoked when clicking outside the modal. Defaults to `onClose`. */
|
|
8
|
+
onClickOutside?: () => void;
|
|
5
9
|
children: Snippet;
|
|
6
10
|
/** Extra classes merged onto the modal box, e.g. Tailwind size utilities
|
|
7
11
|
* like `max-w-4xl` or `w-11/12`. */
|
|
@@ -102,6 +102,7 @@
|
|
|
102
102
|
const allowRead = $derived(read.enabled ?? true);
|
|
103
103
|
const allowUpdate = $derived(update.enabled ?? true);
|
|
104
104
|
const allowDelete = $derived(deletion.enabled ?? true);
|
|
105
|
+
const allowCreate = $derived(creation.enabled ?? true);
|
|
105
106
|
const deleteLabel = $derived(deletion.label ?? strings.delete);
|
|
106
107
|
const updateLabel = $derived(update.label ?? strings.edit);
|
|
107
108
|
const readLabel = $derived(read.label ?? strings.view);
|
|
@@ -353,15 +354,17 @@
|
|
|
353
354
|
</Button>
|
|
354
355
|
{/if}
|
|
355
356
|
|
|
356
|
-
{
|
|
357
|
-
|
|
358
|
-
<
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
357
|
+
{#if allowCreate}
|
|
358
|
+
{@const CreateIcon = icons.create}
|
|
359
|
+
<Button variant="primary" onclick={measuring ? undefined : handleCreate}>
|
|
360
|
+
<CreateIcon class="size-5" />
|
|
361
|
+
{#if creation.label}
|
|
362
|
+
<span>{creation.label}</span>
|
|
363
|
+
{:else}
|
|
364
|
+
<span>{strings.create}<span class="hidden sm:inline"> {labelOne}</span></span>
|
|
365
|
+
{/if}
|
|
366
|
+
</Button>
|
|
367
|
+
{/if}
|
|
365
368
|
{/snippet}
|
|
366
369
|
|
|
367
370
|
{#snippet actionsCell(item: T)}
|
|
@@ -415,7 +418,6 @@
|
|
|
415
418
|
<SearchInput config={search} />
|
|
416
419
|
{/if}
|
|
417
420
|
|
|
418
|
-
{@const CreateIcon = icons.create}
|
|
419
421
|
<Button
|
|
420
422
|
variant="ghost"
|
|
421
423
|
class="btn-square"
|
|
@@ -433,17 +435,20 @@
|
|
|
433
435
|
class="dropdown dropdown-end w-56 rounded-box border border-base-content/10 bg-base-100 p-1 shadow-lg"
|
|
434
436
|
bind:this={actionsPopoverEl}
|
|
435
437
|
>
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
438
|
+
{#if allowCreate}
|
|
439
|
+
{@const CreateIcon = icons.create}
|
|
440
|
+
<Button
|
|
441
|
+
variant="ghost"
|
|
442
|
+
class="btn-sm w-full justify-start"
|
|
443
|
+
onclick={() => {
|
|
444
|
+
actionsPopoverEl?.hidePopover();
|
|
445
|
+
handleCreate();
|
|
446
|
+
}}
|
|
447
|
+
>
|
|
448
|
+
<CreateIcon class="size-4" />
|
|
449
|
+
{creation.label || `${strings.create} ${labelOne}`}
|
|
450
|
+
</Button>
|
|
451
|
+
{/if}
|
|
447
452
|
|
|
448
453
|
{#if allowDelete}
|
|
449
454
|
<Button
|