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,29 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import { FormControl, bindCheckedWithParams } from "./index.js";
|
|
3
|
+
$:
|
|
4
|
+
({ input, value: _value, bindWithParams, label, ...props } = $$props);
|
|
5
|
+
export let value = _value;
|
|
6
|
+
const dispatch = createEventDispatcher();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<FormControl {...props} let:key>
|
|
10
|
+
<div class="flex items-center gap-2">
|
|
11
|
+
<input type="hidden" name={key} value={value ? 'true' : ''} />
|
|
12
|
+
<input
|
|
13
|
+
bind:checked={value}
|
|
14
|
+
use:bindCheckedWithParams={{ bindEnable: bindWithParams }}
|
|
15
|
+
on:input={({ currentTarget: { checked } }) => dispatch('change', checked)}
|
|
16
|
+
on:focus
|
|
17
|
+
on:blur
|
|
18
|
+
type="checkbox"
|
|
19
|
+
id={key}
|
|
20
|
+
class="checkbox"
|
|
21
|
+
{...input}
|
|
22
|
+
/>
|
|
23
|
+
<label for={key} class="label cursor-pointer">
|
|
24
|
+
<span class="label-text">
|
|
25
|
+
<slot>{label}</slot>
|
|
26
|
+
</span>
|
|
27
|
+
</label>
|
|
28
|
+
</div>
|
|
29
|
+
</FormControl>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type InputProps } from './index.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: InputProps<boolean>;
|
|
5
|
+
events: {
|
|
6
|
+
focus: FocusEvent;
|
|
7
|
+
blur: FocusEvent;
|
|
8
|
+
change: CustomEvent<boolean>;
|
|
9
|
+
} & {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {
|
|
13
|
+
default: {};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export type InputBooleanProps = typeof __propDef.props;
|
|
17
|
+
export type InputBooleanEvents = typeof __propDef.events;
|
|
18
|
+
export type InputBooleanSlots = typeof __propDef.slots;
|
|
19
|
+
export default class InputBoolean extends SvelteComponent<InputBooleanProps, InputBooleanEvents, InputBooleanSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script>import { slide } from "svelte/transition";
|
|
2
|
+
import { FormControl } from "./index.js";
|
|
3
|
+
import { parseOptions } from "../../utils/options.js";
|
|
4
|
+
$:
|
|
5
|
+
({
|
|
6
|
+
input,
|
|
7
|
+
value: _value,
|
|
8
|
+
options: _1,
|
|
9
|
+
class: klass,
|
|
10
|
+
checkboxesClass,
|
|
11
|
+
hint,
|
|
12
|
+
error,
|
|
13
|
+
...props
|
|
14
|
+
} = $$props);
|
|
15
|
+
export let value = _value || [];
|
|
16
|
+
export let options;
|
|
17
|
+
if (!value)
|
|
18
|
+
value = [];
|
|
19
|
+
$:
|
|
20
|
+
_options = parseOptions(options);
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<div class={klass}>
|
|
24
|
+
{#if props.label}
|
|
25
|
+
<div class="label">
|
|
26
|
+
<span class="label-text">{props.label}</span>
|
|
27
|
+
<slot name="label_append" />
|
|
28
|
+
</div>
|
|
29
|
+
{/if}
|
|
30
|
+
|
|
31
|
+
<div class={checkboxesClass}>
|
|
32
|
+
{#each _options as option, index}
|
|
33
|
+
<FormControl
|
|
34
|
+
{...props}
|
|
35
|
+
let:key
|
|
36
|
+
label={option.label}
|
|
37
|
+
prefixFor={index}
|
|
38
|
+
class="flex-row-reverse items-center justify-end gap-2"
|
|
39
|
+
>
|
|
40
|
+
<input
|
|
41
|
+
bind:group={value}
|
|
42
|
+
on:change
|
|
43
|
+
on:input
|
|
44
|
+
on:focus
|
|
45
|
+
on:blur
|
|
46
|
+
value={option.value}
|
|
47
|
+
type="checkbox"
|
|
48
|
+
name={key}
|
|
49
|
+
id="{index}{key}"
|
|
50
|
+
class="checkbox"
|
|
51
|
+
{...input}
|
|
52
|
+
/>
|
|
53
|
+
</FormControl>
|
|
54
|
+
{/each}
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
{#if error}
|
|
58
|
+
<div class="label" transition:slide>
|
|
59
|
+
<span class="label-text-alt text-warning">{error}</span>
|
|
60
|
+
</div>
|
|
61
|
+
{:else if hint}
|
|
62
|
+
<div class="label" transition:slide>
|
|
63
|
+
<span class="label-text-alt text-info">{hint}</span>
|
|
64
|
+
</div>
|
|
65
|
+
{/if}
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<input type="hidden" name={props.key} value={JSON.stringify(value)} />
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type Options } from '../../utils/options.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
class?: string | undefined;
|
|
6
|
+
classLabel?: string | undefined;
|
|
7
|
+
key?: string | undefined;
|
|
8
|
+
label?: string | undefined;
|
|
9
|
+
error?: string | undefined;
|
|
10
|
+
hint?: string | undefined;
|
|
11
|
+
prefix?: string | number | undefined;
|
|
12
|
+
prefixFor?: string | number | undefined;
|
|
13
|
+
enhanceDisabled?: boolean | undefined;
|
|
14
|
+
} & {
|
|
15
|
+
input?: import("svelte/elements.js").HTMLInputAttributes | undefined;
|
|
16
|
+
inputElement?: HTMLInputElement | undefined;
|
|
17
|
+
wrapperClass?: string | undefined;
|
|
18
|
+
value?: string[] | undefined;
|
|
19
|
+
bindWithParams?: boolean | undefined;
|
|
20
|
+
} & {
|
|
21
|
+
options: Options;
|
|
22
|
+
checkboxesClass?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
events: {
|
|
25
|
+
change: Event;
|
|
26
|
+
input: Event;
|
|
27
|
+
focus: FocusEvent;
|
|
28
|
+
blur: FocusEvent;
|
|
29
|
+
} & {
|
|
30
|
+
[evt: string]: CustomEvent<any>;
|
|
31
|
+
};
|
|
32
|
+
slots: {
|
|
33
|
+
label_append: {};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export type InputCheckboxsProps = typeof __propDef.props;
|
|
37
|
+
export type InputCheckboxsEvents = typeof __propDef.events;
|
|
38
|
+
export type InputCheckboxsSlots = typeof __propDef.slots;
|
|
39
|
+
export default class InputCheckboxs extends SvelteComponent<InputCheckboxsProps, InputCheckboxsEvents, InputCheckboxsSlots> {
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<script>import { goto } from "$app/navigation";
|
|
2
|
+
import { page } from "$app/stores";
|
|
3
|
+
import { mdiClose } from "@mdi/js";
|
|
4
|
+
import { urlParam } from "../../store/index.js";
|
|
5
|
+
import { jsonParse, parseOptions } from "../../utils/index.js";
|
|
6
|
+
import { DropDown, Icon } from "../index.js";
|
|
7
|
+
import { FormControl } from "./index.js";
|
|
8
|
+
$:
|
|
9
|
+
({
|
|
10
|
+
input,
|
|
11
|
+
value: _value,
|
|
12
|
+
options: _1,
|
|
13
|
+
class: klass,
|
|
14
|
+
label,
|
|
15
|
+
right,
|
|
16
|
+
btnClass,
|
|
17
|
+
badgePrimary,
|
|
18
|
+
...props
|
|
19
|
+
} = $$props);
|
|
20
|
+
export let key;
|
|
21
|
+
export let options;
|
|
22
|
+
export let value = _value || jsonParse($page.url.searchParams.get(key), []);
|
|
23
|
+
let dropdown;
|
|
24
|
+
$:
|
|
25
|
+
_options = parseOptions(options);
|
|
26
|
+
function handleSubmit() {
|
|
27
|
+
if (!dropdown)
|
|
28
|
+
return;
|
|
29
|
+
if (!value.length) {
|
|
30
|
+
goto($urlParam.without(key), { replaceState: true, noScroll: true });
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
goto($urlParam.with({ [key]: JSON.stringify(value) }), { replaceState: true, noScroll: true });
|
|
34
|
+
}
|
|
35
|
+
function handleReset() {
|
|
36
|
+
dropdown.hide();
|
|
37
|
+
value = [];
|
|
38
|
+
goto($urlParam.without(key), { replaceState: true });
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<input type="hidden" name={key} value={JSON.stringify(value)} />
|
|
43
|
+
|
|
44
|
+
<DropDown bind:this={dropdown} tippyProps={{ onHide: handleSubmit }} wrapperClass="mb-[-2px]">
|
|
45
|
+
<div class="join" class:ml-2={value.length} slot="activator">
|
|
46
|
+
<button class="btn indicator join-item btn-sm {btnClass || ''}">
|
|
47
|
+
<slot name="label">
|
|
48
|
+
<span>{label}</span>
|
|
49
|
+
</slot>
|
|
50
|
+
{#if value.length > 0}
|
|
51
|
+
<span
|
|
52
|
+
class="
|
|
53
|
+
badge indicator-item badge-sm indicator-start
|
|
54
|
+
{badgePrimary ? 'badge-primary' : 'badge-outline bg-base-100'}
|
|
55
|
+
"
|
|
56
|
+
>
|
|
57
|
+
{value.length}
|
|
58
|
+
</span>
|
|
59
|
+
{/if}
|
|
60
|
+
</button>
|
|
61
|
+
{#if value.length}
|
|
62
|
+
<button class="btn btn-square join-item btn-sm" on:click={handleReset}>
|
|
63
|
+
<Icon path={mdiClose} class="fill-base-content" />
|
|
64
|
+
</button>
|
|
65
|
+
{/if}
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<div class={klass}>
|
|
69
|
+
{#each _options as option, index (option.value)}
|
|
70
|
+
<FormControl
|
|
71
|
+
{...props}
|
|
72
|
+
let:key
|
|
73
|
+
label={option.label}
|
|
74
|
+
prefixFor={index}
|
|
75
|
+
class="flex-row-reverse items-center justify-end gap-2 whitespace-nowrap"
|
|
76
|
+
>
|
|
77
|
+
<input
|
|
78
|
+
bind:group={value}
|
|
79
|
+
on:input
|
|
80
|
+
on:focus
|
|
81
|
+
on:blur
|
|
82
|
+
value={option.value}
|
|
83
|
+
type="checkbox"
|
|
84
|
+
id="{index}{key}"
|
|
85
|
+
class="checkbox"
|
|
86
|
+
{...input}
|
|
87
|
+
/>
|
|
88
|
+
</FormControl>
|
|
89
|
+
{:else}
|
|
90
|
+
<div class="px-3 py-2 rounded opacity-70">Aucun élément</div>
|
|
91
|
+
{/each}
|
|
92
|
+
</div>
|
|
93
|
+
</DropDown>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type Options } from '../../utils/index.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
class?: string | undefined;
|
|
6
|
+
classLabel?: string | undefined;
|
|
7
|
+
key?: string | undefined;
|
|
8
|
+
label?: string | undefined;
|
|
9
|
+
error?: string | undefined;
|
|
10
|
+
hint?: string | undefined;
|
|
11
|
+
prefix?: string | number | undefined;
|
|
12
|
+
prefixFor?: string | number | undefined;
|
|
13
|
+
enhanceDisabled?: boolean | undefined;
|
|
14
|
+
} & {
|
|
15
|
+
input?: import("svelte/elements.js").HTMLInputAttributes | undefined;
|
|
16
|
+
inputElement?: HTMLInputElement | undefined;
|
|
17
|
+
wrapperClass?: string | undefined;
|
|
18
|
+
value?: string[] | undefined;
|
|
19
|
+
bindWithParams?: boolean | undefined;
|
|
20
|
+
} & {
|
|
21
|
+
key: string;
|
|
22
|
+
options: Options;
|
|
23
|
+
right?: boolean | undefined;
|
|
24
|
+
btnClass?: string | undefined;
|
|
25
|
+
badgePrimary?: boolean | undefined;
|
|
26
|
+
};
|
|
27
|
+
events: {
|
|
28
|
+
input: Event;
|
|
29
|
+
focus: FocusEvent;
|
|
30
|
+
blur: FocusEvent;
|
|
31
|
+
} & {
|
|
32
|
+
[evt: string]: CustomEvent<any>;
|
|
33
|
+
};
|
|
34
|
+
slots: {
|
|
35
|
+
label: {};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export type InputCheckboxsMenuProps = typeof __propDef.props;
|
|
39
|
+
export type InputCheckboxsMenuEvents = typeof __propDef.events;
|
|
40
|
+
export type InputCheckboxsMenuSlots = typeof __propDef.slots;
|
|
41
|
+
export default class InputCheckboxsMenu extends SvelteComponent<InputCheckboxsMenuProps, InputCheckboxsMenuEvents, InputCheckboxsMenuSlots> {
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script>import InputCheckboxsTreeNodes, {
|
|
2
|
+
} from "./InputCheckboxsTreeNodes.svelte";
|
|
3
|
+
export let label;
|
|
4
|
+
export let options;
|
|
5
|
+
let klass = "";
|
|
6
|
+
export { klass as class };
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<div class={klass}>
|
|
10
|
+
<div class="label">
|
|
11
|
+
<span class="label-text">{label}</span>
|
|
12
|
+
<slot name="label_append" />
|
|
13
|
+
</div>
|
|
14
|
+
<InputCheckboxsTreeNodes {options} />
|
|
15
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type OptionsNode } from './InputCheckboxsTreeNodes.svelte';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
label: string;
|
|
6
|
+
options: OptionsNode;
|
|
7
|
+
class?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {
|
|
13
|
+
label_append: {};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export type InputCheckboxsTreeProps = typeof __propDef.props;
|
|
17
|
+
export type InputCheckboxsTreeEvents = typeof __propDef.events;
|
|
18
|
+
export type InputCheckboxsTreeSlots = typeof __propDef.slots;
|
|
19
|
+
export default class InputCheckboxsTree extends SvelteComponent<InputCheckboxsTreeProps, InputCheckboxsTreeEvents, InputCheckboxsTreeSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script context="module"></script>
|
|
2
|
+
|
|
3
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
4
|
+
import { InputBoolean } from "./index.js";
|
|
5
|
+
export let options;
|
|
6
|
+
const dispatch = createEventDispatcher();
|
|
7
|
+
function handleChange(newValue, option) {
|
|
8
|
+
if (newValue === true)
|
|
9
|
+
dispatch("setTrue");
|
|
10
|
+
else if (option.options) {
|
|
11
|
+
option.options = setFalse(option.options);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function setFalse(_options) {
|
|
15
|
+
if (!_options)
|
|
16
|
+
return void 0;
|
|
17
|
+
return Object.entries(_options).reduce(
|
|
18
|
+
(acc, [key, opt]) => ({
|
|
19
|
+
...acc,
|
|
20
|
+
[key]: {
|
|
21
|
+
label: opt.label,
|
|
22
|
+
value: false,
|
|
23
|
+
options: setFalse(opt.options)
|
|
24
|
+
}
|
|
25
|
+
}),
|
|
26
|
+
{}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
{#each Object.keys(options) as key (key)}
|
|
32
|
+
<InputBoolean
|
|
33
|
+
{key}
|
|
34
|
+
label={options[key].label}
|
|
35
|
+
bind:value={options[key].value}
|
|
36
|
+
on:change={({ detail }) => handleChange(detail, options[key])}
|
|
37
|
+
/>
|
|
38
|
+
|
|
39
|
+
{#if options[key].options}
|
|
40
|
+
<div class="flex">
|
|
41
|
+
<div class="relative -mt-[6px] ml-3 w-3">
|
|
42
|
+
{#each Object.keys(options[key].options || {}) as k, index}
|
|
43
|
+
<div
|
|
44
|
+
style:height="{24 + index * 36}px"
|
|
45
|
+
class="t-0 bordered absolute w-3 rounded-bl-lg border-b-2 border-l-2"
|
|
46
|
+
/>
|
|
47
|
+
{/each}
|
|
48
|
+
</div>
|
|
49
|
+
<div>
|
|
50
|
+
<svelte:self
|
|
51
|
+
options={options[key].options}
|
|
52
|
+
on:setTrue={() => {
|
|
53
|
+
options[key].value = true
|
|
54
|
+
dispatch('setTrue')
|
|
55
|
+
}}
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
{/if}
|
|
60
|
+
{/each}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
export type OptionsNode = Record<string, {
|
|
3
|
+
label: string;
|
|
4
|
+
value?: boolean;
|
|
5
|
+
options?: OptionsNode;
|
|
6
|
+
}>;
|
|
7
|
+
declare const __propDef: {
|
|
8
|
+
props: {
|
|
9
|
+
options: OptionsNode;
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
setTrue: CustomEvent<void>;
|
|
13
|
+
} & {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {};
|
|
17
|
+
};
|
|
18
|
+
export type InputCheckboxsTreeNodesProps = typeof __propDef.props;
|
|
19
|
+
export type InputCheckboxsTreeNodesEvents = typeof __propDef.events;
|
|
20
|
+
export type InputCheckboxsTreeNodesSlots = typeof __propDef.slots;
|
|
21
|
+
export default class InputCheckboxsTreeNodes extends SvelteComponent<InputCheckboxsTreeNodesProps, InputCheckboxsTreeNodesEvents, InputCheckboxsTreeNodesSlots> {
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import { FormControl } from "./index.js";
|
|
4
|
+
$:
|
|
5
|
+
({ input, value: _value, ...props } = $$props);
|
|
6
|
+
export let value = _value;
|
|
7
|
+
const dispatch = createEventDispatcher();
|
|
8
|
+
const handleInput = ({ currentTarget }) => {
|
|
9
|
+
value = currentTarget.valueAsDate || null;
|
|
10
|
+
dispatch("input", value);
|
|
11
|
+
};
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<FormControl {...props} let:key>
|
|
15
|
+
<input
|
|
16
|
+
value={value && dayjs(value).format('YYYY-MM-DD')}
|
|
17
|
+
on:input={handleInput}
|
|
18
|
+
on:focus
|
|
19
|
+
on:blur
|
|
20
|
+
type="date"
|
|
21
|
+
name={key}
|
|
22
|
+
id={key}
|
|
23
|
+
class="input input-bordered"
|
|
24
|
+
{...input}
|
|
25
|
+
/>
|
|
26
|
+
</FormControl>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type InputProps } from './index.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: InputProps<Date | null>;
|
|
5
|
+
events: {
|
|
6
|
+
focus: FocusEvent;
|
|
7
|
+
blur: FocusEvent;
|
|
8
|
+
input: CustomEvent<Date | null>;
|
|
9
|
+
} & {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
};
|
|
14
|
+
export type InputDateProps = typeof __propDef.props;
|
|
15
|
+
export type InputDateEvents = typeof __propDef.events;
|
|
16
|
+
export type InputDateSlots = typeof __propDef.slots;
|
|
17
|
+
export default class InputDate extends SvelteComponent<InputDateProps, InputDateEvents, InputDateSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
{#if value}
|
|
9
|
+
<input type="hidden" name={key} value={new Date(value).toJSON()} />
|
|
10
|
+
{/if}
|
|
11
|
+
<input
|
|
12
|
+
bind:value
|
|
13
|
+
on:input
|
|
14
|
+
on:focus
|
|
15
|
+
on:blur
|
|
16
|
+
type="datetime-local"
|
|
17
|
+
id={key}
|
|
18
|
+
class="input input-bordered"
|
|
19
|
+
{...input}
|
|
20
|
+
/>
|
|
21
|
+
</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 InputDatetimeProps = typeof __propDef.props;
|
|
15
|
+
export type InputDatetimeEvents = typeof __propDef.events;
|
|
16
|
+
export type InputDatetimeSlots = typeof __propDef.slots;
|
|
17
|
+
export default class InputDatetime extends SvelteComponent<InputDatetimeProps, InputDatetimeEvents, InputDatetimeSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<script context="module"></script>
|
|
2
|
+
|
|
3
|
+
<script>import { onMount, createEventDispatcher } from "svelte";
|
|
4
|
+
import Cropper from "svelte-easy-crop";
|
|
5
|
+
import { mdiTrayArrowUp } from "@mdi/js";
|
|
6
|
+
import { Dialog, DropDown, Icon } from "../index.js";
|
|
7
|
+
export let aspect = 1;
|
|
8
|
+
export let title = "Image";
|
|
9
|
+
export let formaction = void 0;
|
|
10
|
+
export let key = "";
|
|
11
|
+
let dialog;
|
|
12
|
+
let tip;
|
|
13
|
+
let image = "";
|
|
14
|
+
let crop = void 0;
|
|
15
|
+
let inputFile;
|
|
16
|
+
const dispatch = createEventDispatcher();
|
|
17
|
+
function onFileSelected() {
|
|
18
|
+
if (!inputFile.files)
|
|
19
|
+
return;
|
|
20
|
+
const file = inputFile.files[0];
|
|
21
|
+
const reader = new FileReader();
|
|
22
|
+
reader.onload = ({ target }) => {
|
|
23
|
+
image = target?.result || "";
|
|
24
|
+
dialog?.showModal();
|
|
25
|
+
};
|
|
26
|
+
reader.readAsDataURL(file);
|
|
27
|
+
}
|
|
28
|
+
export function close() {
|
|
29
|
+
tip?.hide();
|
|
30
|
+
dialog?.close();
|
|
31
|
+
}
|
|
32
|
+
onMount(() => {
|
|
33
|
+
if (!$$slots.actions)
|
|
34
|
+
tip.disable();
|
|
35
|
+
});
|
|
36
|
+
function handleClickActivator() {
|
|
37
|
+
if (!$$slots.actions)
|
|
38
|
+
inputFile.click();
|
|
39
|
+
}
|
|
40
|
+
function handleValidation() {
|
|
41
|
+
close();
|
|
42
|
+
if (crop && image)
|
|
43
|
+
dispatch("submit", { crop, image });
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<DropDown tippyProps={{ arrow: true }} hideOnBlur bind:tip>
|
|
48
|
+
<button
|
|
49
|
+
slot="activator"
|
|
50
|
+
type="button"
|
|
51
|
+
class="block overflow-hidden rounded-lg transition-shadow hover:shadow-lg"
|
|
52
|
+
on:click={handleClickActivator}
|
|
53
|
+
>
|
|
54
|
+
<slot>image</slot>
|
|
55
|
+
</button>
|
|
56
|
+
{#if $$slots.actions}
|
|
57
|
+
<div class="flex flex-col">
|
|
58
|
+
<button
|
|
59
|
+
type="button"
|
|
60
|
+
class="menu-item relative"
|
|
61
|
+
on:click={() => {
|
|
62
|
+
inputFile.click()
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
<Icon path={mdiTrayArrowUp} class="opacity-70" size={20} />
|
|
66
|
+
<span>Charger une image</span>
|
|
67
|
+
</button>
|
|
68
|
+
<slot name="actions" />
|
|
69
|
+
</div>
|
|
70
|
+
{/if}
|
|
71
|
+
</DropDown>
|
|
72
|
+
|
|
73
|
+
<Dialog bind:dialog>
|
|
74
|
+
<h2 slot="header" class="card-title">
|
|
75
|
+
{title}
|
|
76
|
+
</h2>
|
|
77
|
+
|
|
78
|
+
<div class="relative aspect-square overflow-hidden rounded-lg">
|
|
79
|
+
<Cropper
|
|
80
|
+
{image}
|
|
81
|
+
{aspect}
|
|
82
|
+
showGrid={false}
|
|
83
|
+
zoomSpeed={0.2}
|
|
84
|
+
on:cropcomplete={(e) => (crop = e.detail.pixels)}
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
<div class="mt-2 flex justify-end">
|
|
88
|
+
<input type="hidden" name="{key ? `${key}_` : ''}crop" value={JSON.stringify(crop)} />
|
|
89
|
+
<input
|
|
90
|
+
class="hidden"
|
|
91
|
+
type="file"
|
|
92
|
+
name="{key ? `${key}_` : ''}image"
|
|
93
|
+
accept="image/jpeg, image/png, image/webp, image/gif, image/avif, image/tiff"
|
|
94
|
+
bind:this={inputFile}
|
|
95
|
+
on:change={onFileSelected}
|
|
96
|
+
/>
|
|
97
|
+
|
|
98
|
+
<button
|
|
99
|
+
{formaction}
|
|
100
|
+
type={formaction ? 'submit' : 'button'}
|
|
101
|
+
class="btn btn-primary"
|
|
102
|
+
on:click={handleValidation}
|
|
103
|
+
>
|
|
104
|
+
Valider
|
|
105
|
+
</button>
|
|
106
|
+
</div>
|
|
107
|
+
</Dialog>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
export type Crop = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
};
|
|
8
|
+
declare const __propDef: {
|
|
9
|
+
props: {
|
|
10
|
+
aspect?: number | undefined;
|
|
11
|
+
title?: string | undefined;
|
|
12
|
+
formaction?: string | undefined;
|
|
13
|
+
key?: string | undefined;
|
|
14
|
+
close?: (() => void) | undefined;
|
|
15
|
+
};
|
|
16
|
+
events: {
|
|
17
|
+
submit: CustomEvent<{
|
|
18
|
+
crop: Crop;
|
|
19
|
+
image: string;
|
|
20
|
+
}>;
|
|
21
|
+
} & {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
};
|
|
24
|
+
slots: {
|
|
25
|
+
default: {};
|
|
26
|
+
actions: {};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type InputImageProps = typeof __propDef.props;
|
|
30
|
+
export type InputImageEvents = typeof __propDef.events;
|
|
31
|
+
export type InputImageSlots = typeof __propDef.slots;
|
|
32
|
+
export default class InputImage extends SvelteComponent<InputImageProps, InputImageEvents, InputImageSlots> {
|
|
33
|
+
get close(): () => void;
|
|
34
|
+
}
|
|
35
|
+
export {};
|