@sjsf/skeleton-theme 2.0.0-next.0 → 2.0.0-next.10
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 +3 -3
- package/dist/components/button.svelte +25 -10
- package/dist/components/button.svelte.d.ts +1 -0
- package/dist/components/description.svelte +7 -2
- package/dist/components/description.svelte.d.ts +1 -0
- package/dist/components/errors-list.svelte +10 -4
- package/dist/components/errors-list.svelte.d.ts +2 -3
- package/dist/components/exports.d.ts +1 -0
- package/dist/components/exports.js +1 -0
- package/dist/components/form.svelte +3 -3
- package/dist/components/form.svelte.d.ts +1 -0
- package/dist/components/help.svelte +7 -2
- package/dist/components/help.svelte.d.ts +1 -0
- package/dist/components/label.svelte +15 -0
- package/dist/components/label.svelte.d.ts +6 -0
- package/dist/components/layout.svelte +4 -7
- package/dist/components/layout.svelte.d.ts +1 -0
- package/dist/components/submit-button.svelte +4 -3
- package/dist/components/submit-button.svelte.d.ts +1 -0
- package/dist/components/title.svelte +11 -12
- package/dist/components/title.svelte.d.ts +1 -2
- package/dist/definitions.d.ts +6 -71
- package/dist/definitions.js +0 -1
- package/dist/extra-widgets/checkboxes-include.d.ts +6 -0
- package/dist/extra-widgets/checkboxes-include.js +4 -0
- package/dist/{widgets → extra-widgets}/checkboxes.svelte +2 -2
- package/dist/{widgets → extra-widgets}/checkboxes.svelte.d.ts +1 -0
- package/dist/extra-widgets/date-picker-include.d.ts +5 -0
- package/dist/extra-widgets/date-picker-include.js +2 -2
- package/dist/extra-widgets/date-picker.svelte +5 -3
- package/dist/extra-widgets/file-include.d.ts +6 -0
- package/dist/extra-widgets/file-include.js +4 -0
- package/dist/{widgets → extra-widgets}/file.svelte +6 -8
- package/dist/{widgets → extra-widgets}/file.svelte.d.ts +1 -0
- package/dist/extra-widgets/multi-select-include.d.ts +5 -0
- package/dist/extra-widgets/multi-select-include.js +2 -2
- package/dist/extra-widgets/multi-select.svelte +6 -5
- package/dist/extra-widgets/radio-include.d.ts +6 -1
- package/dist/extra-widgets/radio-include.js +4 -4
- package/dist/extra-widgets/radio.svelte +1 -1
- package/dist/extra-widgets/range-include.d.ts +5 -0
- package/dist/extra-widgets/range-include.js +2 -2
- package/dist/extra-widgets/range.svelte +5 -3
- package/dist/extra-widgets/textarea-include.d.ts +6 -1
- package/dist/extra-widgets/textarea-include.js +4 -4
- package/dist/extra-widgets/textarea.svelte +2 -5
- package/dist/index.d.ts +1 -107
- package/dist/index.js +0 -4
- package/dist/specs.d.ts +10 -0
- package/dist/specs.js +16 -0
- package/dist/styles.css +1 -1
- package/dist/widgets/checkbox.svelte +7 -5
- package/dist/widgets/checkbox.svelte.d.ts +1 -0
- package/dist/widgets/exports.d.ts +0 -2
- package/dist/widgets/exports.js +0 -2
- package/dist/widgets/number.svelte +2 -2
- package/dist/widgets/number.svelte.d.ts +1 -0
- package/dist/widgets/select.svelte +2 -3
- package/dist/widgets/select.svelte.d.ts +1 -0
- package/dist/widgets/text.svelte +3 -2
- package/dist/widgets/text.svelte.d.ts +1 -0
- package/package.json +26 -20
package/README.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
The [skeleton](https://github.com/skeletonlabs/skeleton) v3 (tailwind v3) based theme for [svelte-jsonschema-form](https://github.com/x0k/svelte-jsonschema-form).
|
|
4
4
|
|
|
5
|
-
- [Documentation](https://x0k.github.io/svelte-jsonschema-form/themes/skeleton/)
|
|
6
|
-
- [Playground](https://x0k.github.io/svelte-jsonschema-form/
|
|
5
|
+
- [Documentation](https://x0k.github.io/svelte-jsonschema-form/v2/themes/skeleton/)
|
|
6
|
+
- [Playground](https://x0k.github.io/svelte-jsonschema-form/playground2/)
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
10
|
```shell
|
|
11
|
-
npm install @sjsf/form @sjsf/skeleton-theme
|
|
11
|
+
npm install @sjsf/form@next @sjsf/skeleton-theme@next
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## Usage
|
|
@@ -1,19 +1,34 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
3
|
+
import {
|
|
4
|
+
composeProps,
|
|
5
|
+
disabledProp,
|
|
6
|
+
getFormContext,
|
|
7
|
+
uiOptionNestedProps,
|
|
8
|
+
uiOptionProps,
|
|
9
|
+
type ComponentProps
|
|
10
|
+
} from '@sjsf/form';
|
|
11
|
+
import '@sjsf/basic-theme/components/button.svelte';
|
|
3
12
|
|
|
4
13
|
const { children, onclick, config, disabled, type }: ComponentProps['button'] = $props();
|
|
5
14
|
|
|
6
15
|
const ctx = getFormContext();
|
|
7
|
-
|
|
8
|
-
const attributes = $derived(
|
|
9
|
-
defineDisabled(ctx, {
|
|
10
|
-
disabled,
|
|
11
|
-
...config.uiOptions?.button,
|
|
12
|
-
...config.uiOptions?.buttons?.[type]
|
|
13
|
-
})
|
|
14
|
-
);
|
|
15
16
|
</script>
|
|
16
17
|
|
|
17
|
-
<button
|
|
18
|
+
<button
|
|
19
|
+
class="btn preset-filled"
|
|
20
|
+
{...composeProps(
|
|
21
|
+
ctx,
|
|
22
|
+
config,
|
|
23
|
+
{
|
|
24
|
+
type: 'button',
|
|
25
|
+
disabled,
|
|
26
|
+
onclick
|
|
27
|
+
} satisfies HTMLButtonAttributes,
|
|
28
|
+
uiOptionProps('button'),
|
|
29
|
+
uiOptionNestedProps('buttons', (b) => b[type]),
|
|
30
|
+
disabledProp
|
|
31
|
+
)}
|
|
32
|
+
>
|
|
18
33
|
{@render children()}
|
|
19
34
|
</button>
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type
|
|
2
|
+
import { descriptionAttributes, getFormContext, type ComponentProps } from '@sjsf/form';
|
|
3
|
+
import '@sjsf/basic-theme/components/description.svelte';
|
|
3
4
|
|
|
4
5
|
const { description, config }: ComponentProps['description'] = $props();
|
|
6
|
+
|
|
7
|
+
const ctx = getFormContext();
|
|
5
8
|
</script>
|
|
6
9
|
|
|
7
|
-
<div class="opacity-60" {...config
|
|
10
|
+
<div class="opacity-60" {...descriptionAttributes(ctx, config, 'descriptionAttributes', {})}>
|
|
11
|
+
{description}
|
|
12
|
+
</div>
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type
|
|
2
|
+
import { errorsListAttributes, getFormContext, type ComponentProps } from '@sjsf/form';
|
|
3
|
+
import '@sjsf/basic-theme/components/errors-list.svelte';
|
|
3
4
|
|
|
4
|
-
const { errors,
|
|
5
|
+
const { errors, config }: ComponentProps['errorsList'] = $props();
|
|
6
|
+
|
|
7
|
+
const ctx = getFormContext();
|
|
5
8
|
</script>
|
|
6
9
|
|
|
7
|
-
<
|
|
10
|
+
<ul
|
|
11
|
+
class="text-error-500 list-disc list-inside"
|
|
12
|
+
{...errorsListAttributes(ctx, config, 'errorsList', {})}
|
|
13
|
+
>
|
|
8
14
|
{#each errors as err}
|
|
9
15
|
<li>{err.message}</li>
|
|
10
16
|
{/each}
|
|
11
|
-
</
|
|
17
|
+
</ul>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}, {}, "">;
|
|
1
|
+
import '@sjsf/basic-theme/components/errors-list.svelte';
|
|
2
|
+
declare const ErrorsList: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps, {}, "">;
|
|
4
3
|
type ErrorsList = ReturnType<typeof ErrorsList>;
|
|
5
4
|
export default ErrorsList;
|
|
@@ -3,6 +3,7 @@ export { default as submitButton } from './submit-button.svelte';
|
|
|
3
3
|
export { default as button } from './button.svelte';
|
|
4
4
|
export { default as layout } from './layout.svelte';
|
|
5
5
|
export { default as title } from './title.svelte';
|
|
6
|
+
export { default as label } from "./label.svelte";
|
|
6
7
|
export { default as description } from './description.svelte';
|
|
7
8
|
export { default as help } from './help.svelte';
|
|
8
9
|
export { default as errorsList } from './errors-list.svelte';
|
|
@@ -3,6 +3,7 @@ export { default as submitButton } from './submit-button.svelte';
|
|
|
3
3
|
export { default as button } from './button.svelte';
|
|
4
4
|
export { default as layout } from './layout.svelte';
|
|
5
5
|
export { default as title } from './title.svelte';
|
|
6
|
+
export { default as label } from "./label.svelte";
|
|
6
7
|
export { default as description } from './description.svelte';
|
|
7
8
|
export { default as help } from './help.svelte';
|
|
8
9
|
export { default as errorsList } from './errors-list.svelte';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { enhance, getFormContext, type ComponentProps } from '@sjsf/form';
|
|
2
|
+
import { enhance, formAttributes, getFormContext, type ComponentProps } from '@sjsf/form';
|
|
3
|
+
import '@sjsf/basic-theme/components/form.svelte';
|
|
3
4
|
|
|
4
5
|
let { config, children, ref = $bindable(), attributes }: ComponentProps['form'] = $props();
|
|
5
6
|
|
|
@@ -10,8 +11,7 @@
|
|
|
10
11
|
bind:this={ref}
|
|
11
12
|
use:enhance={ctx}
|
|
12
13
|
class="flex flex-col gap-4"
|
|
13
|
-
{...config
|
|
14
|
-
{...attributes}
|
|
14
|
+
{...formAttributes(ctx, config, 'form', attributes, {})}
|
|
15
15
|
>
|
|
16
16
|
{@render children?.()}
|
|
17
17
|
</form>
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type
|
|
2
|
+
import { getFormContext, helpAttributes, type ComponentProps } from '@sjsf/form';
|
|
3
|
+
import '@sjsf/basic-theme/components/help.svelte';
|
|
3
4
|
|
|
4
5
|
const { help, config }: ComponentProps['help'] = $props();
|
|
6
|
+
|
|
7
|
+
const ctx = getFormContext();
|
|
5
8
|
</script>
|
|
6
9
|
|
|
7
|
-
<div class="opacity-60" {...config
|
|
10
|
+
<div class="opacity-60" {...helpAttributes(ctx, config, 'helpAttributes', {})}>
|
|
11
|
+
{help}
|
|
12
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getFormContext, labelAttributes, type ComponentProps } from '@sjsf/form';
|
|
3
|
+
import '@sjsf/basic-theme/components/label.svelte';
|
|
4
|
+
|
|
5
|
+
const { title, config }: ComponentProps['label'] = $props();
|
|
6
|
+
|
|
7
|
+
const ctx = getFormContext();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<label class="label-text" {...labelAttributes(ctx, config, 'labelAttributes', { })}>
|
|
11
|
+
{title}
|
|
12
|
+
{#if config.required}
|
|
13
|
+
<span>*</span>
|
|
14
|
+
{/if}
|
|
15
|
+
</label>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type
|
|
2
|
+
import { getFormContext, layoutAttributes, type ComponentProps } from '@sjsf/form';
|
|
3
|
+
import '@sjsf/basic-theme/components/layout.svelte';
|
|
3
4
|
|
|
4
5
|
const { type, children, config }: ComponentProps['layout'] = $props();
|
|
5
6
|
|
|
@@ -22,10 +23,7 @@
|
|
|
22
23
|
type === 'object-properties'
|
|
23
24
|
);
|
|
24
25
|
|
|
25
|
-
const
|
|
26
|
-
...config.uiOptions?.layout,
|
|
27
|
-
...config.uiOptions?.layouts?.[type]
|
|
28
|
-
});
|
|
26
|
+
const ctx = getFormContext();
|
|
29
27
|
</script>
|
|
30
28
|
|
|
31
29
|
<div
|
|
@@ -35,8 +33,7 @@
|
|
|
35
33
|
class:items-start={isItemOrControls}
|
|
36
34
|
class:grow={isGrowable}
|
|
37
35
|
class:flex-col={isColumn || isField}
|
|
38
|
-
|
|
39
|
-
{...attributes}
|
|
36
|
+
{...layoutAttributes(ctx, config, 'layout', 'layouts', type, {})}
|
|
40
37
|
>
|
|
41
38
|
{@render children()}
|
|
42
39
|
</div>
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { buttonAttributes, getFormContext, type ComponentProps } from '@sjsf/form';
|
|
3
|
+
import '@sjsf/basic-theme/components/submit-button.svelte';
|
|
3
4
|
|
|
4
5
|
const { children, config }: ComponentProps['submitButton'] = $props();
|
|
5
6
|
|
|
6
7
|
const ctx = getFormContext();
|
|
7
8
|
|
|
8
|
-
const attributes = $derived(
|
|
9
|
+
const attributes = $derived(buttonAttributes(ctx, config, 'submitButton', 'submit', {}));
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
|
-
<button class="btn preset-filled preset-filled-primary-500 w-full"
|
|
12
|
+
<button class="btn preset-filled preset-filled-primary-500 w-full" {...attributes}>
|
|
12
13
|
{@render children()}
|
|
13
14
|
</button>
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type
|
|
2
|
+
import { getFormContext, titleAttributes, type ComponentProps } from '@sjsf/form';
|
|
3
|
+
import '@sjsf/basic-theme/components/title.svelte';
|
|
3
4
|
|
|
4
|
-
const { title, type,
|
|
5
|
+
const { title, type, config }: ComponentProps['title'] = $props();
|
|
6
|
+
|
|
7
|
+
const ctx = getFormContext();
|
|
5
8
|
</script>
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</label>
|
|
14
|
-
{:else}
|
|
15
|
-
<div class="font-bold text-2xl" {...config.uiOptions?.titleAttributes}>{title}</div>
|
|
16
|
-
{/if}
|
|
10
|
+
<div
|
|
11
|
+
class={type === 'field' ? 'label-text' : 'font-bold text-xl'}
|
|
12
|
+
{...titleAttributes(ctx, config, 'titleAttributes', {})}
|
|
13
|
+
>
|
|
14
|
+
{title}
|
|
15
|
+
</div>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import '@sjsf/basic-theme/components/title.svelte';
|
|
1
2
|
declare const Title: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
|
|
2
3
|
type: import("@sjsf/form/templates/components").ParentTemplateType;
|
|
3
4
|
title: string;
|
|
4
|
-
forId: string;
|
|
5
|
-
required: boolean;
|
|
6
5
|
}, {}, "">;
|
|
7
6
|
type Title = ReturnType<typeof Title>;
|
|
8
7
|
export default Title;
|
package/dist/definitions.d.ts
CHANGED
|
@@ -1,72 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentDefinitions } from '@sjsf/form';
|
|
2
2
|
import * as templates from '@sjsf/form/templates/exports';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
checkboxesWidget: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<import("@sjsf/form/core").SchemaArrayValue> & import("@sjsf/form/fields/widgets").Options, {}, "value">;
|
|
9
|
-
fileWidget: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<FileList> & {
|
|
10
|
-
multiple: boolean;
|
|
11
|
-
loading: boolean;
|
|
12
|
-
processing: boolean;
|
|
13
|
-
}, {}, "value">;
|
|
14
|
-
form: import("svelte").Component<{
|
|
15
|
-
config: import("@sjsf/form").Config;
|
|
16
|
-
ref?: HTMLFormElement | undefined;
|
|
17
|
-
children: import("svelte").Snippet;
|
|
18
|
-
attributes?: import("svelte/elements").HTMLFormAttributes | undefined;
|
|
19
|
-
}, {}, "ref">;
|
|
20
|
-
submitButton: import("svelte").Component<{
|
|
21
|
-
config: import("@sjsf/form").Config;
|
|
22
|
-
children: import("svelte").Snippet;
|
|
23
|
-
}, {}, "">;
|
|
24
|
-
button: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
|
|
25
|
-
type: import("@sjsf/form/fields/components").ButtonType;
|
|
26
|
-
disabled: boolean;
|
|
27
|
-
children: import("svelte").Snippet;
|
|
28
|
-
onclick: () => void;
|
|
29
|
-
}, {}, "">;
|
|
30
|
-
layout: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
|
|
31
|
-
type: import("@sjsf/form/fields/components").LayoutType;
|
|
32
|
-
children: import("svelte").Snippet;
|
|
33
|
-
}, {}, "">;
|
|
34
|
-
title: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
|
|
35
|
-
type: templates.ParentTemplateType;
|
|
36
|
-
title: string;
|
|
37
|
-
forId: string;
|
|
38
|
-
required: boolean;
|
|
39
|
-
}, {}, "">;
|
|
40
|
-
description: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
|
|
41
|
-
type: templates.ParentTemplateType;
|
|
42
|
-
description: string;
|
|
43
|
-
}, {}, "">;
|
|
44
|
-
help: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
|
|
45
|
-
help: string;
|
|
46
|
-
}, {}, "">;
|
|
47
|
-
errorsList: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
|
|
48
|
-
forId: string;
|
|
49
|
-
}, {}, "">;
|
|
50
|
-
fieldTemplate: import("svelte").Component<import("@sjsf/form/fields/templates").TemplateCommonProps<import("@sjsf/form").SchemaValue> & {
|
|
51
|
-
showTitle: boolean;
|
|
52
|
-
}, {}, "">;
|
|
53
|
-
objectTemplate: import("svelte").Component<import("@sjsf/form/fields/templates").TemplateCommonProps<import("@sjsf/form/core").SchemaObjectValue> & {
|
|
54
|
-
addButton?: import("svelte").Snippet;
|
|
55
|
-
}, {}, "">;
|
|
56
|
-
objectPropertyTemplate: import("svelte").Component<import("@sjsf/form/fields/templates").TemplateCommonProps<import("@sjsf/form").SchemaValue> & {
|
|
57
|
-
property: string;
|
|
58
|
-
keyInput?: import("svelte").Snippet;
|
|
59
|
-
removeButton?: import("svelte").Snippet;
|
|
60
|
-
}, {}, "">;
|
|
61
|
-
arrayTemplate: import("svelte").Component<import("@sjsf/form/fields/templates").TemplateCommonProps<import("@sjsf/form/core").SchemaArrayValue> & {
|
|
62
|
-
addButton?: import("svelte").Snippet;
|
|
63
|
-
}, {}, "">;
|
|
64
|
-
arrayItemTemplate: import("svelte").Component<import("@sjsf/form/fields/templates").TemplateCommonProps<import("@sjsf/form").SchemaValue> & {
|
|
65
|
-
index: number;
|
|
66
|
-
buttons?: import("svelte").Snippet;
|
|
67
|
-
}, {}, "">;
|
|
68
|
-
multiFieldTemplate: import("svelte").Component<import("@sjsf/form/fields/templates").TemplateCommonProps<import("@sjsf/form").SchemaValue> & {
|
|
69
|
-
optionSelector: import("svelte").Snippet;
|
|
70
|
-
}, {}, "">;
|
|
71
|
-
};
|
|
72
|
-
export declare const extendable: ExtendableComponentDefinitionsWithoutFields;
|
|
3
|
+
import * as components from './components/exports';
|
|
4
|
+
import * as widgets from './widgets/exports';
|
|
5
|
+
export interface ExtraWidgets {
|
|
6
|
+
}
|
|
7
|
+
export declare const definitions: typeof templates & typeof components & typeof widgets & Pick<ComponentDefinitions, keyof ExtraWidgets>;
|
package/dist/definitions.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getFormContext, inputAttributes, type ComponentProps } from '@sjsf/form';
|
|
3
3
|
import { multipleOptions, indexMapper } from '@sjsf/form/options.svelte';
|
|
4
|
+
import '@sjsf/basic-theme/extra-widgets/checkboxes.svelte';
|
|
4
5
|
|
|
5
6
|
let {
|
|
6
7
|
handlers,
|
|
@@ -18,14 +19,13 @@
|
|
|
18
19
|
const ctx = getFormContext();
|
|
19
20
|
|
|
20
21
|
const attributes = $derived(
|
|
21
|
-
inputAttributes(ctx, config, handlers,
|
|
22
|
+
inputAttributes(ctx, config, 'checkboxes', handlers, { type: 'checkbox' })
|
|
22
23
|
);
|
|
23
24
|
</script>
|
|
24
25
|
|
|
25
26
|
{#each options as option, index (option.id)}
|
|
26
27
|
<label class="flex items-center space-x-2 cursor-pointer">
|
|
27
28
|
<input
|
|
28
|
-
type="checkbox"
|
|
29
29
|
class="checkbox"
|
|
30
30
|
bind:group={mapped.value}
|
|
31
31
|
value={index}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import '@sjsf/basic-theme/extra-widgets/checkboxes.svelte';
|
|
1
2
|
declare const Checkboxes: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<import("@sjsf/form/core").SchemaArrayValue> & import("@sjsf/form/fields/widgets").Options, {}, "value">;
|
|
2
3
|
type Checkboxes = ReturnType<typeof Checkboxes>;
|
|
3
4
|
export default Checkboxes;
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
let { value = $bindable(), config, handlers }: ComponentProps['datePickerWidget'] = $props();
|
|
6
6
|
|
|
7
7
|
const ctx = getFormContext();
|
|
8
|
-
|
|
9
|
-
const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.datePicker));
|
|
10
8
|
</script>
|
|
11
9
|
|
|
12
|
-
<input
|
|
10
|
+
<input
|
|
11
|
+
bind:value
|
|
12
|
+
class="input"
|
|
13
|
+
{...inputAttributes(ctx, config, 'datePicker', handlers, { type: 'date' })}
|
|
14
|
+
/>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getFormContext, inputAttributes, type ComponentProps } from '@sjsf/form';
|
|
3
|
+
import '@sjsf/basic-theme/extra-widgets/file.svelte';
|
|
3
4
|
|
|
4
5
|
let {
|
|
5
6
|
config,
|
|
@@ -11,18 +12,15 @@
|
|
|
11
12
|
}: ComponentProps['fileWidget'] = $props();
|
|
12
13
|
|
|
13
14
|
const ctx = getFormContext();
|
|
14
|
-
|
|
15
|
-
const attributes = $derived(
|
|
16
|
-
inputAttributes(ctx, config, handlers, config.uiOptions?.file)
|
|
17
|
-
);
|
|
18
15
|
</script>
|
|
19
16
|
|
|
20
17
|
<input
|
|
21
18
|
type="file"
|
|
22
19
|
bind:files={value}
|
|
23
|
-
{multiple}
|
|
24
20
|
class="input"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
{...inputAttributes(ctx, config, 'file', handlers, {
|
|
22
|
+
multiple,
|
|
23
|
+
'data-loading': loading,
|
|
24
|
+
'data-processing': processing
|
|
25
|
+
})}
|
|
28
26
|
/>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { definitions } from '../definitions.js';
|
|
2
2
|
import MultiSelect from './multi-select.svelte';
|
|
3
3
|
import './multi-select.svelte';
|
|
4
|
-
|
|
4
|
+
definitions.multiSelectWidget = MultiSelect;
|
|
@@ -12,10 +12,6 @@
|
|
|
12
12
|
|
|
13
13
|
const ctx = getFormContext();
|
|
14
14
|
|
|
15
|
-
const attributes = $derived(
|
|
16
|
-
selectAttributes(ctx, config, handlers, config.uiOptions?.multiSelect)
|
|
17
|
-
);
|
|
18
|
-
|
|
19
15
|
const mapped = $derived(
|
|
20
16
|
multipleOptions({
|
|
21
17
|
mapper: () => indexMapper(options),
|
|
@@ -25,7 +21,12 @@
|
|
|
25
21
|
);
|
|
26
22
|
</script>
|
|
27
23
|
|
|
28
|
-
<select
|
|
24
|
+
<select
|
|
25
|
+
multiple
|
|
26
|
+
bind:value={mapped.value}
|
|
27
|
+
class="select"
|
|
28
|
+
{...selectAttributes(ctx, config, 'select', handlers, {})}
|
|
29
|
+
>
|
|
29
30
|
{#each options as option, index (option.id)}
|
|
30
31
|
<option value={index} disabled={option.disabled}>
|
|
31
32
|
{option.label}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import Radio from
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { definitions } from '../definitions.js';
|
|
2
|
+
import Radio from './radio.svelte';
|
|
3
|
+
import './radio.svelte';
|
|
4
|
+
definitions.radioWidget = Radio;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
const ctx = getFormContext();
|
|
15
15
|
|
|
16
|
-
const attributes = $derived(inputAttributes(ctx, config, handlers,
|
|
16
|
+
const attributes = $derived(inputAttributes(ctx, config, 'radio', handlers, {}));
|
|
17
17
|
</script>
|
|
18
18
|
|
|
19
19
|
{#each options as option, index (option.id)}
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
let { value = $bindable(), config, handlers }: ComponentProps['rangeWidget'] = $props();
|
|
6
6
|
|
|
7
7
|
const ctx = getFormContext();
|
|
8
|
-
|
|
9
|
-
const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.range));
|
|
10
8
|
</script>
|
|
11
9
|
|
|
12
|
-
<input
|
|
10
|
+
<input
|
|
11
|
+
bind:value={() => value ?? 0, (v) => (value = v)}
|
|
12
|
+
class="range grow w-0"
|
|
13
|
+
{...inputAttributes(ctx, config, 'range', handlers, { type: 'range' })}
|
|
14
|
+
/>
|