fuma 0.5.1 → 1.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/dist/private/Meta.svelte +32 -27
- package/dist/private/Meta.svelte.d.ts +1 -0
- package/dist/private/api.d.ts +1 -1
- package/dist/ui/badge/Badge.svelte +4 -3
- package/dist/ui/button/ButtonCopy.svelte +32 -26
- package/dist/ui/button/ButtonDelete.svelte +23 -21
- package/dist/ui/button/ButtonDelete.svelte.d.ts +1 -0
- package/dist/ui/card/Card.svelte +13 -10
- package/dist/ui/card/Card.svelte.d.ts +1 -0
- package/dist/ui/card/CardBasic.svelte +5 -4
- package/dist/ui/card/CardBasic.svelte.d.ts +1 -0
- package/dist/ui/card/CardCollapse.svelte +35 -31
- package/dist/ui/card/CardCollapse.svelte.d.ts +1 -0
- package/dist/ui/card/CardFullScreen.svelte +8 -6
- package/dist/ui/card/CardFullScreen.svelte.d.ts +3 -0
- package/dist/ui/card/CardLink.svelte +5 -4
- package/dist/ui/card/CardLink.svelte.d.ts +1 -0
- package/dist/ui/dialog/Dialog.svelte +41 -34
- package/dist/ui/dialog/Dialog.svelte.d.ts +1 -0
- package/dist/ui/dialog/DialogConfirm.svelte +6 -4
- package/dist/ui/dialog/DialogConfirm.svelte.d.ts +1 -0
- package/dist/ui/drawer/Drawer.svelte +47 -38
- package/dist/ui/drawer/Drawer.svelte.d.ts +16 -0
- package/dist/ui/form/Form.svelte +101 -83
- package/dist/ui/form/Form.svelte.d.ts +1 -0
- package/dist/ui/form/FormInput.svelte +12 -6
- package/dist/ui/form/FormInput.svelte.d.ts +30 -8
- package/dist/ui/form/FormSection.svelte +24 -17
- package/dist/ui/form/formInput.d.ts +7 -4
- package/dist/ui/icon/Icon.svelte +35 -32
- 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 +7 -9
- package/dist/ui/input/InputBoolean.svelte +29 -22
- package/dist/ui/input/InputBoolean.svelte.d.ts +5 -1
- package/dist/ui/input/InputCheckboxs.svelte +37 -34
- package/dist/ui/input/InputCheckboxs.svelte.d.ts +5 -1
- package/dist/ui/input/InputCheckboxsMenu.svelte +64 -47
- package/dist/ui/input/InputCheckboxsMenu.svelte.d.ts +5 -1
- package/dist/ui/input/InputCheckboxsTree.svelte +9 -6
- package/dist/ui/input/InputCheckboxsTreeNodes.svelte +36 -28
- package/dist/ui/input/InputCombo.svelte +76 -65
- package/dist/ui/input/InputCombo.svelte.d.ts +5 -1
- package/dist/ui/input/InputDate.svelte +36 -29
- package/dist/ui/input/InputDateTime.svelte +37 -30
- package/dist/ui/input/InputImage.svelte +52 -45
- package/dist/ui/input/InputImage.svelte.d.ts +1 -0
- package/dist/ui/input/InputImagePreview.svelte +24 -20
- package/dist/ui/input/InputNumber.svelte +28 -22
- package/dist/ui/input/InputNumber.svelte.d.ts +1 -5
- package/dist/ui/input/InputOptionInParam.svelte +12 -10
- package/dist/ui/input/InputOptions.svelte +40 -34
- package/dist/ui/input/InputPassword.svelte +22 -18
- package/dist/ui/input/InputPassword.svelte.d.ts +5 -1
- package/dist/ui/input/InputRadio.svelte +51 -46
- package/dist/ui/input/InputRadio.svelte.d.ts +5 -1
- package/dist/ui/input/InputRelation.svelte +119 -111
- package/dist/ui/input/InputRelation.svelte.d.ts +6 -12
- package/dist/ui/input/InputRelations.svelte +94 -90
- package/dist/ui/input/InputRelations.svelte.d.ts +5 -12
- package/dist/ui/input/InputSearch.svelte +13 -10
- package/dist/ui/input/InputSelect.svelte +59 -46
- package/dist/ui/input/InputText.svelte +29 -28
- package/dist/ui/input/InputText.svelte.d.ts +0 -3
- package/dist/ui/input/InputTextarea.svelte +20 -19
- package/dist/ui/input/InputTextarea.svelte.d.ts +1 -5
- package/dist/ui/input/InputTime.svelte +43 -35
- package/dist/ui/input/RelationAfter.svelte +13 -9
- package/dist/ui/input/SelectorList.svelte +16 -12
- package/dist/ui/input/SelectorList.svelte.d.ts +4 -0
- package/dist/ui/input/textRich/InputTextRich.svelte +63 -54
- package/dist/ui/input/textRich/InputTextRich.svelte.d.ts +5 -1
- package/dist/ui/input/textRich/SuggesionList.svelte +13 -9
- package/dist/ui/input/textRich/ToolMark.svelte +12 -9
- package/dist/ui/input/textRich/ToolMarkColor.svelte +16 -12
- package/dist/ui/input/textRich/ToolMarkLink.svelte +46 -38
- package/dist/ui/input/textRich/ToolMenu.svelte +34 -19
- package/dist/ui/input/textRich/ToolMenuAlign.svelte +13 -9
- package/dist/ui/input/textRich/ToolMenuInsert.svelte +12 -7
- package/dist/ui/input/textRich/ToolMenuNode.svelte +14 -10
- package/dist/ui/input/textRich/ToolsBar.svelte +17 -13
- package/dist/ui/login/Login.svelte +37 -31
- package/dist/ui/menu/ContextMenu.svelte +37 -31
- package/dist/ui/menu/ContextMenu.svelte.d.ts +1 -0
- package/dist/ui/menu/DropDown.svelte +92 -83
- package/dist/ui/menu/DropDown.svelte.d.ts +1 -0
- package/dist/ui/menu/DropDownMenu.svelte +25 -18
- package/dist/ui/menu/DropDownMenu.svelte.d.ts +1 -0
- package/dist/ui/mode/ToggleMode.svelte +15 -14
- package/dist/ui/mode/ToggleMode.svelte.d.ts +6 -1
- package/dist/ui/pagination/Pagination.svelte +9 -8
- package/dist/ui/placeholder/Placeholder.svelte +4 -3
- package/dist/ui/placeholder/Placeholder.svelte.d.ts +1 -0
- package/dist/ui/placeholder/PlaceholderImage.svelte +6 -4
- package/dist/ui/placeholder/PlaceholderImage.svelte.d.ts +1 -0
- package/dist/ui/range/RangePicker.svelte +76 -63
- package/dist/ui/range/RangePickerButton.svelte +43 -35
- package/dist/ui/table/Table.svelte +35 -28
- package/dist/ui/table/TableBody.svelte +18 -12
- package/dist/ui/table/TableCell.svelte +13 -10
- package/dist/ui/table/TableFieldsEdition.svelte +57 -51
- package/dist/ui/table/TableHead.svelte +19 -20
- package/dist/ui/table/TableViewSelect.svelte +50 -37
- package/dist/ui/table/cell/TableCellArray.svelte +5 -3
- package/dist/ui/table/cell/TableCellBoolean.svelte +4 -3
- package/dist/ui/table/cell/TableCellNumber.svelte +2 -1
- package/dist/ui/table/cell/TableCellString.svelte +5 -2
- package/dist/ui/table/head/TableHeadBoolean.svelte +6 -3
- package/dist/ui/table/head/TableHeadDate.svelte +54 -47
- package/dist/ui/table/head/TableHeadDefault.svelte +5 -2
- package/dist/ui/table/head/TableHeadNumber.svelte +65 -53
- package/dist/ui/table/head/TableHeadSelect.svelte +47 -41
- package/dist/ui/table/head/TableHeadString.svelte +14 -8
- package/dist/ui/tabs/Tabs.svelte +8 -5
- package/dist/ui/tabs/TabsIcon.svelte +31 -28
- package/package.json +32 -33
- 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
|
@@ -25,6 +25,22 @@ declare const __propDef: {
|
|
|
25
25
|
invalidateAll?: boolean | undefined;
|
|
26
26
|
state?: App.PageState | undefined;
|
|
27
27
|
} | undefined) => Promise<void>) | undefined;
|
|
28
|
+
children?: import("svelte").Snippet<[{
|
|
29
|
+
open: (value?: number, options?: {
|
|
30
|
+
replaceState?: boolean | undefined;
|
|
31
|
+
noScroll?: boolean | undefined;
|
|
32
|
+
keepFocus?: boolean | undefined;
|
|
33
|
+
invalidateAll?: boolean | undefined;
|
|
34
|
+
state?: App.PageState | undefined;
|
|
35
|
+
} | undefined) => Promise<void>;
|
|
36
|
+
close: (options?: {
|
|
37
|
+
replaceState?: boolean | undefined;
|
|
38
|
+
noScroll?: boolean | undefined;
|
|
39
|
+
keepFocus?: boolean | undefined;
|
|
40
|
+
invalidateAll?: boolean | undefined;
|
|
41
|
+
state?: App.PageState | undefined;
|
|
42
|
+
} | undefined) => Promise<void>;
|
|
43
|
+
}]> | undefined;
|
|
28
44
|
};
|
|
29
45
|
events: {
|
|
30
46
|
[evt: string]: CustomEvent<any>;
|
package/dist/ui/form/Form.svelte
CHANGED
|
@@ -1,92 +1,110 @@
|
|
|
1
|
-
<script context="module"
|
|
1
|
+
<script lang="ts" context="module">
|
|
2
|
+
import type { z } from 'zod'
|
|
3
|
+
import type { FormDataInput } from './form.js'
|
|
4
|
+
</script>
|
|
2
5
|
|
|
3
6
|
<script
|
|
4
|
-
|
|
7
|
+
lang="ts"
|
|
5
8
|
generics="
|
|
6
9
|
Shape extends z.ZodRawShape,
|
|
7
10
|
ReturnData extends Record<string, unknown> = FormDataInput<Shape>,
|
|
8
11
|
Data extends FormDataInput<Shape> = FormDataInput<Shape>
|
|
9
12
|
"
|
|
10
|
-
>
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export
|
|
32
|
-
export let
|
|
33
|
-
export let
|
|
34
|
-
export let
|
|
35
|
-
export let
|
|
36
|
-
let
|
|
37
|
-
export
|
|
38
|
-
let
|
|
39
|
-
export
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
13
|
+
>
|
|
14
|
+
import { createEventDispatcher, onMount } from 'svelte'
|
|
15
|
+
import { fade } from 'svelte/transition'
|
|
16
|
+
import { page } from '$app/stores'
|
|
17
|
+
import { contextContainer } from '../context.js'
|
|
18
|
+
import {
|
|
19
|
+
initData,
|
|
20
|
+
type FormField,
|
|
21
|
+
type FormSectionProps,
|
|
22
|
+
type BoolOrFunction,
|
|
23
|
+
type Nullable,
|
|
24
|
+
getFieldType,
|
|
25
|
+
useHandleInput
|
|
26
|
+
} from './form.js'
|
|
27
|
+
import ButtonDelete from '../button/ButtonDelete.svelte'
|
|
28
|
+
|
|
29
|
+
import { useForm, type UseFormOptions } from '../../validation/form.js'
|
|
30
|
+
import FormInput from './FormInput.svelte'
|
|
31
|
+
import FormSection from './FormSection.svelte'
|
|
32
|
+
|
|
33
|
+
let klass = ''
|
|
34
|
+
export { klass as class }
|
|
35
|
+
export let classSection = ''
|
|
36
|
+
export let classAction = ''
|
|
37
|
+
export let model: Shape | undefined = undefined
|
|
38
|
+
export let fields: FormField<Shape>[][] = []
|
|
39
|
+
export let sections: FormSectionProps<Shape>[] = [{}]
|
|
40
|
+
export let action = ''
|
|
41
|
+
export let actionCreate = '_create'
|
|
42
|
+
export let actionDelete = '_delete'
|
|
43
|
+
export let actionUpdate = '_update'
|
|
44
|
+
|
|
45
|
+
/** Ignore actionCreate, actionDelete and actionUpdate */
|
|
46
|
+
export let simpleAction = false
|
|
47
|
+
|
|
48
|
+
export let options: UseFormOptions<ReturnData> = {}
|
|
49
|
+
let dataInput: Nullable<Data> = initData<Shape, Data>(fields)
|
|
50
|
+
export { dataInput as data }
|
|
51
|
+
|
|
52
|
+
let data = dataInput
|
|
53
|
+
|
|
54
|
+
export function set<K extends keyof Shape>(key: K, value: Nullable<Data>[K]) {
|
|
55
|
+
isDirty.set(true)
|
|
56
|
+
data[key] = value
|
|
57
|
+
}
|
|
58
|
+
export function update(updater: (currentData: Nullable<Data>) => Nullable<Data>) {
|
|
59
|
+
isDirty.set(true)
|
|
60
|
+
data = updater(data)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const dispatch = createEventDispatcher<{
|
|
64
|
+
success: { action: URL; data?: ReturnData }
|
|
65
|
+
created: ReturnData
|
|
66
|
+
updated: ReturnData
|
|
67
|
+
deleted: void
|
|
68
|
+
}>()
|
|
69
|
+
|
|
70
|
+
const { enhance, setError } = useForm<ReturnData>({
|
|
71
|
+
...options,
|
|
72
|
+
async onSuccess(url, data) {
|
|
73
|
+
if (options.onSuccess) await options.onSuccess(url, data)
|
|
74
|
+
dispatch('success', { action: url, data })
|
|
75
|
+
const actionPath = url.pathname + url.search
|
|
76
|
+
if (actionPath.includes(action + actionDelete)) dispatch('deleted')
|
|
77
|
+
if (!data) return
|
|
78
|
+
if (actionPath.includes(action + actionCreate)) dispatch('created', data)
|
|
79
|
+
if (actionPath.includes(action + actionUpdate)) dispatch('updated', data)
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
const { handleInput, isDirty } = useHandleInput({ model, setError })
|
|
83
|
+
|
|
84
|
+
onMount(lookupValueFromParams)
|
|
85
|
+
$: $isDirty ? (dataInput = data) : (data = dataInput)
|
|
86
|
+
|
|
87
|
+
function lookupValueFromParams() {
|
|
88
|
+
fields.flat().forEach(({ key }) => {
|
|
89
|
+
if (data[key]) return
|
|
90
|
+
const value = $page.url.searchParams.get(key)
|
|
91
|
+
// TODO: fix data[key] type
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
if (value && key in data) data[key] = value
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const actionPadding = getActionPadding()
|
|
98
|
+
function getActionPadding(): string {
|
|
99
|
+
const container = contextContainer.get()
|
|
100
|
+
if (container === 'drawer') return 'bottom-0 -ml-8 -mr-4 pl-8 pr-4'
|
|
101
|
+
if (container === 'card') return 'bottom-0 -mx-2 sm:-mx-8 px-2 sm:px-8'
|
|
102
|
+
if (container === 'dialog') return '-bottom-4 -mx-4 px-4'
|
|
103
|
+
return 'bottom-0'
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const getBoolean = (bool?: BoolOrFunction<Shape>) => (_data: Nullable<Data>) =>
|
|
107
|
+
typeof bool === 'boolean' || bool === undefined ? !!bool : !!bool(_data)
|
|
90
108
|
</script>
|
|
91
109
|
|
|
92
110
|
<form
|
|
@@ -138,7 +156,7 @@ const getBoolean = (bool) => (_data) => typeof bool === "boolean" || bool === vo
|
|
|
138
156
|
"
|
|
139
157
|
>
|
|
140
158
|
<button class="btn btn-primary"> Valider </button>
|
|
141
|
-
<div class="grow"
|
|
159
|
+
<div class="grow"></div>
|
|
142
160
|
{#if !simpleAction && data.id && actionDelete}
|
|
143
161
|
{@const formaction = `${action}${actionDelete}`}
|
|
144
162
|
<slot name="delete" {formaction}>
|
|
@@ -20,6 +20,7 @@ declare class __sveltets_Render<Shape extends z.ZodRawShape, ReturnData extends
|
|
|
20
20
|
data?: Nullable<Data> | undefined;
|
|
21
21
|
set?: (<K extends keyof Shape>(key: K, value: Nullable<Data>[K]) => void) | undefined;
|
|
22
22
|
update?: ((updater: (currentData: Nullable<Data>) => Nullable<Data>) => void) | undefined;
|
|
23
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
23
24
|
};
|
|
24
25
|
events(): {
|
|
25
26
|
success: CustomEvent<{
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
<script generics="InputType extends FormInputsType">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts" generics="InputType extends FormInputsType">
|
|
2
|
+
import { formInputs, type FormInputProps, type FormInputsType } from './formInput.js'
|
|
3
|
+
|
|
4
|
+
type $$Props = FormInputProps<InputType> & {
|
|
5
|
+
type: InputType
|
|
6
|
+
value: FormInputProps<InputType>['value']
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let inputType: InputType
|
|
10
|
+
export { inputType as type }
|
|
11
|
+
export let value: FormInputProps<InputType>['value']
|
|
12
|
+
$: component = formInputs[inputType] as any
|
|
7
13
|
</script>
|
|
8
14
|
|
|
9
15
|
<svelte:component this={component} bind:value {...$$restProps} />
|
|
@@ -39,15 +39,21 @@ declare class __sveltets_Render<InputType extends FormInputsType> {
|
|
|
39
39
|
hide?: (() => void) | undefined;
|
|
40
40
|
show?: (() => void) | undefined;
|
|
41
41
|
setTippyProps?: ((props: Partial<import("tippy.js").Props>) => void) | undefined;
|
|
42
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
42
43
|
} | undefined;
|
|
43
44
|
flatMode?: boolean | undefined;
|
|
44
|
-
slotItem
|
|
45
|
-
slotSuggestion?:
|
|
45
|
+
slotItem: import("svelte").Snippet<[any]>;
|
|
46
|
+
slotSuggestion?: import("svelte").Snippet<[any]> | undefined;
|
|
46
47
|
input?: import("svelte/elements.js").HTMLInputAttributes | undefined;
|
|
48
|
+
append?: import("svelte").Snippet<[]> | undefined;
|
|
47
49
|
class?: string | undefined;
|
|
48
50
|
classList?: string | undefined;
|
|
49
51
|
clear?: (() => Promise<void>) | undefined;
|
|
50
52
|
}>): import("../index.js").InputRelation<any>;
|
|
53
|
+
element?: {
|
|
54
|
+
new (): HTMLElement;
|
|
55
|
+
prototype: HTMLElement;
|
|
56
|
+
} | undefined;
|
|
51
57
|
};
|
|
52
58
|
readonly relations: {
|
|
53
59
|
new (options: import("svelte").ComponentConstructorOptions<{
|
|
@@ -60,13 +66,18 @@ declare class __sveltets_Render<InputType extends FormInputsType> {
|
|
|
60
66
|
error?: string | undefined;
|
|
61
67
|
placeholder?: string | undefined;
|
|
62
68
|
flatMode?: boolean | undefined;
|
|
63
|
-
slotItem
|
|
64
|
-
slotSuggestion?:
|
|
69
|
+
slotItem: import("svelte").Snippet<[any]>;
|
|
70
|
+
slotSuggestion?: import("svelte").Snippet<[any]> | undefined;
|
|
65
71
|
input?: import("svelte/elements.js").HTMLInputAttributes | undefined;
|
|
72
|
+
append?: import("svelte").Snippet<[]> | undefined;
|
|
66
73
|
class?: string | undefined;
|
|
67
74
|
classList?: string | undefined;
|
|
68
75
|
value?: any[] | null | undefined;
|
|
69
76
|
}>): import("../index.js").InputRelations<any>;
|
|
77
|
+
element?: {
|
|
78
|
+
new (): HTMLElement;
|
|
79
|
+
prototype: HTMLElement;
|
|
80
|
+
} | undefined;
|
|
70
81
|
};
|
|
71
82
|
}[InputType]>> & {
|
|
72
83
|
type: InputType;
|
|
@@ -108,15 +119,21 @@ declare class __sveltets_Render<InputType extends FormInputsType> {
|
|
|
108
119
|
hide?: (() => void) | undefined;
|
|
109
120
|
show?: (() => void) | undefined;
|
|
110
121
|
setTippyProps?: ((props: Partial<import("tippy.js").Props>) => void) | undefined;
|
|
122
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
111
123
|
} | undefined;
|
|
112
124
|
flatMode?: boolean | undefined;
|
|
113
|
-
slotItem
|
|
114
|
-
slotSuggestion?:
|
|
125
|
+
slotItem: import("svelte").Snippet<[any]>;
|
|
126
|
+
slotSuggestion?: import("svelte").Snippet<[any]> | undefined;
|
|
115
127
|
input?: import("svelte/elements.js").HTMLInputAttributes | undefined;
|
|
128
|
+
append?: import("svelte").Snippet<[]> | undefined;
|
|
116
129
|
class?: string | undefined;
|
|
117
130
|
classList?: string | undefined;
|
|
118
131
|
clear?: (() => Promise<void>) | undefined;
|
|
119
132
|
}>): import("../index.js").InputRelation<any>;
|
|
133
|
+
element?: {
|
|
134
|
+
new (): HTMLElement;
|
|
135
|
+
prototype: HTMLElement;
|
|
136
|
+
} | undefined;
|
|
120
137
|
};
|
|
121
138
|
readonly relations: {
|
|
122
139
|
new (options: import("svelte").ComponentConstructorOptions<{
|
|
@@ -129,13 +146,18 @@ declare class __sveltets_Render<InputType extends FormInputsType> {
|
|
|
129
146
|
error?: string | undefined;
|
|
130
147
|
placeholder?: string | undefined;
|
|
131
148
|
flatMode?: boolean | undefined;
|
|
132
|
-
slotItem
|
|
133
|
-
slotSuggestion?:
|
|
149
|
+
slotItem: import("svelte").Snippet<[any]>;
|
|
150
|
+
slotSuggestion?: import("svelte").Snippet<[any]> | undefined;
|
|
134
151
|
input?: import("svelte/elements.js").HTMLInputAttributes | undefined;
|
|
152
|
+
append?: import("svelte").Snippet<[]> | undefined;
|
|
135
153
|
class?: string | undefined;
|
|
136
154
|
classList?: string | undefined;
|
|
137
155
|
value?: any[] | null | undefined;
|
|
138
156
|
}>): import("../index.js").InputRelations<any>;
|
|
157
|
+
element?: {
|
|
158
|
+
new (): HTMLElement;
|
|
159
|
+
prototype: HTMLElement;
|
|
160
|
+
} | undefined;
|
|
139
161
|
};
|
|
140
162
|
}[InputType]>>["value"];
|
|
141
163
|
};
|
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { slide } from 'svelte/transition'
|
|
3
|
+
import { mdiChevronRight } from '@mdi/js'
|
|
4
|
+
import { Icon } from '../icon/index.js'
|
|
5
|
+
type Props = { isActive?: boolean; class?: string; contentClass?: string }
|
|
6
|
+
type $$Props = Props &
|
|
7
|
+
({ isReducible: true; title: string } | { isReducible?: false; title?: string })
|
|
8
|
+
|
|
9
|
+
export let title = ''
|
|
10
|
+
export let isActive = false
|
|
11
|
+
export let isReducible = false
|
|
12
|
+
|
|
13
|
+
let klass = ''
|
|
14
|
+
export { klass as class }
|
|
15
|
+
export let contentClass = ''
|
|
16
|
+
|
|
17
|
+
function open() {
|
|
18
|
+
isActive = true
|
|
19
|
+
}
|
|
20
|
+
function toggle(event: Event) {
|
|
21
|
+
event.stopPropagation()
|
|
22
|
+
isActive = !isActive
|
|
23
|
+
}
|
|
17
24
|
</script>
|
|
18
25
|
|
|
19
26
|
<div>
|
|
@@ -44,7 +51,7 @@ function toggle(event) {
|
|
|
44
51
|
{/if}
|
|
45
52
|
</slot>
|
|
46
53
|
{#if isReducible}
|
|
47
|
-
<div class="grow"
|
|
54
|
+
<div class="grow"></div>
|
|
48
55
|
<button
|
|
49
56
|
type="button"
|
|
50
57
|
on:click={toggle}
|
|
@@ -60,11 +60,13 @@ export declare function relationProps<Item extends {
|
|
|
60
60
|
hide?: (() => void) | undefined;
|
|
61
61
|
show?: (() => void) | undefined;
|
|
62
62
|
setTippyProps?: ((props: Partial<import("tippy.js").Props>) => void) | undefined;
|
|
63
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
63
64
|
} | undefined;
|
|
64
65
|
flatMode?: boolean | undefined;
|
|
65
|
-
slotItem
|
|
66
|
-
slotSuggestion?:
|
|
66
|
+
slotItem: import("svelte").Snippet<[Item]>;
|
|
67
|
+
slotSuggestion?: import("svelte").Snippet<[Item]> | undefined;
|
|
67
68
|
input?: import("svelte/elements").HTMLInputAttributes | undefined;
|
|
69
|
+
append?: import("svelte").Snippet<[]> | undefined;
|
|
68
70
|
class?: string | undefined;
|
|
69
71
|
classList?: string | undefined;
|
|
70
72
|
clear?: (() => Promise<void>) | undefined;
|
|
@@ -81,9 +83,10 @@ export declare function relationsProps<Item extends {
|
|
|
81
83
|
error?: string | undefined;
|
|
82
84
|
placeholder?: string | undefined;
|
|
83
85
|
flatMode?: boolean | undefined;
|
|
84
|
-
slotItem
|
|
85
|
-
slotSuggestion?:
|
|
86
|
+
slotItem: import("svelte").Snippet<[Item]>;
|
|
87
|
+
slotSuggestion?: import("svelte").Snippet<[Item]> | undefined;
|
|
86
88
|
input?: import("svelte/elements").HTMLInputAttributes | undefined;
|
|
89
|
+
append?: import("svelte").Snippet<[]> | undefined;
|
|
87
90
|
class?: string | undefined;
|
|
88
91
|
classList?: string | undefined;
|
|
89
92
|
value?: Item[] | null | undefined;
|
package/dist/ui/icon/Icon.svelte
CHANGED
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export let
|
|
6
|
-
let
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export let
|
|
11
|
-
export let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tippy, type TippyProps, type TippyInstance } from '../../utils/tippy.js'
|
|
3
|
+
import { onMount } from 'svelte'
|
|
4
|
+
|
|
5
|
+
export let path: string
|
|
6
|
+
export let title = ''
|
|
7
|
+
export let size = 22
|
|
8
|
+
let klass = ''
|
|
9
|
+
export { klass as class }
|
|
10
|
+
export let style = ''
|
|
11
|
+
export let classSVG = ''
|
|
12
|
+
export let tippyProps: Partial<TippyProps> = {}
|
|
13
|
+
export let disableTitlePropagation = false
|
|
14
|
+
const viewWidth = 24
|
|
15
|
+
const viewHeight = 24
|
|
16
|
+
|
|
17
|
+
let icon: HTMLElement
|
|
18
|
+
|
|
19
|
+
let tip: TippyInstance | null = null
|
|
20
|
+
$: tip?.setContent(title)
|
|
21
|
+
|
|
22
|
+
onMount(() => {
|
|
23
|
+
if (!title) return
|
|
24
|
+
const parent = icon.parentElement
|
|
25
|
+
const isButton = parent?.tagName === 'BUTTON' || parent?.tagName === 'A'
|
|
26
|
+
const target = parent && isButton && !disableTitlePropagation ? parent : icon
|
|
27
|
+
tip = tippy(target || icon, {
|
|
28
|
+
content: title,
|
|
29
|
+
trigger: 'mouseenter',
|
|
30
|
+
...tippyProps
|
|
31
|
+
})
|
|
32
|
+
return () => {
|
|
33
|
+
tip?.destroy()
|
|
34
|
+
}
|
|
35
|
+
})
|
|
33
36
|
</script>
|
|
34
37
|
|
|
35
38
|
<i bind:this={icon} class="grid place-content-center fill-base-content {klass}" {style}>
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ export * from './dialog/index.js';
|
|
|
11
11
|
export * from './placeholder/index.js';
|
|
12
12
|
export * from './icon/index.js';
|
|
13
13
|
export * from './login/index.js';
|
|
14
|
-
export * from './slot/index.js';
|
|
15
14
|
export * from './pagination/index.js';
|
|
16
15
|
export * from './mode/index.js';
|
|
17
16
|
export * from './badge/index.js';
|
package/dist/ui/index.js
CHANGED
|
@@ -11,7 +11,6 @@ export * from './dialog/index.js';
|
|
|
11
11
|
export * from './placeholder/index.js';
|
|
12
12
|
export * from './icon/index.js';
|
|
13
13
|
export * from './login/index.js';
|
|
14
|
-
export * from './slot/index.js';
|
|
15
14
|
export * from './pagination/index.js';
|
|
16
15
|
export * from './mode/index.js';
|
|
17
16
|
export * from './badge/index.js';
|
|
@@ -1,35 +1,41 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
export let
|
|
9
|
-
export let
|
|
10
|
-
export let
|
|
11
|
-
export let
|
|
12
|
-
export let
|
|
13
|
-
export let
|
|
14
|
-
export let
|
|
15
|
-
export let
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { slide } from 'svelte/transition'
|
|
3
|
+
import { onMount, type Snippet } from 'svelte'
|
|
4
|
+
import { formContext } from '../../validation/form.js'
|
|
5
|
+
|
|
6
|
+
let klass = ''
|
|
7
|
+
export { klass as class }
|
|
8
|
+
export let classLabel = ''
|
|
9
|
+
export let key = ''
|
|
10
|
+
export let label: Snippet | string = ''
|
|
11
|
+
export let labelAppend: Snippet | null = null
|
|
12
|
+
export let error = ''
|
|
13
|
+
export let hint = ''
|
|
14
|
+
export let prefix: string | number = ''
|
|
15
|
+
export let prefixFor: string | number = ''
|
|
16
|
+
export let enhanceDisabled = false
|
|
17
|
+
export let labelPosition: LabelPosition = 'top'
|
|
18
|
+
export let children: Snippet<[{ key: string }]> | undefined = undefined
|
|
19
|
+
|
|
20
|
+
type LabelPosition = 'top' | 'left' | 'right'
|
|
21
|
+
|
|
22
|
+
$: _key = prefix && key ? `${prefix}_${key}` : key || ''
|
|
23
|
+
|
|
24
|
+
if (!enhanceDisabled) {
|
|
25
|
+
const { setError } = formContext.get()
|
|
26
|
+
setError[key] = (err) => (error = err)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let formControl: HTMLDivElement
|
|
30
|
+
onMount(() => {
|
|
31
|
+
const input = formControl.querySelector('input, textarea')
|
|
32
|
+
if (!input) return
|
|
33
|
+
const handleInput = () => (error = '')
|
|
34
|
+
input.addEventListener('input', handleInput)
|
|
35
|
+
return () => {
|
|
36
|
+
input.removeEventListener('input', handleInput)
|
|
37
|
+
}
|
|
38
|
+
})
|
|
33
39
|
</script>
|
|
34
40
|
|
|
35
41
|
<div class="form-control {klass}" bind:this={formControl}>
|
|
@@ -44,15 +50,21 @@ onMount(() => {
|
|
|
44
50
|
{#if label}
|
|
45
51
|
<label for="{prefixFor}{_key}" class="label cursor-pointer {classLabel}">
|
|
46
52
|
<span class="label-text">
|
|
47
|
-
|
|
53
|
+
{#if typeof label === 'string'}
|
|
54
|
+
{label}
|
|
55
|
+
{:else}
|
|
56
|
+
{@render label()}
|
|
57
|
+
{/if}
|
|
48
58
|
</span>
|
|
49
|
-
|
|
59
|
+
{#if labelAppend}
|
|
60
|
+
{@render labelAppend()}
|
|
61
|
+
{/if}
|
|
50
62
|
</label>
|
|
51
63
|
{/if}
|
|
52
|
-
|
|
53
|
-
<slot key={_key} />
|
|
54
64
|
</div>
|
|
55
65
|
|
|
66
|
+
{@render children?.({ key: _key })}
|
|
67
|
+
|
|
56
68
|
{#if error}
|
|
57
69
|
<label for="{prefixFor}{_key}" class="label" transition:slide>
|
|
58
70
|
<span class="label-text-alt text-warning">{error}</span>
|