fuma 0.0.1
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/README.md +58 -0
- package/dist/Meta.svelte +55 -0
- package/dist/Meta.svelte.d.ts +20 -0
- package/dist/action/index.d.ts +4 -0
- package/dist/action/index.js +4 -0
- package/dist/action/list/handlers.d.ts +16 -0
- package/dist/action/list/handlers.js +92 -0
- package/dist/action/list/index.css +40 -0
- package/dist/action/list/index.d.ts +23 -0
- package/dist/action/list/index.js +44 -0
- package/dist/action/list/store.d.ts +3 -0
- package/dist/action/list/store.js +1 -0
- package/dist/action/list/style.d.ts +2 -0
- package/dist/action/list/style.js +14 -0
- package/dist/action/list/trigger.d.ts +12 -0
- package/dist/action/list/trigger.js +124 -0
- package/dist/action/list/utils.d.ts +18 -0
- package/dist/action/list/utils.js +68 -0
- package/dist/action/portal.d.ts +3 -0
- package/dist/action/portal.js +9 -0
- package/dist/action/selector.d.ts +15 -0
- package/dist/action/selector.js +71 -0
- package/dist/action/tip.d.ts +6 -0
- package/dist/action/tip.js +12 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +5 -0
- package/dist/server/json.d.ts +1 -0
- package/dist/server/json.js +16 -0
- package/dist/server/parseFormData.d.ts +20 -0
- package/dist/server/parseFormData.js +63 -0
- package/dist/server/parseQuery.d.ts +11 -0
- package/dist/server/parseQuery.js +15 -0
- package/dist/server/sse.d.ts +6 -0
- package/dist/server/sse.js +35 -0
- package/dist/server/try.d.ts +6 -0
- package/dist/server/try.js +31 -0
- package/dist/store/index.d.ts +2 -0
- package/dist/store/index.js +2 -0
- package/dist/store/isSmallScreen.d.ts +2 -0
- package/dist/store/isSmallScreen.js +14 -0
- package/dist/store/param.d.ts +24 -0
- package/dist/store/param.js +61 -0
- package/dist/store/session.d.ts +2 -0
- package/dist/store/session.js +13 -0
- package/dist/ui/ButtonCopy.svelte +18 -0
- package/dist/ui/ButtonCopy.svelte.d.ts +18 -0
- package/dist/ui/ButtonDelete.svelte +43 -0
- package/dist/ui/ButtonDelete.svelte.d.ts +22 -0
- package/dist/ui/Dialog.svelte +58 -0
- package/dist/ui/Dialog.svelte.d.ts +25 -0
- package/dist/ui/DialogConfirm.svelte +22 -0
- package/dist/ui/DialogConfirm.svelte.d.ts +21 -0
- package/dist/ui/Icon.svelte +46 -0
- package/dist/ui/Icon.svelte.d.ts +24 -0
- package/dist/ui/Pagination.svelte +28 -0
- package/dist/ui/Pagination.svelte.d.ts +16 -0
- package/dist/ui/Placeholder.svelte +11 -0
- package/dist/ui/Placeholder.svelte.d.ts +19 -0
- package/dist/ui/PlaceholderImage.svelte +14 -0
- package/dist/ui/PlaceholderImage.svelte.d.ts +19 -0
- package/dist/ui/card/Card.svelte +38 -0
- package/dist/ui/card/Card.svelte.d.ts +26 -0
- package/dist/ui/card/CardBasic.svelte +14 -0
- package/dist/ui/card/CardBasic.svelte.d.ts +20 -0
- package/dist/ui/card/CardCollapse.svelte +61 -0
- package/dist/ui/card/CardCollapse.svelte.d.ts +22 -0
- package/dist/ui/card/CardFullScreen.svelte +28 -0
- package/dist/ui/card/CardFullScreen.svelte.d.ts +23 -0
- package/dist/ui/card/CardLink.svelte +21 -0
- package/dist/ui/card/CardLink.svelte.d.ts +20 -0
- package/dist/ui/card/index.d.ts +5 -0
- package/dist/ui/card/index.js +5 -0
- package/dist/ui/index.d.ts +14 -0
- package/dist/ui/index.js +14 -0
- package/dist/ui/input/FormControl.svelte +53 -0
- package/dist/ui/input/FormControl.svelte.d.ts +30 -0
- package/dist/ui/input/InputBoolean.svelte +29 -0
- package/dist/ui/input/InputBoolean.svelte.d.ts +21 -0
- package/dist/ui/input/InputCheckboxs.svelte +68 -0
- package/dist/ui/input/InputCheckboxs.svelte.d.ts +41 -0
- package/dist/ui/input/InputCheckboxsMenu.svelte +93 -0
- package/dist/ui/input/InputCheckboxsMenu.svelte.d.ts +43 -0
- package/dist/ui/input/InputCheckboxsTree.svelte +15 -0
- package/dist/ui/input/InputCheckboxsTree.svelte.d.ts +21 -0
- package/dist/ui/input/InputCheckboxsTreeNodes.svelte +60 -0
- package/dist/ui/input/InputCheckboxsTreeNodes.svelte.d.ts +23 -0
- package/dist/ui/input/InputDate.svelte +26 -0
- package/dist/ui/input/InputDate.svelte.d.ts +19 -0
- package/dist/ui/input/InputDatetime.svelte +21 -0
- package/dist/ui/input/InputDatetime.svelte.d.ts +19 -0
- package/dist/ui/input/InputImage.svelte +107 -0
- package/dist/ui/input/InputImage.svelte.d.ts +35 -0
- package/dist/ui/input/InputImagePreview.svelte +56 -0
- package/dist/ui/input/InputImagePreview.svelte.d.ts +23 -0
- package/dist/ui/input/InputNumber.svelte +22 -0
- package/dist/ui/input/InputNumber.svelte.d.ts +23 -0
- package/dist/ui/input/InputOptionInParam.svelte +34 -0
- package/dist/ui/input/InputOptionInParam.svelte.d.ts +20 -0
- package/dist/ui/input/InputOptions.svelte +79 -0
- package/dist/ui/input/InputOptions.svelte.d.ts +17 -0
- package/dist/ui/input/InputPassword.svelte +21 -0
- package/dist/ui/input/InputPassword.svelte.d.ts +36 -0
- package/dist/ui/input/InputRadio.svelte +79 -0
- package/dist/ui/input/InputRadio.svelte.d.ts +40 -0
- package/dist/ui/input/InputRelation.svelte +114 -0
- package/dist/ui/input/InputRelation.svelte.d.ts +52 -0
- package/dist/ui/input/InputRelations.svelte +138 -0
- package/dist/ui/input/InputRelations.svelte.d.ts +49 -0
- package/dist/ui/input/InputSearch.svelte +43 -0
- package/dist/ui/input/InputSearch.svelte.d.ts +23 -0
- package/dist/ui/input/InputSelect.svelte +59 -0
- package/dist/ui/input/InputSelect.svelte.d.ts +26 -0
- package/dist/ui/input/InputText.svelte +32 -0
- package/dist/ui/input/InputText.svelte.d.ts +31 -0
- package/dist/ui/input/InputTextarea.svelte +20 -0
- package/dist/ui/input/InputTextarea.svelte.d.ts +23 -0
- package/dist/ui/input/InputTime.svelte +19 -0
- package/dist/ui/input/InputTime.svelte.d.ts +19 -0
- package/dist/ui/input/RelationAfter.svelte +42 -0
- package/dist/ui/input/RelationAfter.svelte.d.ts +22 -0
- package/dist/ui/input/SelectorList.svelte +46 -0
- package/dist/ui/input/SelectorList.svelte.d.ts +40 -0
- package/dist/ui/input/action.d.ts +13 -0
- package/dist/ui/input/action.js +56 -0
- package/dist/ui/input/index.d.ts +25 -0
- package/dist/ui/input/index.js +25 -0
- package/dist/ui/input/textRich/InputTextRich.svelte +58 -0
- package/dist/ui/input/textRich/InputTextRich.svelte.d.ts +20 -0
- package/dist/ui/input/textRich/SuggesionList.svelte +21 -0
- package/dist/ui/input/textRich/SuggesionList.svelte.d.ts +19 -0
- package/dist/ui/input/textRich/ToolMark.svelte +19 -0
- package/dist/ui/input/textRich/ToolMark.svelte.d.ts +21 -0
- package/dist/ui/input/textRich/ToolMarkColor.svelte +32 -0
- package/dist/ui/input/textRich/ToolMarkColor.svelte.d.ts +19 -0
- package/dist/ui/input/textRich/ToolMarkLink.svelte +63 -0
- package/dist/ui/input/textRich/ToolMarkLink.svelte.d.ts +17 -0
- package/dist/ui/input/textRich/ToolMenu.svelte +50 -0
- package/dist/ui/input/textRich/ToolMenu.svelte.d.ts +29 -0
- package/dist/ui/input/textRich/ToolMenuAlign.svelte +46 -0
- package/dist/ui/input/textRich/ToolMenuAlign.svelte.d.ts +17 -0
- package/dist/ui/input/textRich/ToolMenuInsert.svelte +49 -0
- package/dist/ui/input/textRich/ToolMenuInsert.svelte.d.ts +19 -0
- package/dist/ui/input/textRich/ToolMenuNode.svelte +56 -0
- package/dist/ui/input/textRich/ToolMenuNode.svelte.d.ts +17 -0
- package/dist/ui/input/textRich/ToolsBar.svelte +60 -0
- package/dist/ui/input/textRich/ToolsBar.svelte.d.ts +18 -0
- package/dist/ui/input/textRich/extensions.d.ts +2 -0
- package/dist/ui/input/textRich/extensions.js +62 -0
- package/dist/ui/input/textRich/indent.d.ts +13 -0
- package/dist/ui/input/textRich/indent.js +112 -0
- package/dist/ui/input/textRich/suggestion.d.ts +9 -0
- package/dist/ui/input/textRich/suggestion.js +56 -0
- package/dist/ui/input/types.d.ts +15 -0
- package/dist/ui/input/types.js +1 -0
- package/dist/ui/menu/ContextMenu.svelte +47 -0
- package/dist/ui/menu/ContextMenu.svelte.d.ts +28 -0
- package/dist/ui/menu/DropDown.svelte +110 -0
- package/dist/ui/menu/DropDown.svelte.d.ts +38 -0
- package/dist/ui/menu/dropdown.css +33 -0
- package/dist/ui/menu/index.d.ts +2 -0
- package/dist/ui/menu/index.js +2 -0
- package/dist/ui/period/PeriodPicker.svelte +53 -0
- package/dist/ui/period/PeriodPicker.svelte.d.ts +22 -0
- package/dist/ui/period/PeriodPickerButton.svelte +73 -0
- package/dist/ui/period/PeriodPickerButton.svelte.d.ts +14 -0
- package/dist/ui/period/index.d.ts +6 -0
- package/dist/ui/period/index.js +2 -0
- package/dist/ui/table/Table.svelte +42 -0
- package/dist/ui/table/Table.svelte.d.ts +39 -0
- package/dist/ui/table/TableBody.svelte +29 -0
- package/dist/ui/table/TableBody.svelte.d.ts +33 -0
- package/dist/ui/table/TableCell.svelte +27 -0
- package/dist/ui/table/TableCell.svelte.d.ts +28 -0
- package/dist/ui/table/TableFieldsEdition.svelte +122 -0
- package/dist/ui/table/TableFieldsEdition.svelte.d.ts +31 -0
- package/dist/ui/table/TableHead.svelte +31 -0
- package/dist/ui/table/TableHead.svelte.d.ts +29 -0
- package/dist/ui/table/TableViewSelect.svelte +127 -0
- package/dist/ui/table/TableViewSelect.svelte.d.ts +24 -0
- package/dist/ui/table/cell/TableCellArray.svelte +10 -0
- package/dist/ui/table/cell/TableCellArray.svelte.d.ts +16 -0
- package/dist/ui/table/cell/TableCellBoolean.svelte +12 -0
- package/dist/ui/table/cell/TableCellBoolean.svelte.d.ts +16 -0
- package/dist/ui/table/cell/TableCellNumber.svelte +6 -0
- package/dist/ui/table/cell/TableCellNumber.svelte.d.ts +16 -0
- package/dist/ui/table/cell/TableCellString.svelte +7 -0
- package/dist/ui/table/cell/TableCellString.svelte.d.ts +18 -0
- package/dist/ui/table/cell/index.d.ts +4 -0
- package/dist/ui/table/cell/index.js +4 -0
- package/dist/ui/table/context.d.ts +14 -0
- package/dist/ui/table/context.js +10 -0
- package/dist/ui/table/field.d.ts +79 -0
- package/dist/ui/table/field.js +29 -0
- package/dist/ui/table/head/TableHeadBoolean.svelte +12 -0
- package/dist/ui/table/head/TableHeadBoolean.svelte.d.ts +17 -0
- package/dist/ui/table/head/TableHeadDate.svelte +100 -0
- package/dist/ui/table/head/TableHeadDate.svelte.d.ts +17 -0
- package/dist/ui/table/head/TableHeadDefault.svelte +7 -0
- package/dist/ui/table/head/TableHeadDefault.svelte.d.ts +17 -0
- package/dist/ui/table/head/TableHeadNumber.svelte +80 -0
- package/dist/ui/table/head/TableHeadNumber.svelte.d.ts +17 -0
- package/dist/ui/table/head/TableHeadSelect.svelte +75 -0
- package/dist/ui/table/head/TableHeadSelect.svelte.d.ts +20 -0
- package/dist/ui/table/head/TableHeadString.svelte +35 -0
- package/dist/ui/table/head/TableHeadString.svelte.d.ts +17 -0
- package/dist/ui/table/head/index.d.ts +19 -0
- package/dist/ui/table/head/index.js +22 -0
- package/dist/ui/table/index.d.ts +10 -0
- package/dist/ui/table/index.js +10 -0
- package/dist/ui/table/server.d.ts +1 -0
- package/dist/ui/table/server.js +32 -0
- package/dist/ui/tabs/Tabs.svelte +28 -0
- package/dist/ui/tabs/Tabs.svelte.d.ts +18 -0
- package/dist/ui/tabs/TabsIcon.svelte +56 -0
- package/dist/ui/tabs/TabsIcon.svelte.d.ts +20 -0
- package/dist/ui/tabs/index.d.ts +8 -0
- package/dist/ui/tabs/index.js +2 -0
- package/dist/utils/avatar.d.ts +1 -0
- package/dist/utils/avatar.js +5 -0
- package/dist/utils/component.d.ts +7 -0
- package/dist/utils/component.js +3 -0
- package/dist/utils/formatRange.d.ts +8 -0
- package/dist/utils/formatRange.js +25 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/jsonParse.d.ts +1 -0
- package/dist/utils/jsonParse.js +10 -0
- package/dist/utils/normalizePath.d.ts +1 -0
- package/dist/utils/normalizePath.js +11 -0
- package/dist/utils/options.d.ts +7 -0
- package/dist/utils/options.js +20 -0
- package/dist/utils/tippy.d.ts +5 -0
- package/dist/utils/tippy.js +4 -0
- package/dist/validation/form.d.ts +31 -0
- package/dist/validation/form.js +94 -0
- package/dist/validation/index.d.ts +2 -0
- package/dist/validation/index.js +2 -0
- package/dist/validation/zod.d.ts +338 -0
- package/dist/validation/zod.js +100 -0
- package/package.json +86 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<script>import { createEventDispatcher, tick } from "svelte";
|
|
2
|
+
import { slide } from "svelte/transition";
|
|
3
|
+
import { toast } from "svelte-sonner";
|
|
4
|
+
import { mdiClose } from "@mdi/js";
|
|
5
|
+
import debounce from "debounce";
|
|
6
|
+
import { FormControl, Icon, DropDown, SelectorList } from "../index.js";
|
|
7
|
+
import RelationAfter from "./RelationAfter.svelte";
|
|
8
|
+
export let key = "";
|
|
9
|
+
export let label = "";
|
|
10
|
+
export let search;
|
|
11
|
+
export let createUrl = "";
|
|
12
|
+
export let createTitle = "";
|
|
13
|
+
export let error = "";
|
|
14
|
+
export let placeholder = "";
|
|
15
|
+
export let flatMode = false;
|
|
16
|
+
let klass = "";
|
|
17
|
+
export { klass as class };
|
|
18
|
+
export let classList = "";
|
|
19
|
+
let proposedItems = [];
|
|
20
|
+
export let items = null;
|
|
21
|
+
let isLoading = false;
|
|
22
|
+
let isError = false;
|
|
23
|
+
let focusIndex = 0;
|
|
24
|
+
let searchValue = "";
|
|
25
|
+
let dropdown;
|
|
26
|
+
const dispatch = createEventDispatcher();
|
|
27
|
+
let inputSearch;
|
|
28
|
+
async function select(index = focusIndex) {
|
|
29
|
+
const proposedItem = proposedItems[index];
|
|
30
|
+
if (!proposedItem)
|
|
31
|
+
return;
|
|
32
|
+
if (!items)
|
|
33
|
+
items = [proposedItem];
|
|
34
|
+
else
|
|
35
|
+
items = [...items, proposedItem];
|
|
36
|
+
dropdown.hide();
|
|
37
|
+
inputSearch.select();
|
|
38
|
+
proposedItems = [...proposedItems.slice(0, index), ...proposedItems.slice(index + 1)];
|
|
39
|
+
dispatch("input", { value: items.map(({ id }) => id), items });
|
|
40
|
+
await tick();
|
|
41
|
+
setTimeout(() => dropdown.show(), 200);
|
|
42
|
+
}
|
|
43
|
+
function remove(index) {
|
|
44
|
+
if (!items?.length)
|
|
45
|
+
return;
|
|
46
|
+
items = [...items.slice(0, index), ...items.slice(index + 1)];
|
|
47
|
+
}
|
|
48
|
+
async function searchItems(searchValue2 = "") {
|
|
49
|
+
try {
|
|
50
|
+
isLoading = true;
|
|
51
|
+
isError = false;
|
|
52
|
+
focusIndex = 0;
|
|
53
|
+
const res = await search(searchValue2);
|
|
54
|
+
const currentIds = items?.map(({ id }) => id) || [];
|
|
55
|
+
proposedItems = res.filter(({ id }) => !currentIds.includes(id));
|
|
56
|
+
} catch (error2) {
|
|
57
|
+
toast.error("Erreur");
|
|
58
|
+
isError = true;
|
|
59
|
+
console.error(error2);
|
|
60
|
+
} finally {
|
|
61
|
+
isLoading = false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const searchItemsDebounce = debounce(searchItems, 150);
|
|
65
|
+
function handleFocus() {
|
|
66
|
+
searchItems();
|
|
67
|
+
}
|
|
68
|
+
async function handleBlur() {
|
|
69
|
+
searchValue = "";
|
|
70
|
+
}
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<DropDown bind:this={dropdown} disable={flatMode}>
|
|
74
|
+
<div slot="activator">
|
|
75
|
+
<FormControl {key} {label} {error} class={klass}>
|
|
76
|
+
<div class="flex flex-col gap-2">
|
|
77
|
+
{#if items && items.length}
|
|
78
|
+
<div class="flex flex-wrap gap-2">
|
|
79
|
+
{#each items || [] as item, index (item.id)}
|
|
80
|
+
<div
|
|
81
|
+
transition:slide|local={{ axis: 'x', duration: 200 }}
|
|
82
|
+
class="badge badge-outline badge-lg items-center whitespace-nowrap pr-0 text-right"
|
|
83
|
+
>
|
|
84
|
+
<slot {item} name="badge">{item.id}</slot>
|
|
85
|
+
<div
|
|
86
|
+
class="btn btn-circle btn-ghost btn-xs ml-1 mr-[2px] h-[18px] min-h-[18px] w-[18px]"
|
|
87
|
+
role="button"
|
|
88
|
+
tabindex="0"
|
|
89
|
+
on:click={() => remove(index)}
|
|
90
|
+
on:keyup={(event) => event.key === 'Enter' && remove(index)}
|
|
91
|
+
>
|
|
92
|
+
<Icon path={mdiClose} size={16} />
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
{/each}
|
|
96
|
+
</div>
|
|
97
|
+
{/if}
|
|
98
|
+
<div class="flex grow gap-2">
|
|
99
|
+
<div class="relative flex grow items-center gap-2">
|
|
100
|
+
<input
|
|
101
|
+
type="text"
|
|
102
|
+
id={key}
|
|
103
|
+
name={key}
|
|
104
|
+
bind:this={inputSearch}
|
|
105
|
+
bind:value={searchValue}
|
|
106
|
+
on:input={(e) => searchItemsDebounce(e.currentTarget.value)}
|
|
107
|
+
on:focus={handleFocus}
|
|
108
|
+
on:blur={handleBlur}
|
|
109
|
+
autocomplete="off"
|
|
110
|
+
{placeholder}
|
|
111
|
+
class="input input-bordered grow"
|
|
112
|
+
/>
|
|
113
|
+
|
|
114
|
+
<RelationAfter {isLoading} {createUrl} {createTitle} />
|
|
115
|
+
</div>
|
|
116
|
+
<slot name="append" />
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
<input type="hidden" name={key} value={JSON.stringify(items?.map(({ id }) => id) || [])} />
|
|
121
|
+
</FormControl>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
<SelectorList
|
|
125
|
+
trigger={inputSearch}
|
|
126
|
+
items={proposedItems}
|
|
127
|
+
{isError}
|
|
128
|
+
{isLoading}
|
|
129
|
+
{focusIndex}
|
|
130
|
+
let:index
|
|
131
|
+
class="w-full {classList}"
|
|
132
|
+
on:select={({ detail }) => select(detail)}
|
|
133
|
+
>
|
|
134
|
+
<slot name="listItem" item={proposedItems[index]}>
|
|
135
|
+
{proposedItems[index].id}
|
|
136
|
+
</slot>
|
|
137
|
+
</SelectorList>
|
|
138
|
+
</DropDown>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare class __sveltets_Render<RelationItem extends {
|
|
3
|
+
id: string;
|
|
4
|
+
}> {
|
|
5
|
+
props(): {
|
|
6
|
+
key?: string | undefined;
|
|
7
|
+
label?: string | undefined;
|
|
8
|
+
search: (q: string) => Promise<RelationItem[]>;
|
|
9
|
+
createUrl?: string | undefined;
|
|
10
|
+
createTitle?: string | undefined;
|
|
11
|
+
error?: string | undefined;
|
|
12
|
+
placeholder?: string | undefined;
|
|
13
|
+
flatMode?: boolean | undefined;
|
|
14
|
+
class?: string | undefined;
|
|
15
|
+
classList?: string | undefined;
|
|
16
|
+
items?: RelationItem[] | null | undefined;
|
|
17
|
+
};
|
|
18
|
+
events(): {
|
|
19
|
+
input: CustomEvent<{
|
|
20
|
+
value: string[];
|
|
21
|
+
items: RelationItem[];
|
|
22
|
+
}>;
|
|
23
|
+
} & {
|
|
24
|
+
[evt: string]: CustomEvent<any>;
|
|
25
|
+
};
|
|
26
|
+
slots(): {
|
|
27
|
+
badge: {
|
|
28
|
+
item: RelationItem;
|
|
29
|
+
};
|
|
30
|
+
append: {};
|
|
31
|
+
listItem: {
|
|
32
|
+
item: RelationItem;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export type InputRelationsProps<RelationItem extends {
|
|
37
|
+
id: string;
|
|
38
|
+
}> = ReturnType<__sveltets_Render<RelationItem>['props']>;
|
|
39
|
+
export type InputRelationsEvents<RelationItem extends {
|
|
40
|
+
id: string;
|
|
41
|
+
}> = ReturnType<__sveltets_Render<RelationItem>['events']>;
|
|
42
|
+
export type InputRelationsSlots<RelationItem extends {
|
|
43
|
+
id: string;
|
|
44
|
+
}> = ReturnType<__sveltets_Render<RelationItem>['slots']>;
|
|
45
|
+
export default class InputRelations<RelationItem extends {
|
|
46
|
+
id: string;
|
|
47
|
+
}> extends SvelteComponent<InputRelationsProps<RelationItem>, InputRelationsEvents<RelationItem>, InputRelationsSlots<RelationItem>> {
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script>import { mdiClose } from "@mdi/js";
|
|
2
|
+
import { browser } from "$app/environment";
|
|
3
|
+
import { page } from "$app/stores";
|
|
4
|
+
import { Icon, InputText } from "../index.js";
|
|
5
|
+
let klass = "";
|
|
6
|
+
export { klass as class };
|
|
7
|
+
export let key = "search";
|
|
8
|
+
export let value = $page.url.searchParams.get(key) || "";
|
|
9
|
+
let inputElement;
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<InputText
|
|
13
|
+
{key}
|
|
14
|
+
bind:inputElement
|
|
15
|
+
bind:value
|
|
16
|
+
on:blur
|
|
17
|
+
on:blur
|
|
18
|
+
on:input
|
|
19
|
+
on:keydown
|
|
20
|
+
on:keyup
|
|
21
|
+
bindWithParams
|
|
22
|
+
input={{
|
|
23
|
+
class: 'input-sm pr-8',
|
|
24
|
+
placeholder: 'Recherche',
|
|
25
|
+
autocomplete: 'fuck-off',
|
|
26
|
+
inputmode: 'search'
|
|
27
|
+
}}
|
|
28
|
+
wrapperClass="relative {klass}"
|
|
29
|
+
>
|
|
30
|
+
<button
|
|
31
|
+
slot="append"
|
|
32
|
+
class="btn btn-square btn-sm absolute right-0"
|
|
33
|
+
class:hidden={!browser}
|
|
34
|
+
style:scale={!!value ? 0.75 : 0}
|
|
35
|
+
on:click={() => {
|
|
36
|
+
value = ''
|
|
37
|
+
inputElement.dispatchEvent(new Event('input', { bubbles: true }))
|
|
38
|
+
}}
|
|
39
|
+
tabindex={!!value ? 0 : -1}
|
|
40
|
+
>
|
|
41
|
+
<Icon path={mdiClose} />
|
|
42
|
+
</button>
|
|
43
|
+
</InputText>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
class?: string | undefined;
|
|
5
|
+
key?: string | undefined;
|
|
6
|
+
value?: string | undefined;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
blur: FocusEvent;
|
|
10
|
+
input: Event;
|
|
11
|
+
keydown: KeyboardEvent;
|
|
12
|
+
keyup: KeyboardEvent;
|
|
13
|
+
} & {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {};
|
|
17
|
+
};
|
|
18
|
+
export type InputSearchProps = typeof __propDef.props;
|
|
19
|
+
export type InputSearchEvents = typeof __propDef.events;
|
|
20
|
+
export type InputSearchSlots = typeof __propDef.slots;
|
|
21
|
+
export default class InputSearch extends SvelteComponent<InputSearchProps, InputSearchEvents, InputSearchSlots> {
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script>import { createEventDispatcher, onMount } from "svelte";
|
|
2
|
+
import { SelectorList, DropDown, Icon } from "../index.js";
|
|
3
|
+
import { parseOptions } from "../../utils/options.js";
|
|
4
|
+
export let key = "";
|
|
5
|
+
export let value = "";
|
|
6
|
+
export let options;
|
|
7
|
+
export let noBtnClass = false;
|
|
8
|
+
let klass = "";
|
|
9
|
+
export { klass as class };
|
|
10
|
+
$:
|
|
11
|
+
_options = parseOptions(options);
|
|
12
|
+
$:
|
|
13
|
+
selectedOption = _options.find((opt) => opt.value === value);
|
|
14
|
+
let dropDown;
|
|
15
|
+
let button;
|
|
16
|
+
const dispatch = createEventDispatcher();
|
|
17
|
+
let focusIndex = 0;
|
|
18
|
+
onMount(() => {
|
|
19
|
+
const index = _options.findIndex((opt) => opt.value === value);
|
|
20
|
+
focusIndex = index === -1 ? 0 : index;
|
|
21
|
+
});
|
|
22
|
+
function onSelect(index) {
|
|
23
|
+
focusIndex = index;
|
|
24
|
+
value = _options[index].value;
|
|
25
|
+
dispatch("select", value);
|
|
26
|
+
dropDown.hide();
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<input type="hidden" name={key} {value} />
|
|
31
|
+
|
|
32
|
+
<DropDown bind:this={dropDown}>
|
|
33
|
+
<button bind:this={button} slot="activator" type="button" class:btn={!noBtnClass} class={klass}>
|
|
34
|
+
<slot name="btn">
|
|
35
|
+
{#if selectedOption}
|
|
36
|
+
{#if selectedOption.icon}
|
|
37
|
+
<Icon path={selectedOption.icon} size={21} class="opacity-70" />
|
|
38
|
+
{/if}
|
|
39
|
+
<span>{selectedOption.label}</span>
|
|
40
|
+
{:else}
|
|
41
|
+
<slot name="placeholder">Sélection</slot>
|
|
42
|
+
{/if}
|
|
43
|
+
</slot>
|
|
44
|
+
</button>
|
|
45
|
+
|
|
46
|
+
<SelectorList
|
|
47
|
+
trigger={button}
|
|
48
|
+
{focusIndex}
|
|
49
|
+
items={_options.map((opt) => ({ id: opt.value, ...opt }))}
|
|
50
|
+
let:item
|
|
51
|
+
on:select={({ detail }) => onSelect(detail)}
|
|
52
|
+
class="w-full"
|
|
53
|
+
>
|
|
54
|
+
{#if item.icon}
|
|
55
|
+
<Icon path={item.icon} size={21} class="opacity-70" />
|
|
56
|
+
{/if}
|
|
57
|
+
<span class="whitespace-nowrap">{item.label}</span>
|
|
58
|
+
</SelectorList>
|
|
59
|
+
</DropDown>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type Options } from '../../utils/options.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
key?: string | undefined;
|
|
6
|
+
value?: string | undefined;
|
|
7
|
+
options: Options;
|
|
8
|
+
noBtnClass?: boolean | undefined;
|
|
9
|
+
class?: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
select: CustomEvent<string>;
|
|
13
|
+
} & {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {
|
|
17
|
+
btn: {};
|
|
18
|
+
placeholder: {};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type InputSelectProps = typeof __propDef.props;
|
|
22
|
+
export type InputSelectEvents = typeof __propDef.events;
|
|
23
|
+
export type InputSelectSlots = typeof __propDef.slots;
|
|
24
|
+
export default class InputSelect extends SvelteComponent<InputSelectProps, InputSelectEvents, InputSelectSlots> {
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script>import { FormControl, bindValueWithParams } from "./index.js";
|
|
2
|
+
$:
|
|
3
|
+
({ input, value: _value, wrapperClass, bindWithParams, ...props } = $$props);
|
|
4
|
+
export let value = _value;
|
|
5
|
+
export let inputElement = void 0;
|
|
6
|
+
$:
|
|
7
|
+
({ class: inputClass, ...inputProps } = input || {});
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<FormControl {...props} enhanceDisabled={props.enhanceDisabled || bindWithParams} let:key>
|
|
11
|
+
<slot name="label_append" slot="label_append" />
|
|
12
|
+
|
|
13
|
+
<div class={wrapperClass}>
|
|
14
|
+
<slot name="prepend" {value} />
|
|
15
|
+
<input
|
|
16
|
+
bind:value
|
|
17
|
+
on:input
|
|
18
|
+
on:focus
|
|
19
|
+
on:blur
|
|
20
|
+
on:keydown
|
|
21
|
+
on:keyup
|
|
22
|
+
bind:this={inputElement}
|
|
23
|
+
use:bindValueWithParams={{ bindEnable: bindWithParams, initValue: (v) => (value = v) }}
|
|
24
|
+
type="text"
|
|
25
|
+
name={key}
|
|
26
|
+
id={key}
|
|
27
|
+
class="input input-bordered w-full {inputClass || ''}"
|
|
28
|
+
{...inputProps}
|
|
29
|
+
/>
|
|
30
|
+
<slot name="append" {value} />
|
|
31
|
+
</div>
|
|
32
|
+
</FormControl>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type InputProps } from './index.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: InputProps;
|
|
5
|
+
events: {
|
|
6
|
+
input: Event;
|
|
7
|
+
focus: FocusEvent;
|
|
8
|
+
blur: FocusEvent;
|
|
9
|
+
keydown: KeyboardEvent;
|
|
10
|
+
keyup: KeyboardEvent;
|
|
11
|
+
} & {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
};
|
|
14
|
+
slots: {
|
|
15
|
+
label_append: {
|
|
16
|
+
slot: string;
|
|
17
|
+
};
|
|
18
|
+
prepend: {
|
|
19
|
+
value: string | undefined;
|
|
20
|
+
};
|
|
21
|
+
append: {
|
|
22
|
+
value: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export type InputTextProps = typeof __propDef.props;
|
|
27
|
+
export type InputTextEvents = typeof __propDef.events;
|
|
28
|
+
export type InputTextSlots = typeof __propDef.slots;
|
|
29
|
+
export default class InputText extends SvelteComponent<InputTextProps, InputTextEvents, InputTextSlots> {
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script>import { FormControl } from "./index.js";
|
|
2
|
+
$:
|
|
3
|
+
({ textarea, value: _value, ...props } = $$props);
|
|
4
|
+
export let value = _value;
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<FormControl {...props} let:key>
|
|
8
|
+
<slot name="label_append" slot="label_append" />
|
|
9
|
+
<textarea
|
|
10
|
+
bind:value
|
|
11
|
+
on:input
|
|
12
|
+
on:focus
|
|
13
|
+
on:blur
|
|
14
|
+
name={key}
|
|
15
|
+
id={key}
|
|
16
|
+
class="textarea textarea-bordered"
|
|
17
|
+
rows="4"
|
|
18
|
+
{...textarea}
|
|
19
|
+
/>
|
|
20
|
+
</FormControl>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type TextareaProps } from './index.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: TextareaProps;
|
|
5
|
+
events: {
|
|
6
|
+
input: Event;
|
|
7
|
+
focus: FocusEvent;
|
|
8
|
+
blur: FocusEvent;
|
|
9
|
+
} & {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {
|
|
13
|
+
label_append: {
|
|
14
|
+
slot: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export type InputTextareaProps = typeof __propDef.props;
|
|
19
|
+
export type InputTextareaEvents = typeof __propDef.events;
|
|
20
|
+
export type InputTextareaSlots = typeof __propDef.slots;
|
|
21
|
+
export default class InputTextarea extends SvelteComponent<InputTextareaProps, InputTextareaEvents, InputTextareaSlots> {
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script>import { FormControl } from "./index.js";
|
|
2
|
+
$:
|
|
3
|
+
({ input, value: _value, ...props } = $$props);
|
|
4
|
+
export let value = _value;
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<FormControl {...props} let:key>
|
|
8
|
+
<input
|
|
9
|
+
bind:value
|
|
10
|
+
on:input
|
|
11
|
+
on:focus
|
|
12
|
+
on:blur
|
|
13
|
+
type="time"
|
|
14
|
+
name={key}
|
|
15
|
+
id={key}
|
|
16
|
+
class="input input-bordered"
|
|
17
|
+
{...input}
|
|
18
|
+
/>
|
|
19
|
+
</FormControl>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type InputProps } from './index.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: InputProps;
|
|
5
|
+
events: {
|
|
6
|
+
input: Event;
|
|
7
|
+
focus: FocusEvent;
|
|
8
|
+
blur: FocusEvent;
|
|
9
|
+
} & {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
};
|
|
14
|
+
export type InputTimeProps = typeof __propDef.props;
|
|
15
|
+
export type InputTimeEvents = typeof __propDef.events;
|
|
16
|
+
export type InputTimeSlots = typeof __propDef.slots;
|
|
17
|
+
export default class InputTime extends SvelteComponent<InputTimeProps, InputTimeEvents, InputTimeSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script>import { fade } from "svelte/transition";
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
3
|
+
import { mdiClose, mdiLoading, mdiPlus } from "@mdi/js";
|
|
4
|
+
import Icon from "../Icon.svelte";
|
|
5
|
+
export let isLoading;
|
|
6
|
+
export let isUnselectable = false;
|
|
7
|
+
export let createUrl = "";
|
|
8
|
+
export let createTitle = "";
|
|
9
|
+
const dispatch = createEventDispatcher();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
{#if isLoading}
|
|
13
|
+
<div class="absolute right-1" class:right-10={createUrl} transition:fade|local>
|
|
14
|
+
<Icon
|
|
15
|
+
path={mdiLoading}
|
|
16
|
+
class="w-9"
|
|
17
|
+
classSVG="animate-spin fill-primary-ligther stroke-primary-ligther"
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
{/if}
|
|
21
|
+
|
|
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
|
+
{#if createUrl}
|
|
34
|
+
<div class="ml-[4px] -translate-x-[2px]">
|
|
35
|
+
<Icon
|
|
36
|
+
path={mdiPlus}
|
|
37
|
+
on:click={() => dispatch('create')}
|
|
38
|
+
title={createTitle}
|
|
39
|
+
class="btn btn-square"
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
{/if}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
isUnselectable?: boolean | undefined;
|
|
6
|
+
createUrl?: string | undefined;
|
|
7
|
+
createTitle?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
unselect: CustomEvent<void>;
|
|
11
|
+
create: CustomEvent<void>;
|
|
12
|
+
} & {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {};
|
|
16
|
+
};
|
|
17
|
+
export type RelationAfterProps = typeof __propDef.props;
|
|
18
|
+
export type RelationAfterEvents = typeof __propDef.events;
|
|
19
|
+
export type RelationAfterSlots = typeof __propDef.slots;
|
|
20
|
+
export default class RelationAfter extends SvelteComponent<RelationAfterProps, RelationAfterEvents, RelationAfterSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import { selector } from "../../action/selector.js";
|
|
3
|
+
let klass = "";
|
|
4
|
+
export { klass as class };
|
|
5
|
+
export let items;
|
|
6
|
+
export let isError = false;
|
|
7
|
+
export let isLoading = false;
|
|
8
|
+
export let focusIndex = 0;
|
|
9
|
+
export let trigger = void 0;
|
|
10
|
+
export let keyDownEvent = void 0;
|
|
11
|
+
export let keyDownPreventDefault = true;
|
|
12
|
+
const dispatch = createEventDispatcher();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<ul
|
|
16
|
+
use:selector={{
|
|
17
|
+
trigger,
|
|
18
|
+
focusIndex,
|
|
19
|
+
onSelect: (index) => dispatch('select', index),
|
|
20
|
+
onFocus: (index) => (focusIndex = index),
|
|
21
|
+
keyDownEvent,
|
|
22
|
+
keyDownPreventDefault
|
|
23
|
+
}}
|
|
24
|
+
class="flex flex-col gap-1 {klass}"
|
|
25
|
+
>
|
|
26
|
+
{#if isError}
|
|
27
|
+
<li class="p-2 text-center">Erreur 🥲</li>
|
|
28
|
+
{:else}
|
|
29
|
+
{#each items as item, index (item.id)}
|
|
30
|
+
{@const isFocused = focusIndex === index}
|
|
31
|
+
<li
|
|
32
|
+
role="menuitem"
|
|
33
|
+
on:click={() => dispatch('select', index)}
|
|
34
|
+
on:keydown={() => dispatch('select', index)}
|
|
35
|
+
class="flex cursor-pointer items-center justify-start gap-3 rounded px-3 py-2 hover:bg-base-200"
|
|
36
|
+
class:bg-base-300={isFocused}
|
|
37
|
+
>
|
|
38
|
+
<slot {item} {index} />
|
|
39
|
+
</li>
|
|
40
|
+
{:else}
|
|
41
|
+
<li class="px-3 py-2 rounded opacity-70">
|
|
42
|
+
{isLoading ? 'Chargement...' : 'Aucun élément'}
|
|
43
|
+
</li>
|
|
44
|
+
{/each}
|
|
45
|
+
{/if}
|
|
46
|
+
</ul>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare class __sveltets_Render<Item extends {
|
|
3
|
+
id: string;
|
|
4
|
+
}> {
|
|
5
|
+
props(): {
|
|
6
|
+
class?: string | undefined;
|
|
7
|
+
items: Item[];
|
|
8
|
+
isError?: boolean | undefined;
|
|
9
|
+
isLoading?: boolean | undefined;
|
|
10
|
+
focusIndex?: number | undefined;
|
|
11
|
+
trigger?: HTMLElement | undefined;
|
|
12
|
+
keyDownEvent?: KeyboardEvent | undefined;
|
|
13
|
+
keyDownPreventDefault?: boolean | undefined;
|
|
14
|
+
};
|
|
15
|
+
events(): {
|
|
16
|
+
select: CustomEvent<number>;
|
|
17
|
+
} & {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
};
|
|
20
|
+
slots(): {
|
|
21
|
+
default: {
|
|
22
|
+
item: Item;
|
|
23
|
+
index: any;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export type SelectorListProps<Item extends {
|
|
28
|
+
id: string;
|
|
29
|
+
}> = ReturnType<__sveltets_Render<Item>['props']>;
|
|
30
|
+
export type SelectorListEvents<Item extends {
|
|
31
|
+
id: string;
|
|
32
|
+
}> = ReturnType<__sveltets_Render<Item>['events']>;
|
|
33
|
+
export type SelectorListSlots<Item extends {
|
|
34
|
+
id: string;
|
|
35
|
+
}> = ReturnType<__sveltets_Render<Item>['slots']>;
|
|
36
|
+
export default class SelectorList<Item extends {
|
|
37
|
+
id: string;
|
|
38
|
+
}> extends SvelteComponent<SelectorListProps<Item>, SelectorListEvents<Item>, SelectorListSlots<Item>> {
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type BindOptions = {
|
|
2
|
+
bindEnable?: boolean;
|
|
3
|
+
listenerType?: 'input' | 'click';
|
|
4
|
+
debounceTime?: number;
|
|
5
|
+
initValue?: (initalValue: string) => unknown;
|
|
6
|
+
};
|
|
7
|
+
export declare function bindValueWithParams(node: HTMLInputElement | HTMLButtonElement, { bindEnable, debounceTime, initValue, listenerType }: BindOptions): {
|
|
8
|
+
destroy(): void;
|
|
9
|
+
} | undefined;
|
|
10
|
+
export declare function bindCheckedWithParams(node: HTMLInputElement, { bindEnable, listenerType, debounceTime, initValue }: BindOptions): {
|
|
11
|
+
destroy: () => void;
|
|
12
|
+
} | undefined;
|
|
13
|
+
export {};
|