@soleil-se/config-svelte 1.25.0 → 1.26.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/CHANGELOG.md
CHANGED
|
@@ -7,9 +7,17 @@ All notable changes to this project will be documented in this file.
|
|
|
7
7
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
8
8
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
9
9
|
|
|
10
|
-
## [1.
|
|
10
|
+
## [1.26.0] - 2024-05-21
|
|
11
11
|
|
|
12
|
-
- Add
|
|
12
|
+
- Add possibility to customize content for radio buttons in a radio group.
|
|
13
|
+
|
|
14
|
+
## [1.25.1] - 2024-05-13
|
|
15
|
+
|
|
16
|
+
- Now possible to set default value in `SelectField` with `value` prop.
|
|
17
|
+
|
|
18
|
+
## [1.25.0] - 2024-05-07
|
|
19
|
+
|
|
20
|
+
- Add callback to `createConfigApp` function for more flexibility when creating a config app.
|
|
13
21
|
- Rewrite of `CustomList` edit modal handling to work with Svelte 5.
|
|
14
22
|
- Remove all self closing tags in components.
|
|
15
23
|
- Remove `focus-visible` polyfill.
|
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
export let readonly = false;
|
|
24
24
|
/** @type {number} */
|
|
25
25
|
export let rows = 3;
|
|
26
|
-
|
|
27
|
-
export let value = '';
|
|
26
|
+
|
|
28
27
|
/** @type {function} */
|
|
29
28
|
export let action = prefixHttps;
|
|
30
29
|
/** @type {boolean} */
|
|
@@ -34,16 +33,18 @@
|
|
|
34
33
|
/** @type {string} */
|
|
35
34
|
export { className as class };
|
|
36
35
|
|
|
36
|
+
/** @type {string} */
|
|
37
|
+
export let value = '';
|
|
37
38
|
value = name ? values[name] ?? value : value;
|
|
38
39
|
|
|
39
40
|
$: isTextarea = type === 'textarea';
|
|
40
41
|
$: isRequired = required && !disabled && !readonly;
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
function onInput({ target }) {
|
|
43
44
|
value = type.match(/^(number|range)$/) ? +target.value : target.value;
|
|
44
45
|
dispatch('input', value);
|
|
45
46
|
dispatch('change', value);
|
|
46
|
-
}
|
|
47
|
+
}
|
|
47
48
|
</script>
|
|
48
49
|
|
|
49
50
|
<!--
|
|
@@ -70,6 +70,45 @@ onSave(() => values);
|
|
|
70
70
|
</Panel>
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
+
## Slots
|
|
74
|
+
|
|
75
|
+
### Default
|
|
76
|
+
|
|
77
|
+
Default slot after radio group.
|
|
78
|
+
|
|
79
|
+
```svelte
|
|
80
|
+
<RadioGroup name="radioGroup" legend="Radio group" {options} />
|
|
81
|
+
<p class="help-block">Some helpful text.</p>
|
|
82
|
+
</RadioGroup>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Legend
|
|
86
|
+
|
|
87
|
+
Slot for content in the legend element.
|
|
88
|
+
|
|
89
|
+
```svelte
|
|
90
|
+
<RadioGroup name="radioGroup" {options} />
|
|
91
|
+
<svelte:fragment slot="legend">
|
|
92
|
+
Custom <em>legend</em>
|
|
93
|
+
</svelte:fragment>
|
|
94
|
+
</RadioGroup>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Label
|
|
98
|
+
|
|
99
|
+
Slot for content in each radio buttons label.
|
|
100
|
+
The provided option parameter contains the full option object corresponding to the specific radio button
|
|
101
|
+
as provided in the slots array to the RadioGroup.
|
|
102
|
+
|
|
103
|
+
```svelte
|
|
104
|
+
<RadioGroup name="radioGroup" {options} />
|
|
105
|
+
<svelte:fragment slot="option" let:option>
|
|
106
|
+
<span>{option.label || option}</span>
|
|
107
|
+
<span>Custom <em>content</em></span>
|
|
108
|
+
</svelte:fragment>
|
|
109
|
+
</RadioGroup>
|
|
110
|
+
```
|
|
111
|
+
|
|
73
112
|
## Default value
|
|
74
113
|
|
|
75
114
|
Use the value attribute to set a default value:
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
export let disabled = false;
|
|
13
13
|
export let show = true;
|
|
14
14
|
export let options = [];
|
|
15
|
-
export let value = '';
|
|
16
|
-
value = name ? values[name] ?? value : value;
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
export let value;
|
|
17
|
+
value = name ? values[name] ?? value : value;
|
|
18
|
+
function onChange() {
|
|
19
19
|
dispatch('change', value);
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
<!--
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
<slot name="label">{label}</slot>
|
|
32
32
|
</label>
|
|
33
33
|
<select {id} {name} class="form-control" {disabled} {required} bind:value on:change={onChange}>
|
|
34
|
+
<option disabled hidden selected value=""></option>
|
|
34
35
|
{#each options as option}
|
|
35
36
|
<option value={option.value ?? option}>
|
|
36
37
|
{option.label ?? option}
|