fuma 1.0.20 → 2.0.0
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 +1 -1
- package/dist/action/list/handlers.d.ts +2 -2
- package/dist/action/list/index.d.ts +2 -0
- package/dist/action/list/index.js +1 -0
- package/dist/action/list/trigger.d.ts +7 -1
- package/dist/action/list/trigger.js +2 -2
- package/dist/private/Meta.svelte +32 -27
- package/dist/private/Meta.svelte.d.ts +29 -17
- package/dist/private/api.d.ts +1 -1
- package/dist/private/store.d.ts +0 -1
- package/dist/server/parseFormData.d.ts +1 -1
- package/dist/server/parseQuery.d.ts +1 -1
- package/dist/server/sse.d.ts +0 -1
- package/dist/store/isSmallScreen.d.ts +0 -1
- package/dist/store/param.d.ts +0 -2
- package/dist/store/session.d.ts +0 -1
- package/dist/ui/badge/Badge.svelte +4 -3
- package/dist/ui/badge/Badge.svelte.d.ts +19 -15
- package/dist/ui/button/ButtonCopy.svelte +35 -32
- package/dist/ui/button/ButtonCopy.svelte.d.ts +23 -21
- package/dist/ui/button/ButtonDelete.svelte +23 -21
- package/dist/ui/button/ButtonDelete.svelte.d.ts +32 -20
- package/dist/ui/card/Card.svelte +13 -10
- package/dist/ui/card/Card.svelte.d.ts +39 -24
- package/dist/ui/card/CardBasic.svelte +5 -4
- package/dist/ui/card/CardBasic.svelte.d.ts +29 -18
- package/dist/ui/card/CardCollapse.svelte +35 -31
- package/dist/ui/card/CardCollapse.svelte.d.ts +37 -23
- package/dist/ui/card/CardFullScreen.svelte +8 -6
- package/dist/ui/card/CardFullScreen.svelte.d.ts +35 -20
- package/dist/ui/card/CardLink.svelte +5 -4
- package/dist/ui/card/CardLink.svelte.d.ts +29 -18
- package/dist/ui/dialog/Dialog.svelte +41 -34
- package/dist/ui/dialog/Dialog.svelte.d.ts +36 -23
- package/dist/ui/dialog/DialogConfirm.svelte +6 -4
- package/dist/ui/dialog/DialogConfirm.svelte.d.ts +33 -19
- package/dist/ui/drawer/Drawer.svelte +47 -38
- package/dist/ui/drawer/Drawer.svelte.d.ts +81 -46
- package/dist/ui/drawer/drawerFly.d.ts +0 -1
- package/dist/ui/drawer/layers.d.ts +0 -1
- package/dist/ui/form/Form.svelte +106 -87
- package/dist/ui/form/Form.svelte.d.ts +29 -16
- package/dist/ui/form/FormInput.svelte +12 -6
- package/dist/ui/form/FormSection.svelte +24 -17
- package/dist/ui/form/FormSection.svelte.d.ts +37 -25
- package/dist/ui/icon/Icon.svelte +35 -32
- package/dist/ui/icon/Icon.svelte.d.ts +25 -21
- package/dist/ui/index.d.ts +0 -1
- package/dist/ui/index.js +0 -1
- package/dist/ui/input/FormControl.svelte +48 -36
- package/dist/ui/input/FormControl.svelte.d.ts +32 -30
- package/dist/ui/input/InputBoolean.svelte +29 -22
- package/dist/ui/input/InputBoolean.svelte.d.ts +43 -35
- package/dist/ui/input/InputCheckboxs.svelte +37 -34
- package/dist/ui/input/InputCheckboxs.svelte.d.ts +54 -39
- package/dist/ui/input/InputCheckboxsMenu.svelte +64 -47
- package/dist/ui/input/InputCheckboxsMenu.svelte.d.ts +56 -41
- package/dist/ui/input/InputCheckboxsTree.svelte +9 -6
- package/dist/ui/input/InputCheckboxsTree.svelte.d.ts +22 -18
- package/dist/ui/input/InputCheckboxsTreeNodes.svelte +36 -28
- package/dist/ui/input/InputCheckboxsTreeNodes.svelte.d.ts +20 -16
- package/dist/ui/input/InputCombo.svelte +76 -65
- package/dist/ui/input/InputCombo.svelte.d.ts +55 -39
- package/dist/ui/input/InputDate.svelte +36 -29
- package/dist/ui/input/InputDate.svelte.d.ts +20 -16
- package/dist/ui/input/InputDateTime.svelte +37 -30
- package/dist/ui/input/InputDateTime.svelte.d.ts +20 -16
- package/dist/ui/input/InputImage.svelte +52 -45
- package/dist/ui/input/InputImage.svelte.d.ts +40 -27
- package/dist/ui/input/InputImagePreview.svelte +24 -20
- package/dist/ui/input/InputImagePreview.svelte.d.ts +25 -21
- package/dist/ui/input/InputNumber.svelte +28 -22
- package/dist/ui/input/InputNumber.svelte.d.ts +20 -20
- package/dist/ui/input/InputOptionInParam.svelte +12 -10
- package/dist/ui/input/InputOptionInParam.svelte.d.ts +21 -17
- package/dist/ui/input/InputOptions.svelte +40 -34
- package/dist/ui/input/InputOptions.svelte.d.ts +19 -15
- package/dist/ui/input/InputPassword.svelte +22 -18
- package/dist/ui/input/InputPassword.svelte.d.ts +43 -35
- package/dist/ui/input/InputRadio.svelte +51 -46
- package/dist/ui/input/InputRadio.svelte.d.ts +53 -38
- package/dist/ui/input/InputRelation.svelte +129 -112
- package/dist/ui/input/InputRelation.svelte.d.ts +39 -53
- package/dist/ui/input/InputRelations.svelte +96 -90
- package/dist/ui/input/InputRelations.svelte.d.ts +35 -37
- package/dist/ui/input/InputSearch.svelte +14 -11
- package/dist/ui/input/InputSearch.svelte.d.ts +25 -21
- package/dist/ui/input/InputSelect.svelte +59 -46
- package/dist/ui/input/InputSelect.svelte.d.ts +23 -19
- package/dist/ui/input/InputText.svelte +29 -28
- package/dist/ui/input/InputText.svelte.d.ts +41 -28
- package/dist/ui/input/InputTextarea.svelte +20 -19
- package/dist/ui/input/InputTextarea.svelte.d.ts +20 -20
- package/dist/ui/input/InputTime.svelte +43 -36
- package/dist/ui/input/InputTime.svelte.d.ts +21 -36
- package/dist/ui/input/RelationAfter.svelte +13 -9
- package/dist/ui/input/RelationAfter.svelte.d.ts +24 -20
- package/dist/ui/input/SelectorList.svelte +16 -12
- package/dist/ui/input/SelectorList.svelte.d.ts +29 -20
- package/dist/ui/input/textRich/InputTextRich.svelte +63 -59
- package/dist/ui/input/textRich/InputTextRich.svelte.d.ts +36 -38
- package/dist/ui/input/textRich/SuggesionList.svelte +13 -9
- package/dist/ui/input/textRich/SuggesionList.svelte.d.ts +19 -15
- package/dist/ui/input/textRich/ToolMark.svelte +12 -9
- package/dist/ui/input/textRich/ToolMark.svelte.d.ts +22 -18
- package/dist/ui/input/textRich/ToolMarkColor.svelte +16 -12
- package/dist/ui/input/textRich/ToolMarkColor.svelte.d.ts +21 -17
- package/dist/ui/input/textRich/ToolMarkLink.svelte +46 -38
- package/dist/ui/input/textRich/ToolMarkLink.svelte.d.ts +18 -14
- package/dist/ui/input/textRich/ToolMenu.svelte +34 -19
- package/dist/ui/input/textRich/ToolMenu.svelte.d.ts +30 -26
- package/dist/ui/input/textRich/ToolMenuAlign.svelte +13 -9
- package/dist/ui/input/textRich/ToolMenuAlign.svelte.d.ts +18 -14
- package/dist/ui/input/textRich/ToolMenuInsert.svelte +12 -7
- package/dist/ui/input/textRich/ToolMenuInsert.svelte.d.ts +20 -16
- package/dist/ui/input/textRich/ToolMenuNode.svelte +14 -10
- package/dist/ui/input/textRich/ToolMenuNode.svelte.d.ts +18 -14
- package/dist/ui/input/textRich/ToolsBar.svelte +21 -14
- package/dist/ui/input/textRich/ToolsBar.svelte.d.ts +19 -17
- package/dist/ui/input/textRich/suggestion.d.ts +0 -1
- package/dist/ui/login/Login.svelte +37 -31
- package/dist/ui/login/Login.svelte.d.ts +18 -14
- package/dist/ui/menu/ContextMenu.svelte +37 -31
- package/dist/ui/menu/ContextMenu.svelte.d.ts +38 -25
- package/dist/ui/menu/DropDown.svelte +92 -83
- package/dist/ui/menu/DropDown.svelte.d.ts +46 -33
- package/dist/ui/menu/DropDownMenu.svelte +25 -18
- package/dist/ui/menu/DropDownMenu.svelte.d.ts +30 -19
- package/dist/ui/mode/ToggleMode.svelte +28 -16
- package/dist/ui/mode/ToggleMode.svelte.d.ts +34 -17
- package/dist/ui/pagination/Pagination.svelte +9 -8
- package/dist/ui/pagination/Pagination.svelte.d.ts +18 -14
- package/dist/ui/placeholder/Placeholder.svelte +4 -3
- package/dist/ui/placeholder/Placeholder.svelte.d.ts +28 -17
- package/dist/ui/placeholder/PlaceholderImage.svelte +6 -4
- package/dist/ui/placeholder/PlaceholderImage.svelte.d.ts +28 -17
- package/dist/ui/range/RangePicker.svelte +76 -63
- package/dist/ui/range/RangePicker.svelte.d.ts +29 -24
- package/dist/ui/range/RangePickerButton.svelte +43 -35
- package/dist/ui/range/RangePickerButton.svelte.d.ts +21 -17
- package/dist/ui/table/Table.svelte +35 -28
- package/dist/ui/table/Table.svelte.d.ts +24 -19
- package/dist/ui/table/TableBody.svelte +18 -12
- package/dist/ui/table/TableBody.svelte.d.ts +20 -15
- package/dist/ui/table/TableCell.svelte +13 -10
- package/dist/ui/table/TableCell.svelte.d.ts +19 -14
- package/dist/ui/table/TableFieldsEdition.svelte +58 -52
- package/dist/ui/table/TableFieldsEdition.svelte.d.ts +20 -15
- package/dist/ui/table/TableHead.svelte +20 -21
- package/dist/ui/table/TableHead.svelte.d.ts +19 -14
- package/dist/ui/table/TableViewSelect.svelte +50 -37
- package/dist/ui/table/TableViewSelect.svelte.d.ts +27 -23
- package/dist/ui/table/cell/TableCellArray.svelte +5 -3
- package/dist/ui/table/cell/TableCellArray.svelte.d.ts +18 -14
- package/dist/ui/table/cell/TableCellBoolean.svelte +4 -3
- package/dist/ui/table/cell/TableCellBoolean.svelte.d.ts +18 -14
- package/dist/ui/table/cell/TableCellNumber.svelte +2 -1
- package/dist/ui/table/cell/TableCellNumber.svelte.d.ts +18 -14
- package/dist/ui/table/cell/TableCellString.svelte +5 -2
- package/dist/ui/table/cell/TableCellString.svelte.d.ts +19 -25
- package/dist/ui/table/field.d.ts +32 -40
- package/dist/ui/table/field.js +1 -1
- package/dist/ui/table/head/TableHeadBoolean.svelte +6 -3
- package/dist/ui/table/head/TableHeadBoolean.svelte.d.ts +18 -24
- package/dist/ui/table/head/TableHeadDate.svelte +61 -113
- package/dist/ui/table/head/TableHeadDate.svelte.d.ts +18 -24
- package/dist/ui/table/head/TableHeadDefault.svelte +5 -2
- package/dist/ui/table/head/TableHeadDefault.svelte.d.ts +18 -24
- package/dist/ui/table/head/TableHeadNumber.svelte +67 -76
- package/dist/ui/table/head/TableHeadNumber.svelte.d.ts +18 -24
- package/dist/ui/table/head/TableHeadSelect.svelte +47 -41
- package/dist/ui/table/head/TableHeadSelect.svelte.d.ts +21 -27
- package/dist/ui/table/head/TableHeadString.svelte +14 -8
- package/dist/ui/table/head/TableHeadString.svelte.d.ts +18 -24
- package/dist/ui/tabs/Tabs.svelte +8 -5
- package/dist/ui/tabs/Tabs.svelte.d.ts +19 -15
- package/dist/ui/tabs/TabsIcon.svelte +31 -28
- package/dist/ui/tabs/TabsIcon.svelte.d.ts +21 -17
- package/dist/utils/eventEmitter.d.ts +4 -4
- package/dist/utils/tippy.d.ts +1 -1
- package/dist/validation/form.d.ts +0 -1
- package/dist/validation/zod.d.ts +96 -162
- package/dist/validation/zod.js +2 -4
- package/package.json +134 -138
- package/dist/ui/form/FormInput.svelte.d.ts +0 -152
- package/dist/ui/form/formInput.d.ts +0 -90
- package/dist/ui/slot/Slot.svelte +0 -35
- package/dist/ui/slot/Slot.svelte.d.ts +0 -22
- package/dist/ui/slot/Span.svelte +0 -4
- package/dist/ui/slot/Span.svelte.d.ts +0 -16
- package/dist/ui/slot/index.d.ts +0 -1
- package/dist/ui/slot/index.js +0 -1
- package/dist/ui/table/head/OrderButtons.svelte +0 -37
- package/dist/ui/table/head/OrderButtons.svelte.d.ts +0 -20
- package/dist/ui/table/head/index.d.ts +0 -19
|
@@ -1,38 +1,54 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { goto } from '$app/navigation'
|
|
3
|
+
import { page } from '$app/stores'
|
|
4
|
+
import { mdiClose } from '@mdi/js'
|
|
5
|
+
|
|
6
|
+
import { urlParam } from '../../store/index.js'
|
|
7
|
+
import { jsonParse, type Options, parseOptions } from '../../utils/index.js'
|
|
8
|
+
import { Icon } from '../icon/index.js'
|
|
9
|
+
import { DropDown } from '../menu/index.js'
|
|
10
|
+
import { FormControl, type InputProps } from './index.js'
|
|
11
|
+
|
|
12
|
+
type $$Props = InputProps<string[]> & {
|
|
13
|
+
key: string
|
|
14
|
+
options: Options
|
|
15
|
+
right?: boolean
|
|
16
|
+
btnClass?: string
|
|
17
|
+
badgePrimary?: boolean
|
|
18
|
+
}
|
|
19
|
+
$: ({
|
|
20
|
+
input,
|
|
21
|
+
value: _value,
|
|
22
|
+
options: _1,
|
|
23
|
+
class: klass,
|
|
24
|
+
label,
|
|
25
|
+
right,
|
|
26
|
+
btnClass,
|
|
27
|
+
badgePrimary,
|
|
28
|
+
...props
|
|
29
|
+
} = $$props as $$Props)
|
|
30
|
+
|
|
31
|
+
export let key: string
|
|
32
|
+
export let options: Options
|
|
33
|
+
export let value: string[] | null | undefined =
|
|
34
|
+
_value || jsonParse($page.url.searchParams.get(key), [])
|
|
35
|
+
|
|
36
|
+
let dropdown: DropDown
|
|
37
|
+
|
|
38
|
+
$: _options = parseOptions(options)
|
|
39
|
+
|
|
40
|
+
async function writeUrl() {
|
|
41
|
+
const url = value?.length
|
|
42
|
+
? $urlParam.with({ [key]: JSON.stringify(value) })
|
|
43
|
+
: $urlParam.without(key)
|
|
44
|
+
return goto(url, { replaceState: true, noScroll: true })
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function handleReset() {
|
|
48
|
+
dropdown.hide()
|
|
49
|
+
value = []
|
|
50
|
+
goto($urlParam.without(key), { replaceState: true })
|
|
51
|
+
}
|
|
36
52
|
</script>
|
|
37
53
|
|
|
38
54
|
<input type="hidden" name={key} value={JSON.stringify(value)} />
|
|
@@ -65,22 +81,23 @@ function handleReset() {
|
|
|
65
81
|
{#each _options as option, index (option.value)}
|
|
66
82
|
<FormControl
|
|
67
83
|
{...props}
|
|
68
|
-
let:key
|
|
69
84
|
label={option.label}
|
|
70
85
|
prefixFor={index}
|
|
71
86
|
class="flex-row-reverse items-center justify-end gap-2 whitespace-nowrap"
|
|
72
87
|
>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
{#snippet children({ key })}
|
|
89
|
+
<input
|
|
90
|
+
bind:group={value}
|
|
91
|
+
on:input
|
|
92
|
+
on:focus
|
|
93
|
+
on:blur
|
|
94
|
+
value={option.value}
|
|
95
|
+
type="checkbox"
|
|
96
|
+
id="{index}{key}"
|
|
97
|
+
class="checkbox"
|
|
98
|
+
{...input}
|
|
99
|
+
/>
|
|
100
|
+
{/snippet}
|
|
84
101
|
</FormControl>
|
|
85
102
|
{:else}
|
|
86
103
|
<div class="px-3 py-2 rounded opacity-70">Aucun élément</div>
|
|
@@ -1,44 +1,59 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import { type Options } from '../../utils/index.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
enhanceDisabled?: boolean | undefined;
|
|
14
|
-
labelPosition?: ("top" | "left" | "right") | undefined;
|
|
15
|
-
} & {
|
|
16
|
-
input?: import("svelte/elements.js").HTMLInputAttributes | undefined;
|
|
17
|
-
inputElement?: HTMLInputElement | undefined;
|
|
18
|
-
classWrapper?: string | undefined;
|
|
19
|
-
value?: string[] | null | undefined;
|
|
20
|
-
bindWithParams?: boolean | undefined;
|
|
21
|
-
} & {
|
|
22
|
-
key: string;
|
|
23
|
-
options: Options;
|
|
24
|
-
right?: boolean | undefined;
|
|
25
|
-
btnClass?: string | undefined;
|
|
26
|
-
badgePrimary?: boolean | undefined;
|
|
27
|
-
};
|
|
28
|
-
events: {
|
|
29
|
-
input: Event;
|
|
30
|
-
focus: FocusEvent;
|
|
31
|
-
blur: FocusEvent;
|
|
32
|
-
} & {
|
|
33
|
-
[evt: string]: CustomEvent<any>;
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
34
12
|
};
|
|
35
|
-
|
|
36
|
-
label: {};
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export type InputCheckboxsMenuProps = typeof __propDef.props;
|
|
40
|
-
export type InputCheckboxsMenuEvents = typeof __propDef.events;
|
|
41
|
-
export type InputCheckboxsMenuSlots = typeof __propDef.slots;
|
|
42
|
-
export default class InputCheckboxsMenu extends SvelteComponent<InputCheckboxsMenuProps, InputCheckboxsMenuEvents, InputCheckboxsMenuSlots> {
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
43
14
|
}
|
|
44
|
-
|
|
15
|
+
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
16
|
+
default: any;
|
|
17
|
+
} ? Props extends Record<string, never> ? any : {
|
|
18
|
+
children?: any;
|
|
19
|
+
} : {});
|
|
20
|
+
declare const InputCheckboxsMenu: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
21
|
+
class?: string;
|
|
22
|
+
classLabel?: string;
|
|
23
|
+
key?: string;
|
|
24
|
+
label?: import("svelte").Snippet | string;
|
|
25
|
+
labelAppend?: import("svelte").Snippet | null;
|
|
26
|
+
error?: string;
|
|
27
|
+
hint?: string;
|
|
28
|
+
prefix?: string | number;
|
|
29
|
+
prefixFor?: string | number;
|
|
30
|
+
enhanceDisabled?: boolean;
|
|
31
|
+
labelPosition?: "top" | "left" | "right";
|
|
32
|
+
children?: import("svelte").Snippet<[{
|
|
33
|
+
key: string;
|
|
34
|
+
}]> | undefined;
|
|
35
|
+
} & {
|
|
36
|
+
input?: import("svelte/elements").HTMLInputAttributes;
|
|
37
|
+
inputElement?: HTMLInputElement;
|
|
38
|
+
classWrapper?: string;
|
|
39
|
+
value?: string[] | null | undefined;
|
|
40
|
+
bindWithParams?: boolean;
|
|
41
|
+
} & {
|
|
42
|
+
key: string;
|
|
43
|
+
options: Options;
|
|
44
|
+
right?: boolean;
|
|
45
|
+
btnClass?: string;
|
|
46
|
+
badgePrimary?: boolean;
|
|
47
|
+
}, {
|
|
48
|
+
label: {};
|
|
49
|
+
}>, {
|
|
50
|
+
input: Event;
|
|
51
|
+
focus: FocusEvent;
|
|
52
|
+
blur: FocusEvent;
|
|
53
|
+
} & {
|
|
54
|
+
[evt: string]: CustomEvent<any>;
|
|
55
|
+
}, {
|
|
56
|
+
label: {};
|
|
57
|
+
}, {}, string>;
|
|
58
|
+
type InputCheckboxsMenu = InstanceType<typeof InputCheckboxsMenu>;
|
|
59
|
+
export default InputCheckboxsMenu;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import InputCheckboxsTreeNodes, {
|
|
3
|
+
type OptionsNode
|
|
4
|
+
} from './InputCheckboxsTreeNodes.svelte'
|
|
5
|
+
|
|
6
|
+
export let label: string
|
|
7
|
+
export let options: OptionsNode
|
|
8
|
+
let klass = ''
|
|
9
|
+
export { klass as class }
|
|
7
10
|
</script>
|
|
8
11
|
|
|
9
12
|
<div class={klass}>
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import { type OptionsNode } from './InputCheckboxsTreeNodes.svelte';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
8
12
|
};
|
|
9
|
-
|
|
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> {
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
20
14
|
}
|
|
21
|
-
|
|
15
|
+
declare const InputCheckboxsTree: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
label: string;
|
|
17
|
+
options: OptionsNode;
|
|
18
|
+
class?: string;
|
|
19
|
+
}, {
|
|
20
|
+
[evt: string]: CustomEvent<any>;
|
|
21
|
+
}, {
|
|
22
|
+
label_append: {};
|
|
23
|
+
}, {}, string>;
|
|
24
|
+
type InputCheckboxsTree = InstanceType<typeof InputCheckboxsTree>;
|
|
25
|
+
export default InputCheckboxsTree;
|
|
@@ -1,31 +1,39 @@
|
|
|
1
|
-
<script context="module"
|
|
1
|
+
<script lang="ts" context="module">
|
|
2
|
+
export type OptionsNode = Record<
|
|
3
|
+
string,
|
|
4
|
+
{ label: string; value?: boolean; options?: OptionsNode }
|
|
5
|
+
>
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { createEventDispatcher } from 'svelte'
|
|
10
|
+
import { InputBoolean } from './index.js'
|
|
11
|
+
export let options: OptionsNode
|
|
12
|
+
|
|
13
|
+
type Events = { setTrue: void }
|
|
14
|
+
const dispatch = createEventDispatcher<Events>()
|
|
15
|
+
|
|
16
|
+
function handleChange(newValue: boolean, option: OptionsNode[string]) {
|
|
17
|
+
if (newValue === true) dispatch('setTrue')
|
|
18
|
+
else if (option.options) {
|
|
19
|
+
option.options = setFalse(option.options)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
2
22
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
}
|
|
23
|
+
function setFalse(_options?: OptionsNode): OptionsNode | undefined {
|
|
24
|
+
if (!_options) return undefined
|
|
25
|
+
return Object.entries(_options).reduce<OptionsNode>(
|
|
26
|
+
(acc, [key, opt]) => ({
|
|
27
|
+
...acc,
|
|
28
|
+
[key]: {
|
|
29
|
+
label: opt.label,
|
|
30
|
+
value: false,
|
|
31
|
+
options: setFalse(opt.options)
|
|
32
|
+
}
|
|
33
|
+
}),
|
|
34
|
+
{}
|
|
35
|
+
)
|
|
36
|
+
}
|
|
29
37
|
</script>
|
|
30
38
|
|
|
31
39
|
{#each Object.keys(options) as key (key)}
|
|
@@ -43,7 +51,7 @@ function setFalse(_options) {
|
|
|
43
51
|
<div
|
|
44
52
|
style:height="{24 + index * 36}px"
|
|
45
53
|
class="t-0 bordered absolute w-3 rounded-bl-lg border-b-2 border-l-2"
|
|
46
|
-
|
|
54
|
+
></div>
|
|
47
55
|
{/each}
|
|
48
56
|
</div>
|
|
49
57
|
<div>
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
export type OptionsNode = Record<string, {
|
|
3
2
|
label: string;
|
|
4
3
|
value?: boolean;
|
|
5
4
|
options?: OptionsNode;
|
|
6
5
|
}>;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
7
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
8
|
+
$$bindings?: Bindings;
|
|
9
|
+
} & Exports;
|
|
10
|
+
(internal: unknown, props: Props & {
|
|
11
|
+
$$events?: Events;
|
|
12
|
+
$$slots?: Slots;
|
|
13
|
+
}): Exports & {
|
|
14
|
+
$set?: any;
|
|
15
|
+
$on?: any;
|
|
10
16
|
};
|
|
11
|
-
|
|
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> {
|
|
17
|
+
z_$$bindings?: Bindings;
|
|
22
18
|
}
|
|
23
|
-
|
|
19
|
+
declare const InputCheckboxsTreeNodes: $$__sveltets_2_IsomorphicComponent<{
|
|
20
|
+
options: OptionsNode;
|
|
21
|
+
}, {
|
|
22
|
+
setTrue: CustomEvent<void>;
|
|
23
|
+
} & {
|
|
24
|
+
[evt: string]: CustomEvent<any>;
|
|
25
|
+
}, {}, {}, string>;
|
|
26
|
+
type InputCheckboxsTreeNodes = InstanceType<typeof InputCheckboxsTreeNodes>;
|
|
27
|
+
export default InputCheckboxsTreeNodes;
|
|
@@ -1,74 +1,85 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createEventDispatcher, tick } from 'svelte'
|
|
3
|
+
|
|
4
|
+
import type { InputProps } from './types.js'
|
|
5
|
+
import type { TippyProps } from '../../utils/tippy.js'
|
|
6
|
+
import { type Options, type Option, parseOptions } from '../../utils/options.js'
|
|
7
|
+
import { FormControl, SelectorList } from './index.js'
|
|
8
|
+
import { DropDown } from '../menu/index.js'
|
|
9
|
+
import { Icon } from '../icon/index.js'
|
|
10
|
+
|
|
11
|
+
type $$Props = InputProps & { options: Options; tippyProps?: TippyProps }
|
|
12
|
+
$: ({ input, value: _value, options, tippyProps, ...props } = $$props as $$Props)
|
|
13
|
+
$: ({ class: inputClass, ...inputProps } = input || {})
|
|
14
|
+
export let value = _value
|
|
15
|
+
export let inputElement: HTMLInputElement | undefined = undefined
|
|
16
|
+
|
|
17
|
+
let focusIndex = 0
|
|
18
|
+
let searchValue = ''
|
|
19
|
+
|
|
20
|
+
const dispatch = createEventDispatcher<{ input: string }>()
|
|
21
|
+
let filteredOptions: (Option & { id: string })[] = []
|
|
22
|
+
$: _options = parseOptions(options)
|
|
23
|
+
$: selectedOption = _options.find((opt) => opt.value === value)
|
|
24
|
+
|
|
25
|
+
function filterOptions(value: string) {
|
|
26
|
+
const reg = new RegExp(value, 'i')
|
|
27
|
+
filteredOptions = _options
|
|
28
|
+
.filter((opt) => opt.label.match(reg) || opt.value.match(reg))
|
|
29
|
+
.map((opt) => ({ id: opt.value, ...opt }))
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function clear() {
|
|
33
|
+
searchValue = ''
|
|
34
|
+
value = ''
|
|
35
|
+
filterOptions('')
|
|
36
|
+
await tick()
|
|
37
|
+
inputElement?.focus()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function select(index = focusIndex) {
|
|
41
|
+
value = _options[index].value
|
|
42
|
+
dispatch('input', value)
|
|
43
|
+
}
|
|
35
44
|
</script>
|
|
36
45
|
|
|
37
46
|
<DropDown {tippyProps}>
|
|
38
47
|
<div class="contents" slot="activator">
|
|
39
|
-
<FormControl {...props}
|
|
40
|
-
|
|
41
|
-
<div class="
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
<FormControl {...props}>
|
|
49
|
+
{#snippet children({ key })}
|
|
50
|
+
<div class="flex grow gap-2" class:hidden={selectedOption}>
|
|
51
|
+
<div class="relative flex grow items-center gap-2">
|
|
52
|
+
<input
|
|
53
|
+
type="text"
|
|
54
|
+
id={key}
|
|
55
|
+
bind:this={inputElement}
|
|
56
|
+
bind:value={searchValue}
|
|
57
|
+
on:focus={() => filterOptions('')}
|
|
58
|
+
on:blur={() => (searchValue = '')}
|
|
59
|
+
on:input={(e) => filterOptions(e.currentTarget.value)}
|
|
60
|
+
autocomplete="off"
|
|
61
|
+
class="input input-bordered grow {inputClass || {}}"
|
|
62
|
+
{...inputProps}
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
<slot name="append" />
|
|
54
66
|
</div>
|
|
55
|
-
<slot name="append" />
|
|
56
|
-
</div>
|
|
57
67
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
{#if selectedOption}
|
|
69
|
+
<button
|
|
70
|
+
type="button"
|
|
71
|
+
class="flex h-12 items-center gap-2 rounded-lg border pl-4 pr-2"
|
|
72
|
+
on:click={clear}
|
|
73
|
+
on:focus={clear}
|
|
74
|
+
>
|
|
75
|
+
{#if selectedOption.icon}
|
|
76
|
+
<Icon path={selectedOption.icon} size={21} class="opacity-70" />
|
|
77
|
+
{/if}
|
|
78
|
+
<span>{selectedOption.label}</span>
|
|
79
|
+
</button>
|
|
80
|
+
<input type="hidden" name={key} value={selectedOption.value} />
|
|
81
|
+
{/if}
|
|
82
|
+
{/snippet}
|
|
72
83
|
</FormControl>
|
|
73
84
|
</div>
|
|
74
85
|
|
|
@@ -1,43 +1,59 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { TippyProps } from '../../utils/tippy.js';
|
|
3
2
|
import { type Options } from '../../utils/options.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} &
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
prefix?: string | number | undefined;
|
|
15
|
-
prefixFor?: string | number | undefined;
|
|
16
|
-
enhanceDisabled?: boolean | undefined;
|
|
17
|
-
labelPosition?: ("top" | "left" | "right") | undefined;
|
|
18
|
-
} & {
|
|
19
|
-
input?: import("svelte/elements").HTMLInputAttributes | undefined;
|
|
20
|
-
inputElement?: HTMLInputElement | undefined;
|
|
21
|
-
classWrapper?: string | undefined;
|
|
22
|
-
value?: string | null | undefined;
|
|
23
|
-
bindWithParams?: boolean | undefined;
|
|
24
|
-
} & {
|
|
25
|
-
options: Options;
|
|
26
|
-
tippyProps?: TippyProps | undefined;
|
|
3
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
4
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
5
|
+
$$bindings?: Bindings;
|
|
6
|
+
} & Exports;
|
|
7
|
+
(internal: unknown, props: Props & {
|
|
8
|
+
$$events?: Events;
|
|
9
|
+
$$slots?: Slots;
|
|
10
|
+
}): Exports & {
|
|
11
|
+
$set?: any;
|
|
12
|
+
$on?: any;
|
|
27
13
|
};
|
|
28
|
-
|
|
29
|
-
input: CustomEvent<string>;
|
|
30
|
-
} & {
|
|
31
|
-
[evt: string]: CustomEvent<any>;
|
|
32
|
-
};
|
|
33
|
-
slots: {
|
|
34
|
-
append: {};
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
export type InputComboProps = typeof __propDef.props;
|
|
38
|
-
export type InputComboEvents = typeof __propDef.events;
|
|
39
|
-
export type InputComboSlots = typeof __propDef.slots;
|
|
40
|
-
export default class InputCombo extends SvelteComponent<InputComboProps, InputComboEvents, InputComboSlots> {
|
|
41
|
-
get clear(): () => Promise<void>;
|
|
14
|
+
z_$$bindings?: Bindings;
|
|
42
15
|
}
|
|
43
|
-
|
|
16
|
+
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
17
|
+
default: any;
|
|
18
|
+
} ? Props extends Record<string, never> ? any : {
|
|
19
|
+
children?: any;
|
|
20
|
+
} : {});
|
|
21
|
+
declare const InputCombo: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
22
|
+
clear?: () => Promise<void>;
|
|
23
|
+
} & {
|
|
24
|
+
class?: string;
|
|
25
|
+
classLabel?: string;
|
|
26
|
+
key?: string;
|
|
27
|
+
label?: import("svelte").Snippet | string;
|
|
28
|
+
labelAppend?: import("svelte").Snippet | null;
|
|
29
|
+
error?: string;
|
|
30
|
+
hint?: string;
|
|
31
|
+
prefix?: string | number;
|
|
32
|
+
prefixFor?: string | number;
|
|
33
|
+
enhanceDisabled?: boolean;
|
|
34
|
+
labelPosition?: "top" | "left" | "right";
|
|
35
|
+
children?: import("svelte").Snippet<[{
|
|
36
|
+
key: string;
|
|
37
|
+
}]> | undefined;
|
|
38
|
+
} & {
|
|
39
|
+
input?: import("svelte/elements").HTMLInputAttributes;
|
|
40
|
+
inputElement?: HTMLInputElement;
|
|
41
|
+
classWrapper?: string;
|
|
42
|
+
value?: string | null | undefined;
|
|
43
|
+
bindWithParams?: boolean;
|
|
44
|
+
} & {
|
|
45
|
+
options: Options;
|
|
46
|
+
tippyProps?: TippyProps;
|
|
47
|
+
}, {
|
|
48
|
+
append: {};
|
|
49
|
+
}>, {
|
|
50
|
+
input: CustomEvent<string>;
|
|
51
|
+
} & {
|
|
52
|
+
[evt: string]: CustomEvent<any>;
|
|
53
|
+
}, {
|
|
54
|
+
append: {};
|
|
55
|
+
}, {
|
|
56
|
+
clear: () => Promise<void>;
|
|
57
|
+
}, string>;
|
|
58
|
+
type InputCombo = InstanceType<typeof InputCombo>;
|
|
59
|
+
export default InputCombo;
|