fuma 0.1.11 → 0.1.14
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.
- package/dist/ui/Icon.svelte +1 -1
- package/dist/ui/input/InputCombo.svelte +1 -1
- package/dist/ui/input/InputRelation.svelte +6 -6
- package/dist/ui/input/InputRelations.svelte +3 -3
- package/dist/ui/input/InputSelect.svelte +1 -1
- package/dist/ui/input/RelationAfter.svelte +5 -22
- package/dist/ui/input/RelationAfter.svelte.d.ts +0 -1
- package/dist/ui/menu/DropDown.svelte +3 -0
- package/dist/ui/menu/DropDown.svelte.d.ts +1 -0
- package/dist/validation/form.js +4 -0
- package/package.json +1 -1
package/dist/ui/Icon.svelte
CHANGED
|
@@ -30,7 +30,7 @@ async function select(index = focusIndex) {
|
|
|
30
30
|
}
|
|
31
31
|
</script>
|
|
32
32
|
|
|
33
|
-
<DropDown {tippyProps}>
|
|
33
|
+
<DropDown {tippyProps} isWidthOfActivator>
|
|
34
34
|
<div class="contents" slot="activator">
|
|
35
35
|
<FormControl {...props} let:key>
|
|
36
36
|
<div class="flex grow gap-2" class:hidden={selectedOption}>
|
|
@@ -4,11 +4,11 @@ import { toast } from "svelte-sonner";
|
|
|
4
4
|
import { mdiClose } from "@mdi/js";
|
|
5
5
|
import { FormControl, DropDown, Icon, SelectorList, Slot } from "../index.js";
|
|
6
6
|
import RelationAfter from "./RelationAfter.svelte";
|
|
7
|
-
export let key =
|
|
7
|
+
export let key = Math.random().toString();
|
|
8
8
|
export let label = "";
|
|
9
9
|
export let search;
|
|
10
10
|
export let createUrl = "";
|
|
11
|
-
export let createTitle = "";
|
|
11
|
+
export let createTitle = "Nouveau";
|
|
12
12
|
let item = null;
|
|
13
13
|
export { item as value };
|
|
14
14
|
export let error = "";
|
|
@@ -60,15 +60,15 @@ async function handleBlur() {
|
|
|
60
60
|
}
|
|
61
61
|
</script>
|
|
62
62
|
|
|
63
|
-
<DropDown {tippyProps} disable={flatMode}>
|
|
63
|
+
<DropDown {tippyProps} disable={flatMode} isWidthOfActivator>
|
|
64
64
|
<div class="contents" slot="activator">
|
|
65
65
|
<FormControl {key} {label} {error} class={klass} let:key>
|
|
66
66
|
<div class="flex grow gap-2" class:hidden={item}>
|
|
67
|
-
<div class="
|
|
67
|
+
<div class="input input-bordered flex grow items-center pr-2">
|
|
68
68
|
<input
|
|
69
69
|
type="text"
|
|
70
|
-
id={key}
|
|
71
70
|
name={key}
|
|
71
|
+
id={key}
|
|
72
72
|
bind:this={inputElement}
|
|
73
73
|
bind:value={searchValue}
|
|
74
74
|
on:input={(e) => searchItemsDebounce(e.currentTarget.value)}
|
|
@@ -76,7 +76,7 @@ async function handleBlur() {
|
|
|
76
76
|
on:blur={handleBlur}
|
|
77
77
|
autocomplete="off"
|
|
78
78
|
{placeholder}
|
|
79
|
-
class="
|
|
79
|
+
class="grow"
|
|
80
80
|
/>
|
|
81
81
|
|
|
82
82
|
<RelationAfter {isLoading} {createUrl} {createTitle} />
|
|
@@ -73,7 +73,7 @@ async function handleBlur() {
|
|
|
73
73
|
}
|
|
74
74
|
</script>
|
|
75
75
|
|
|
76
|
-
<DropDown bind:this={dropdown} disable={flatMode}>
|
|
76
|
+
<DropDown bind:this={dropdown} disable={flatMode} isWidthOfActivator>
|
|
77
77
|
<div slot="activator">
|
|
78
78
|
<FormControl {key} {label} {error} class={klass}>
|
|
79
79
|
<div class="flex flex-col gap-2">
|
|
@@ -103,7 +103,7 @@ async function handleBlur() {
|
|
|
103
103
|
</div>
|
|
104
104
|
{/if}
|
|
105
105
|
<div class="flex grow gap-2">
|
|
106
|
-
<div class="
|
|
106
|
+
<div class="input input-bordered flex grow items-center pr-2">
|
|
107
107
|
<input
|
|
108
108
|
type="text"
|
|
109
109
|
id={key}
|
|
@@ -115,7 +115,7 @@ async function handleBlur() {
|
|
|
115
115
|
on:blur={handleBlur}
|
|
116
116
|
autocomplete="off"
|
|
117
117
|
{placeholder}
|
|
118
|
-
class="
|
|
118
|
+
class="grow"
|
|
119
119
|
/>
|
|
120
120
|
|
|
121
121
|
<RelationAfter {isLoading} {createUrl} {createTitle} />
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
<script>import { fade } from "svelte/transition";
|
|
2
2
|
import { createEventDispatcher } from "svelte";
|
|
3
|
-
import {
|
|
3
|
+
import { mdiLoading, mdiPlus } from "@mdi/js";
|
|
4
4
|
import Icon from "../Icon.svelte";
|
|
5
5
|
export let isLoading;
|
|
6
|
-
export let isUnselectable = false;
|
|
7
6
|
export let createUrl = "";
|
|
8
7
|
export let createTitle = "";
|
|
9
8
|
const dispatch = createEventDispatcher();
|
|
10
9
|
</script>
|
|
11
10
|
|
|
12
11
|
{#if isLoading}
|
|
13
|
-
<div class
|
|
12
|
+
<div class:right-10={createUrl} transition:fade|local>
|
|
14
13
|
<Icon
|
|
15
14
|
path={mdiLoading}
|
|
16
15
|
class="w-9"
|
|
@@ -19,24 +18,8 @@ const dispatch = createEventDispatcher();
|
|
|
19
18
|
</div>
|
|
20
19
|
{/if}
|
|
21
20
|
|
|
22
|
-
{#if isUnselectable}
|
|
23
|
-
<div class="ml-[4px] hidden -translate-x-[2px] group-hover:block">
|
|
24
|
-
<Icon
|
|
25
|
-
path={mdiClose}
|
|
26
|
-
on:click={() => dispatch('unselect')}
|
|
27
|
-
title="Supprimer la sélection"
|
|
28
|
-
class="outline-primary-light outline outline-2 hover:bg-primary"
|
|
29
|
-
/>
|
|
30
|
-
</div>
|
|
31
|
-
{/if}
|
|
32
|
-
|
|
33
21
|
{#if createUrl}
|
|
34
|
-
<
|
|
35
|
-
<Icon
|
|
36
|
-
|
|
37
|
-
on:click={() => dispatch('create')}
|
|
38
|
-
title={createTitle}
|
|
39
|
-
class="btn btn-square"
|
|
40
|
-
/>
|
|
41
|
-
</div>
|
|
22
|
+
<a href={createUrl} class="btn btn-square btn-sm">
|
|
23
|
+
<Icon path={mdiPlus} on:click={() => dispatch('create')} title={createTitle} />
|
|
24
|
+
</a>
|
|
42
25
|
{/if}
|
|
@@ -26,6 +26,7 @@ export let hideOnNav = true;
|
|
|
26
26
|
export let tip = void 0;
|
|
27
27
|
export let disable = false;
|
|
28
28
|
export let content = void 0;
|
|
29
|
+
export let isWidthOfActivator = false;
|
|
29
30
|
let activator;
|
|
30
31
|
beforeNavigate(() => hideOnNav && hide());
|
|
31
32
|
onMount(() => {
|
|
@@ -47,6 +48,7 @@ onMount(() => {
|
|
|
47
48
|
interactive: true,
|
|
48
49
|
interactiveDebounce: 50,
|
|
49
50
|
appendTo: "parent",
|
|
51
|
+
hideOnClick: false,
|
|
50
52
|
onShown() {
|
|
51
53
|
if (autofocus)
|
|
52
54
|
focusables[0]?.select();
|
|
@@ -93,6 +95,7 @@ export function setTippyProps(props) {
|
|
|
93
95
|
|
|
94
96
|
<div class="hidden">
|
|
95
97
|
<div
|
|
98
|
+
style={isWidthOfActivator ? `width: ${activator?.offsetWidth}px;` : ''}
|
|
96
99
|
class="{klass} max-h-80 overflow-auto rounded-lg border bg-base-100 p-1 shadow-lg"
|
|
97
100
|
bind:this={content}
|
|
98
101
|
>
|
|
@@ -15,6 +15,7 @@ declare const __propDef: {
|
|
|
15
15
|
tip?: TippyInstance | undefined;
|
|
16
16
|
disable?: boolean | undefined;
|
|
17
17
|
content?: HTMLDivElement | undefined;
|
|
18
|
+
isWidthOfActivator?: boolean | undefined;
|
|
18
19
|
hide?: (() => void) | undefined;
|
|
19
20
|
show?: (() => void) | undefined;
|
|
20
21
|
setTippyProps?: ((props: Partial<TippyProps>) => void) | undefined;
|
package/dist/validation/form.js
CHANGED
|
@@ -30,6 +30,10 @@ export function useForm({ onSubmit, onSuccess, onResetError, onError, onFail, su
|
|
|
30
30
|
}
|
|
31
31
|
setError[key](issue.message);
|
|
32
32
|
});
|
|
33
|
+
const issuesKeys = issues
|
|
34
|
+
.map(({ path }) => path[0])
|
|
35
|
+
.filter((k, i, self) => self.indexOf(k) === i);
|
|
36
|
+
toast.warning('Invalid form', { description: issuesKeys.join(', ') });
|
|
33
37
|
}
|
|
34
38
|
if (message) {
|
|
35
39
|
toast.warning(message);
|