fuma 1.0.10 → 1.0.12
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/index.d.ts +0 -2
- package/dist/action/list/index.js +0 -1
- package/dist/action/list/trigger.d.ts +1 -7
- package/dist/action/list/trigger.js +2 -2
- package/dist/ui/button/ButtonCopy.svelte +8 -2
- package/dist/ui/button/ButtonCopy.svelte.d.ts +2 -0
- package/dist/ui/drawer/Drawer.svelte +1 -1
- package/dist/ui/form/Form.svelte +5 -6
- package/dist/ui/form/Form.svelte.d.ts +0 -1
- package/dist/ui/form/FormInput.svelte.d.ts +8 -14
- package/dist/ui/form/FormSection.svelte +1 -1
- package/dist/ui/form/formInput.d.ts +4 -7
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.js +1 -0
- package/dist/ui/input/FormControl.svelte +8 -14
- package/dist/ui/input/FormControl.svelte.d.ts +10 -5
- package/dist/ui/input/InputBoolean.svelte +14 -16
- package/dist/ui/input/InputBoolean.svelte.d.ts +1 -2
- package/dist/ui/input/InputCheckboxs.svelte +14 -15
- package/dist/ui/input/InputCheckboxs.svelte.d.ts +1 -2
- package/dist/ui/input/InputCheckboxsMenu.svelte +12 -13
- package/dist/ui/input/InputCheckboxsMenu.svelte.d.ts +1 -2
- package/dist/ui/input/InputCheckboxsTreeNodes.svelte +1 -1
- package/dist/ui/input/InputCombo.svelte +31 -33
- package/dist/ui/input/InputCombo.svelte.d.ts +1 -2
- package/dist/ui/input/InputDate.svelte +12 -14
- package/dist/ui/input/InputDateTime.svelte +12 -14
- package/dist/ui/input/InputNumber.svelte +17 -18
- package/dist/ui/input/InputNumber.svelte.d.ts +5 -1
- package/dist/ui/input/InputPassword.svelte +13 -15
- package/dist/ui/input/InputPassword.svelte.d.ts +1 -2
- package/dist/ui/input/InputRadio.svelte +14 -15
- package/dist/ui/input/InputRadio.svelte.d.ts +1 -2
- package/dist/ui/input/InputRelation.svelte +51 -52
- package/dist/ui/input/InputRelation.svelte.d.ts +18 -12
- package/dist/ui/input/InputRelations.svelte +18 -11
- package/dist/ui/input/InputRelations.svelte.d.ts +18 -11
- package/dist/ui/input/InputSearch.svelte +1 -1
- package/dist/ui/input/InputSelect.svelte +18 -20
- package/dist/ui/input/InputText.svelte +21 -21
- package/dist/ui/input/InputText.svelte.d.ts +3 -0
- package/dist/ui/input/InputTextarea.svelte +13 -14
- package/dist/ui/input/InputTextarea.svelte.d.ts +5 -1
- package/dist/ui/input/InputTime.svelte +12 -14
- package/dist/ui/input/SelectorList.svelte +1 -1
- package/dist/ui/input/SelectorList.svelte.d.ts +5 -5
- package/dist/ui/input/textRich/InputTextRich.svelte +9 -11
- package/dist/ui/input/textRich/InputTextRich.svelte.d.ts +1 -2
- package/dist/ui/input/textRich/ToolMarkColor.svelte +1 -1
- package/dist/ui/input/textRich/ToolsBar.svelte +2 -2
- package/dist/ui/login/Login.svelte +1 -1
- package/dist/ui/mode/ToggleMode.svelte +3 -14
- package/dist/ui/mode/ToggleMode.svelte.d.ts +0 -2
- package/dist/ui/range/RangePicker.svelte +1 -1
- package/dist/ui/slot/Slot.svelte +52 -0
- package/dist/ui/slot/Slot.svelte.d.ts +22 -0
- package/dist/ui/slot/Span.svelte +5 -0
- package/dist/ui/slot/Span.svelte.d.ts +16 -0
- package/dist/ui/slot/index.d.ts +1 -0
- package/dist/ui/slot/index.js +1 -0
- package/package.json +34 -34
|
@@ -23,19 +23,17 @@
|
|
|
23
23
|
}
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
|
-
<FormControl {...$$restProps}>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/>
|
|
26
|
+
<FormControl {...$$restProps} let:key>
|
|
27
|
+
<input
|
|
28
|
+
value={value && dayjs(value).format('YYYY-MM-DDTHH:mm')}
|
|
29
|
+
on:input={handleInput}
|
|
30
|
+
on:focus
|
|
31
|
+
on:blur
|
|
32
|
+
type="datetime-local"
|
|
33
|
+
id={key}
|
|
34
|
+
class="input input-bordered {inputClass}"
|
|
35
|
+
{...inputProps}
|
|
36
|
+
/>
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
{/snippet}
|
|
38
|
+
<input type="hidden" name={key} value="{USE_COERCE_DATE}{value?.toJSON()}" />
|
|
41
39
|
</FormControl>
|
|
@@ -10,22 +10,21 @@
|
|
|
10
10
|
export let inputElement: HTMLInputElement | undefined = undefined
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
|
-
<FormControl {...$$restProps}>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
{/snippet}
|
|
13
|
+
<FormControl {...$$restProps} let:key>
|
|
14
|
+
<slot name="label_append" slot="label_append" />
|
|
15
|
+
<input
|
|
16
|
+
bind:value
|
|
17
|
+
bind:this={inputElement}
|
|
18
|
+
on:input
|
|
19
|
+
on:focus
|
|
20
|
+
on:blur
|
|
21
|
+
type="number"
|
|
22
|
+
id={key}
|
|
23
|
+
inputmode="numeric"
|
|
24
|
+
class="input input-bordered"
|
|
25
|
+
{...input}
|
|
26
|
+
/>
|
|
27
|
+
{#if value !== undefined}
|
|
28
|
+
<input type="hidden" name={key} value="{USE_COERCE_NUMBER}{value}" />
|
|
29
|
+
{/if}
|
|
31
30
|
</FormControl>
|
|
@@ -9,7 +9,11 @@ declare const __propDef: {
|
|
|
9
9
|
} & {
|
|
10
10
|
[evt: string]: CustomEvent<any>;
|
|
11
11
|
};
|
|
12
|
-
slots: {
|
|
12
|
+
slots: {
|
|
13
|
+
label_append: {
|
|
14
|
+
slot: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
13
17
|
};
|
|
14
18
|
export type InputNumberProps = typeof __propDef.props;
|
|
15
19
|
export type InputNumberEvents = typeof __propDef.events;
|
|
@@ -7,19 +7,17 @@
|
|
|
7
7
|
export let autocomplete = 'current-password'
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
|
-
<FormControl {...props}>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/>
|
|
24
|
-
{/snippet}
|
|
10
|
+
<FormControl {...props} let:key>
|
|
11
|
+
<input
|
|
12
|
+
bind:value
|
|
13
|
+
on:input
|
|
14
|
+
on:focus
|
|
15
|
+
on:blur
|
|
16
|
+
type="password"
|
|
17
|
+
name={key}
|
|
18
|
+
id={key}
|
|
19
|
+
class="input input-bordered"
|
|
20
|
+
{autocomplete}
|
|
21
|
+
{...input}
|
|
22
|
+
/>
|
|
25
23
|
</FormControl>
|
|
@@ -4,8 +4,7 @@ declare const __propDef: {
|
|
|
4
4
|
class?: string | undefined;
|
|
5
5
|
classLabel?: string | undefined;
|
|
6
6
|
key?: string | undefined;
|
|
7
|
-
label?: string | import("svelte").
|
|
8
|
-
labelAppend?: import("svelte").Snippet<[]> | null | undefined;
|
|
7
|
+
label?: string | import("svelte").ComponentType | import("../../index.js").ComponentAndProps | undefined;
|
|
9
8
|
error?: string | undefined;
|
|
10
9
|
hint?: string | undefined;
|
|
11
10
|
prefix?: string | number | undefined;
|
|
@@ -48,26 +48,25 @@
|
|
|
48
48
|
{#each _options as option}
|
|
49
49
|
<FormControl
|
|
50
50
|
{...props}
|
|
51
|
+
let:key
|
|
51
52
|
enhanceDisabled
|
|
52
53
|
label={option.label}
|
|
53
54
|
prefixFor={option.value}
|
|
54
55
|
class="flex-row-reverse items-center justify-end gap-2"
|
|
55
56
|
>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
/>
|
|
70
|
-
{/snippet}
|
|
57
|
+
<input
|
|
58
|
+
use:bindValueWithParams={{ bindEnable: props.bindWithParams }}
|
|
59
|
+
bind:group={value}
|
|
60
|
+
on:input
|
|
61
|
+
on:focus
|
|
62
|
+
on:blur
|
|
63
|
+
value={option.value}
|
|
64
|
+
type="radio"
|
|
65
|
+
name={key}
|
|
66
|
+
id="{option.value}{key}"
|
|
67
|
+
class="radio"
|
|
68
|
+
{...input}
|
|
69
|
+
/>
|
|
71
70
|
</FormControl>
|
|
72
71
|
{/each}
|
|
73
72
|
</div>
|
|
@@ -5,8 +5,7 @@ declare const __propDef: {
|
|
|
5
5
|
class?: string | undefined;
|
|
6
6
|
classLabel?: string | undefined;
|
|
7
7
|
key?: string | undefined;
|
|
8
|
-
label?: string | import("svelte").
|
|
9
|
-
labelAppend?: import("svelte").Snippet<[]> | null | undefined;
|
|
8
|
+
label?: string | import("svelte").ComponentType | import("../../index.js").ComponentAndProps | undefined;
|
|
10
9
|
error?: string | undefined;
|
|
11
10
|
hint?: string | undefined;
|
|
12
11
|
prefix?: string | number | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<script lang="ts" generics="RelationItem extends {id: string
|
|
2
|
-
import { createEventDispatcher, tick, type ComponentProps
|
|
1
|
+
<script lang="ts" generics="RelationItem extends {id: string}">
|
|
2
|
+
import { createEventDispatcher, tick, type ComponentProps } from 'svelte'
|
|
3
3
|
import type { HTMLInputAttributes } from 'svelte/elements'
|
|
4
4
|
import debounce from 'debounce'
|
|
5
5
|
import { toast } from 'svelte-sonner'
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
import { USE_COERCE_JSON } from '../../utils/constant.js'
|
|
9
9
|
import { Icon } from '../icon/index.js'
|
|
10
|
+
import { Slot } from '../slot/index.js'
|
|
10
11
|
import { DropDown } from '../menu/index.js'
|
|
11
12
|
import { FormControl, SelectorList } from './index.js'
|
|
12
13
|
import type { TippyProps } from '../../utils/tippy.js'
|
|
14
|
+
import type { ComponentAndProps } from '../../utils/component.js'
|
|
13
15
|
import RelationAfter from './RelationAfter.svelte'
|
|
14
16
|
|
|
15
17
|
export let key = Math.random().toString()
|
|
@@ -25,11 +27,9 @@
|
|
|
25
27
|
export let tippyProps: Partial<TippyProps> = {}
|
|
26
28
|
export let dropdownProps: ComponentProps<DropDown> = {}
|
|
27
29
|
export let flatMode = false
|
|
28
|
-
export let
|
|
29
|
-
export let
|
|
30
|
-
export let slotSuggestion: Snippet<[RelationItem]> = slotItem
|
|
30
|
+
export let slotItem: ((item: RelationItem) => ComponentAndProps | string) | null = null
|
|
31
|
+
export let slotSuggestion: ((item: RelationItem) => ComponentAndProps | string) | null = slotItem
|
|
31
32
|
export let input: HTMLInputAttributes | undefined = undefined
|
|
32
|
-
export let append: Snippet | undefined = undefined
|
|
33
33
|
|
|
34
34
|
let klass = ''
|
|
35
35
|
export { klass as class }
|
|
@@ -85,53 +85,48 @@
|
|
|
85
85
|
|
|
86
86
|
<DropDown {tippyProps} disable={flatMode} {...dropdownProps}>
|
|
87
87
|
<div class="contents" slot="activator">
|
|
88
|
-
<FormControl {key} {label} {error} class={klass}>
|
|
89
|
-
|
|
90
|
-
<div class="flex grow
|
|
91
|
-
<div class="input input-bordered flex grow items-center pr-2">
|
|
92
|
-
<input
|
|
93
|
-
type="text"
|
|
94
|
-
id={key}
|
|
95
|
-
bind:this={inputElement}
|
|
96
|
-
bind:value={searchValue}
|
|
97
|
-
on:input={(e) => searchItemsDebounce(e.currentTarget.value)}
|
|
98
|
-
on:focus={handleFocus}
|
|
99
|
-
on:blur={handleBlur}
|
|
100
|
-
autocomplete="off"
|
|
101
|
-
{placeholder}
|
|
102
|
-
class="grow"
|
|
103
|
-
size={8}
|
|
104
|
-
{...input}
|
|
105
|
-
/>
|
|
106
|
-
<RelationAfter {isLoading} {createUrl} {createTitle} {createIcon} />
|
|
107
|
-
</div>
|
|
108
|
-
{@render append?.()}
|
|
109
|
-
</div>
|
|
110
|
-
|
|
111
|
-
{#if item}
|
|
112
|
-
{#if noSlotItemWrapper}
|
|
113
|
-
{@render slotItem(item)}
|
|
114
|
-
{:else}
|
|
115
|
-
<div class="flex h-12 items-center gap-2 rounded-lg border bg-base-100 pl-4 pr-2">
|
|
116
|
-
<div class="grow">
|
|
117
|
-
{@render slotItem(item)}
|
|
118
|
-
</div>
|
|
119
|
-
<button
|
|
120
|
-
type="button"
|
|
121
|
-
on:click|stopPropagation={() => clear()}
|
|
122
|
-
class="btn btn-square btn-sm"
|
|
123
|
-
>
|
|
124
|
-
<Icon path={mdiClose} />
|
|
125
|
-
</button>
|
|
126
|
-
</div>
|
|
127
|
-
{/if}
|
|
88
|
+
<FormControl {key} {label} {error} class={klass} let:key>
|
|
89
|
+
<div class="flex grow gap-2" class:hidden={item}>
|
|
90
|
+
<div class="input input-bordered flex grow items-center pr-2">
|
|
128
91
|
<input
|
|
129
|
-
type="
|
|
130
|
-
|
|
131
|
-
|
|
92
|
+
type="text"
|
|
93
|
+
id={key}
|
|
94
|
+
bind:this={inputElement}
|
|
95
|
+
bind:value={searchValue}
|
|
96
|
+
on:input={(e) => searchItemsDebounce(e.currentTarget.value)}
|
|
97
|
+
on:focus={handleFocus}
|
|
98
|
+
on:blur={handleBlur}
|
|
99
|
+
autocomplete="off"
|
|
100
|
+
{placeholder}
|
|
101
|
+
class="grow"
|
|
102
|
+
size={8}
|
|
103
|
+
{...input}
|
|
132
104
|
/>
|
|
133
|
-
|
|
134
|
-
|
|
105
|
+
|
|
106
|
+
<RelationAfter {isLoading} {createUrl} {createTitle} {createIcon} />
|
|
107
|
+
</div>
|
|
108
|
+
<slot name="append" />
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
{#if item}
|
|
112
|
+
<div class="flex h-12 items-center gap-2 rounded-lg border bg-base-100 pl-4 pr-2">
|
|
113
|
+
<div class="grow">
|
|
114
|
+
<slot name="item" {item}>
|
|
115
|
+
<Slot slot={slotItem} args={item}>
|
|
116
|
+
{item.id}
|
|
117
|
+
</Slot>
|
|
118
|
+
</slot>
|
|
119
|
+
</div>
|
|
120
|
+
<button type="button" on:click={() => clear()} class="btn btn-square btn-sm">
|
|
121
|
+
<Icon path={mdiClose} />
|
|
122
|
+
</button>
|
|
123
|
+
</div>
|
|
124
|
+
<input
|
|
125
|
+
type="hidden"
|
|
126
|
+
name={key}
|
|
127
|
+
value="{USE_COERCE_JSON}{JSON.stringify({ id: item.id })}"
|
|
128
|
+
/>
|
|
129
|
+
{/if}
|
|
135
130
|
</FormControl>
|
|
136
131
|
</div>
|
|
137
132
|
|
|
@@ -145,6 +140,10 @@
|
|
|
145
140
|
class="w-full min-w-40 {classList}"
|
|
146
141
|
on:select={({ detail }) => select(detail)}
|
|
147
142
|
>
|
|
148
|
-
{
|
|
143
|
+
<slot name="suggestion" item={proposedItems[index]}>
|
|
144
|
+
<Slot slot={slotSuggestion} args={proposedItems[index]}>
|
|
145
|
+
{proposedItems[index].id}
|
|
146
|
+
</Slot>
|
|
147
|
+
</slot>
|
|
149
148
|
</SelectorList>
|
|
150
149
|
</DropDown>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import { type Snippet } from 'svelte';
|
|
3
2
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
4
3
|
import type { TippyProps } from '../../utils/tippy.js';
|
|
4
|
+
import type { ComponentAndProps } from '../../utils/component.js';
|
|
5
5
|
declare class __sveltets_Render<RelationItem extends {
|
|
6
|
-
id: string
|
|
6
|
+
id: string;
|
|
7
7
|
}> {
|
|
8
8
|
props(): {
|
|
9
9
|
key?: string | undefined;
|
|
@@ -31,14 +31,12 @@ declare class __sveltets_Render<RelationItem extends {
|
|
|
31
31
|
hide?: (() => void) | undefined;
|
|
32
32
|
show?: (() => void) | undefined;
|
|
33
33
|
setTippyProps?: ((props: Partial<TippyProps>) => void) | undefined;
|
|
34
|
-
children?: Snippet<[]> | undefined;
|
|
34
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
35
35
|
} | undefined;
|
|
36
36
|
flatMode?: boolean | undefined;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
slotSuggestion?: Snippet<[RelationItem]> | undefined;
|
|
37
|
+
slotItem?: ((item: RelationItem) => string | ComponentAndProps) | null | undefined;
|
|
38
|
+
slotSuggestion?: ((item: RelationItem) => string | ComponentAndProps) | null | undefined;
|
|
40
39
|
input?: HTMLInputAttributes | undefined;
|
|
41
|
-
append?: Snippet<[]> | undefined;
|
|
42
40
|
class?: string | undefined;
|
|
43
41
|
classList?: string | undefined;
|
|
44
42
|
clear?: (() => Promise<void>) | undefined;
|
|
@@ -50,19 +48,27 @@ declare class __sveltets_Render<RelationItem extends {
|
|
|
50
48
|
} & {
|
|
51
49
|
[evt: string]: CustomEvent<any>;
|
|
52
50
|
};
|
|
53
|
-
slots(): {
|
|
51
|
+
slots(): {
|
|
52
|
+
append: {};
|
|
53
|
+
item: {
|
|
54
|
+
item: RelationItem | null;
|
|
55
|
+
};
|
|
56
|
+
suggestion: {
|
|
57
|
+
item: RelationItem;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
54
60
|
}
|
|
55
61
|
export type InputRelationProps<RelationItem extends {
|
|
56
|
-
id: string
|
|
62
|
+
id: string;
|
|
57
63
|
}> = ReturnType<__sveltets_Render<RelationItem>['props']>;
|
|
58
64
|
export type InputRelationEvents<RelationItem extends {
|
|
59
|
-
id: string
|
|
65
|
+
id: string;
|
|
60
66
|
}> = ReturnType<__sveltets_Render<RelationItem>['events']>;
|
|
61
67
|
export type InputRelationSlots<RelationItem extends {
|
|
62
|
-
id: string
|
|
68
|
+
id: string;
|
|
63
69
|
}> = ReturnType<__sveltets_Render<RelationItem>['slots']>;
|
|
64
70
|
export default class InputRelation<RelationItem extends {
|
|
65
|
-
id: string
|
|
71
|
+
id: string;
|
|
66
72
|
}> extends SvelteComponent<InputRelationProps<RelationItem>, InputRelationEvents<RelationItem>, InputRelationSlots<RelationItem>> {
|
|
67
73
|
get clear(): () => Promise<void>;
|
|
68
74
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<script lang="ts" generics="RelationItem extends {id: string
|
|
1
|
+
<script lang="ts" generics="RelationItem extends {id: string}">
|
|
2
2
|
import type { HTMLInputAttributes } from 'svelte/elements'
|
|
3
3
|
|
|
4
|
-
import { createEventDispatcher, tick
|
|
4
|
+
import { createEventDispatcher, tick } from 'svelte'
|
|
5
5
|
import { slide } from 'svelte/transition'
|
|
6
6
|
import { toast } from 'svelte-sonner'
|
|
7
7
|
import { mdiClose } from '@mdi/js'
|
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
import { USE_COERCE_JSON } from '../../utils/constant.js'
|
|
11
11
|
import { Icon } from '../icon/index.js'
|
|
12
|
+
import { Slot } from '../slot/index.js'
|
|
12
13
|
import { FormControl, SelectorList } from './index.js'
|
|
13
14
|
import { DropDown } from '../menu/index.js'
|
|
15
|
+
import type { ComponentAndProps } from '../../utils/component.js'
|
|
14
16
|
import RelationAfter from './RelationAfter.svelte'
|
|
15
17
|
|
|
16
18
|
export let key = ''
|
|
@@ -22,10 +24,9 @@
|
|
|
22
24
|
export let error = ''
|
|
23
25
|
export let placeholder = ''
|
|
24
26
|
export let flatMode = false
|
|
25
|
-
export let slotItem:
|
|
26
|
-
export let slotSuggestion:
|
|
27
|
+
export let slotItem: ((item: RelationItem) => ComponentAndProps | string) | null = null
|
|
28
|
+
export let slotSuggestion: ((item: RelationItem) => ComponentAndProps | string) | null = slotItem
|
|
27
29
|
export let input: HTMLInputAttributes | undefined = undefined
|
|
28
|
-
export let append: Snippet | undefined = undefined
|
|
29
30
|
|
|
30
31
|
let klass = ''
|
|
31
32
|
export { klass as class }
|
|
@@ -41,9 +42,7 @@
|
|
|
41
42
|
let searchValue = ''
|
|
42
43
|
|
|
43
44
|
let dropdown: DropDown
|
|
44
|
-
const dispatch = createEventDispatcher<{
|
|
45
|
-
input: { value: (string | number)[]; items: RelationItem[] }
|
|
46
|
-
}>()
|
|
45
|
+
const dispatch = createEventDispatcher<{ input: { value: string[]; items: RelationItem[] } }>()
|
|
47
46
|
let inputSearch: HTMLInputElement
|
|
48
47
|
|
|
49
48
|
async function select(index = focusIndex) {
|
|
@@ -104,7 +103,11 @@
|
|
|
104
103
|
transition:slide|local={{ axis: 'x', duration: 200 }}
|
|
105
104
|
class="badge badge-outline badge-lg items-center whitespace-nowrap pr-0 text-right"
|
|
106
105
|
>
|
|
107
|
-
{
|
|
106
|
+
<slot {item} name="item">
|
|
107
|
+
<Slot slot={slotItem} args={item}>
|
|
108
|
+
{item.id}
|
|
109
|
+
</Slot>
|
|
110
|
+
</slot>
|
|
108
111
|
<div
|
|
109
112
|
class="btn btn-circle btn-ghost btn-xs ml-1 mr-[2px] h-[18px] min-h-[18px] w-[18px]"
|
|
110
113
|
role="button"
|
|
@@ -137,7 +140,7 @@
|
|
|
137
140
|
|
|
138
141
|
<RelationAfter {isLoading} {createUrl} {createTitle} {createIcon} />
|
|
139
142
|
</div>
|
|
140
|
-
|
|
143
|
+
<slot name="append" />
|
|
141
144
|
</div>
|
|
142
145
|
</div>
|
|
143
146
|
|
|
@@ -159,6 +162,10 @@
|
|
|
159
162
|
class="w-full min-w-40 {classList}"
|
|
160
163
|
on:select={({ detail }) => select(detail)}
|
|
161
164
|
>
|
|
162
|
-
{
|
|
165
|
+
<slot name="suggestion" item={proposedItems[index]}>
|
|
166
|
+
<Slot slot={slotSuggestion} args={proposedItems[index]}>
|
|
167
|
+
{proposedItems[index].id}
|
|
168
|
+
</Slot>
|
|
169
|
+
</slot>
|
|
163
170
|
</SelectorList>
|
|
164
171
|
</DropDown>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
-
import {
|
|
3
|
+
import type { ComponentAndProps } from '../../utils/component.js';
|
|
4
4
|
declare class __sveltets_Render<RelationItem extends {
|
|
5
|
-
id: string
|
|
5
|
+
id: string;
|
|
6
6
|
}> {
|
|
7
7
|
props(): {
|
|
8
8
|
key?: string | undefined;
|
|
@@ -14,35 +14,42 @@ declare class __sveltets_Render<RelationItem extends {
|
|
|
14
14
|
error?: string | undefined;
|
|
15
15
|
placeholder?: string | undefined;
|
|
16
16
|
flatMode?: boolean | undefined;
|
|
17
|
-
slotItem:
|
|
18
|
-
slotSuggestion?:
|
|
17
|
+
slotItem?: ((item: RelationItem) => string | ComponentAndProps) | null | undefined;
|
|
18
|
+
slotSuggestion?: ((item: RelationItem) => string | ComponentAndProps) | null | undefined;
|
|
19
19
|
input?: HTMLInputAttributes | undefined;
|
|
20
|
-
append?: Snippet<[]> | undefined;
|
|
21
20
|
class?: string | undefined;
|
|
22
21
|
classList?: string | undefined;
|
|
23
22
|
value?: RelationItem[] | null | undefined;
|
|
24
23
|
};
|
|
25
24
|
events(): {
|
|
26
25
|
input: CustomEvent<{
|
|
27
|
-
value:
|
|
26
|
+
value: string[];
|
|
28
27
|
items: RelationItem[];
|
|
29
28
|
}>;
|
|
30
29
|
} & {
|
|
31
30
|
[evt: string]: CustomEvent<any>;
|
|
32
31
|
};
|
|
33
|
-
slots(): {
|
|
32
|
+
slots(): {
|
|
33
|
+
item: {
|
|
34
|
+
item: RelationItem;
|
|
35
|
+
};
|
|
36
|
+
append: {};
|
|
37
|
+
suggestion: {
|
|
38
|
+
item: RelationItem;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
34
41
|
}
|
|
35
42
|
export type InputRelationsProps<RelationItem extends {
|
|
36
|
-
id: string
|
|
43
|
+
id: string;
|
|
37
44
|
}> = ReturnType<__sveltets_Render<RelationItem>['props']>;
|
|
38
45
|
export type InputRelationsEvents<RelationItem extends {
|
|
39
|
-
id: string
|
|
46
|
+
id: string;
|
|
40
47
|
}> = ReturnType<__sveltets_Render<RelationItem>['events']>;
|
|
41
48
|
export type InputRelationsSlots<RelationItem extends {
|
|
42
|
-
id: string
|
|
49
|
+
id: string;
|
|
43
50
|
}> = ReturnType<__sveltets_Render<RelationItem>['slots']>;
|
|
44
51
|
export default class InputRelations<RelationItem extends {
|
|
45
|
-
id: string
|
|
52
|
+
id: string;
|
|
46
53
|
}> extends SvelteComponent<InputRelationsProps<RelationItem>, InputRelationsEvents<RelationItem>, InputRelationsSlots<RelationItem>> {
|
|
47
54
|
}
|
|
48
55
|
export {};
|
|
@@ -41,28 +41,26 @@
|
|
|
41
41
|
|
|
42
42
|
<DropDown bind:this={dropDown}>
|
|
43
43
|
<svelte:fragment slot="activator">
|
|
44
|
-
<FormControl {...props}>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
{#if selectedOption}
|
|
53
|
-
{
|
|
54
|
-
<Icon path={selectedOption.icon} size={21} class="opacity-70" />
|
|
55
|
-
{/if}
|
|
56
|
-
<span>{selectedOption.label}</span>
|
|
57
|
-
{:else if placeholder}
|
|
58
|
-
<span class="opacity-60">{placeholder}</span>
|
|
44
|
+
<FormControl {...props} let:key>
|
|
45
|
+
<button
|
|
46
|
+
bind:this={button}
|
|
47
|
+
id={key}
|
|
48
|
+
type="button"
|
|
49
|
+
class="input-bordered flex h-12 items-center gap-2 rounded-lg border pl-4 pr-2 hover:bg-base-200/50"
|
|
50
|
+
>
|
|
51
|
+
{#if selectedOption}
|
|
52
|
+
{#if selectedOption.icon}
|
|
53
|
+
<Icon path={selectedOption.icon} size={21} class="opacity-70" />
|
|
59
54
|
{/if}
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<input type="hidden" name={key} {value} />
|
|
55
|
+
<span>{selectedOption.label}</span>
|
|
56
|
+
{:else if placeholder}
|
|
57
|
+
<span class="opacity-60">{placeholder}</span>
|
|
64
58
|
{/if}
|
|
65
|
-
|
|
59
|
+
<Icon class="ml-auto" path={mdiUnfoldMoreHorizontal} size={18} />
|
|
60
|
+
</button>
|
|
61
|
+
{#if value !== undefined}
|
|
62
|
+
<input type="hidden" name={key} {value} />
|
|
63
|
+
{/if}
|
|
66
64
|
</FormControl>
|
|
67
65
|
</svelte:fragment>
|
|
68
66
|
|
|
@@ -9,25 +9,25 @@
|
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
11
|
<FormControl {...props} enhanceDisabled={props.enhanceDisabled || bindWithParams} let:key>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
12
|
+
<slot name="label_append" slot="label_append" />
|
|
13
|
+
|
|
14
|
+
<div class={classWrapper}>
|
|
15
|
+
<slot name="prepend" {value} />
|
|
16
|
+
<input
|
|
17
|
+
bind:value
|
|
18
|
+
on:input
|
|
19
|
+
on:focus
|
|
20
|
+
on:blur
|
|
21
|
+
on:keydown
|
|
22
|
+
on:keyup
|
|
23
|
+
bind:this={inputElement}
|
|
24
|
+
use:bindValueWithParams={{ bindEnable: bindWithParams, initValue: (v) => (value = v) }}
|
|
25
|
+
type="text"
|
|
26
|
+
name={key}
|
|
27
|
+
id={key}
|
|
28
|
+
class="input input-bordered w-full {inputClass || ''}"
|
|
29
|
+
{...inputProps}
|
|
30
|
+
/>
|
|
31
|
+
<slot name="append" {value} />
|
|
32
|
+
</div>
|
|
33
33
|
</FormControl>
|