@soleil-se/config-svelte 1.22.0 → 1.24.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 +30 -23
- package/components/Checkbox/Component.svelte +9 -5
- package/components/CheckboxGroup/Component.svelte +4 -1
- package/components/CustomList/Component.svelte +17 -9
- package/components/CustomList/CustomListItemTemplate.svelte +3 -0
- package/components/CustomList/README.md +102 -10
- package/components/CustomList/index.js +1 -0
- package/components/CustomList/internal/AddModal.svelte +4 -2
- package/components/CustomList/internal/EditModal.svelte +2 -2
- package/components/CustomList/internal/Sortable.svelte +4 -4
- package/components/CustomList/internal/SortableItem.svelte +4 -3
- package/components/CustomSelector/Component.svelte +5 -1
- package/components/DropdownSelector/Component.svelte +3 -1
- package/components/ImageSelector/Component.svelte +5 -5
- package/components/InputField/Component.svelte +9 -9
- package/components/ListSelector/Component.svelte +5 -3
- package/components/NodeSelector/Component.svelte +8 -8
- package/components/NumberSpinner/Component.svelte +6 -4
- package/components/RadioGroup/Component.svelte +4 -1
- package/components/RepositoryNodeSelector/Component.svelte +6 -4
- package/components/SelectField/Component.svelte +4 -3
- package/components/TagSelector/Component.svelte +5 -5
- package/components/TextList/Component.svelte +5 -3
- package/createConfigApp/index.js +1 -0
- package/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,28 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
title: Changelog
|
|
3
|
+
---
|
|
2
4
|
|
|
3
5
|
All notable changes to this project will be documented in this file.
|
|
4
6
|
|
|
5
7
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
8
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
9
|
|
|
10
|
+
## [1.23.0] - 2024-03-07
|
|
11
|
+
|
|
12
|
+
- List item templating in `CustomList` with [CustomListItemTemplate](/packages/soleil/svelte-config/components/customlist/#list-item-template).
|
|
13
|
+
- Trigger manual update of `CustomList` with [triggerUpdate](/packages/soleil/svelte-config/components/customlist/#dynamic-content) function.
|
|
14
|
+
|
|
8
15
|
## [1.22.0] - 2024-02-13
|
|
9
16
|
|
|
10
17
|
- More lenient `@sitevision/api` peer dependency range.
|
|
11
|
-
- Try to use `window.sv.getValues()`
|
|
18
|
+
- Try to use `window.sv.getValues()` first since `window._getValues()` is deprecated.
|
|
12
19
|
|
|
13
20
|
## [1.21.0] - 2023-10-13
|
|
14
21
|
|
|
15
|
-
- Add `legendVisuallyHidden` prop for [RadioGroup](
|
|
16
|
-
- Add `class` prop for [Panel](
|
|
17
|
-
- Add `removable` prop for [CustomSelector](
|
|
22
|
+
- Add `legendVisuallyHidden` prop for [RadioGroup](/packages/soleil/svelte-config/components/radiogroup) and [CheckboxGroup](/packages/soleil/svelte-config/components/checkboxgroup).
|
|
23
|
+
- Add `class` prop for [Panel](/packages/soleil/svelte-config/components/panel).
|
|
24
|
+
- Add `removable` prop for [CustomSelector](/packages/soleil/svelte-config/components/customselector).
|
|
18
25
|
|
|
19
26
|
## [1.20.1] - 2023-09-25
|
|
20
27
|
|
|
21
|
-
- Fix element containting title in [Modal](
|
|
28
|
+
- Fix element containting title in [Modal](/packages/soleil/svelte-config/components/modal).
|
|
22
29
|
|
|
23
30
|
## [1.20.0] - 2023-09-25
|
|
24
31
|
|
|
25
|
-
- Add footer slot in [Modal](
|
|
32
|
+
- Add footer slot in [Modal](/packages/soleil/svelte-config/components/modal).
|
|
26
33
|
|
|
27
34
|
## [1.19.0] - 2023-05-17
|
|
28
35
|
|
|
@@ -38,19 +45,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
38
45
|
|
|
39
46
|
## [1.18.0] - 2023-01-20
|
|
40
47
|
|
|
41
|
-
- Option templating in [CustomSelector](
|
|
48
|
+
- Option templating in [CustomSelector](/packages/soleil/svelte-config/components/customselector).
|
|
42
49
|
- Add global Select2 styling.
|
|
43
50
|
- Modal now closes open Select2 dropdowns.
|
|
44
51
|
|
|
45
52
|
## [1.17.0] - 2022-12-01
|
|
46
53
|
|
|
47
|
-
- New component: [RepositoryNodeSelector](
|
|
48
|
-
- New utility API: [getAppContext](
|
|
49
|
-
- New server API: [createAppContext](
|
|
54
|
+
- New component: [RepositoryNodeSelector](/packages/soleil/svelte-config/components/repositorynodeselector).
|
|
55
|
+
- New utility API: [getAppContext](/packages/soleil/svelte-config#getappcontext).
|
|
56
|
+
- New server API: [createAppContext](/packages/soleil/svelte-config#context)
|
|
50
57
|
|
|
51
58
|
## [1.16.2] - 2022-11-24
|
|
52
59
|
|
|
53
|
-
- [ListSelector](
|
|
60
|
+
- [ListSelector](/packages/soleil/svelte-config/components/listselector) now works properly in [CustomList](/packages/soleil/svelte-config/components/customlist).
|
|
54
61
|
|
|
55
62
|
## [1.16.1] - 2022-11-18
|
|
56
63
|
|
|
@@ -58,17 +65,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
58
65
|
|
|
59
66
|
## [1.16.0] - 2022-11-09
|
|
60
67
|
|
|
61
|
-
- Add singular and plural suffix support for [NumberSpinner](
|
|
68
|
+
- Add singular and plural suffix support for [NumberSpinner](/packages/soleil/svelte-config/components/numberspinner)
|
|
62
69
|
|
|
63
70
|
## [1.15.0] - 2022-09-15
|
|
64
71
|
|
|
65
|
-
- Required was not re-evaluated properly in [InputField](
|
|
72
|
+
- Required was not re-evaluated properly in [InputField](/packages/soleil/svelte-config/components/inputfield), [NodeSelector](/packages/soleil/svelte-config/components/nodeselector) and [TagSelector](/packages/soleil/svelte-config/components/tagselector).
|
|
66
73
|
- Add `show` prop for all components to toggle visibility without re-rendering.
|
|
67
74
|
|
|
68
75
|
## [1.14.0] - 2022-07-07
|
|
69
76
|
|
|
70
|
-
- Add default slot for [ImageSelector](
|
|
71
|
-
- Margin fix for [RadioGroup](
|
|
77
|
+
- Add default slot for [ImageSelector](/packages/soleil/svelte-config/components/imageselector).
|
|
78
|
+
- Margin fix for [RadioGroup](/packages/soleil/svelte-config/components/radiogroup).
|
|
72
79
|
|
|
73
80
|
## [1.13.0] - 2022-06-23
|
|
74
81
|
|
|
@@ -80,22 +87,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
80
87
|
|
|
81
88
|
## [1.12.0] - 2022-05-23
|
|
82
89
|
|
|
83
|
-
- New component: [Modal](
|
|
84
|
-
- New component: [CustomList](
|
|
90
|
+
- New component: [Modal](/packages/soleil/svelte-config/components/modal).
|
|
91
|
+
- New component: [CustomList](/packages/soleil/svelte-config/components/customlist).
|
|
85
92
|
|
|
86
93
|
## [1.10.1] - 2022-03-08
|
|
87
94
|
|
|
88
|
-
- Cast saved value to Number in [NumberSpinner](
|
|
89
|
-
- Fix reactivity for `suffix` prop in [NumberSpinner](
|
|
95
|
+
- Cast saved value to Number in [NumberSpinner](/packages/soleil/svelte-config/components/numberspinner).
|
|
96
|
+
- Fix reactivity for `suffix` prop in [NumberSpinner](/packages/soleil/svelte-config/components/numberspinner).
|
|
90
97
|
|
|
91
98
|
## [1.10.0] - 2022-03-07
|
|
92
99
|
|
|
93
|
-
- Added `multiple` prop for [CustomSelector](
|
|
94
|
-
- First value is always selected in [RadioGroup](
|
|
100
|
+
- Added `multiple` prop for [CustomSelector](/packages/soleil/svelte-config/components/customselector).
|
|
101
|
+
- First value is always selected in [RadioGroup](/packages/soleil/svelte-config/components/radiogroup) if nothing is selected.
|
|
95
102
|
|
|
96
103
|
## [1.9.0] - 2021-12-06
|
|
97
104
|
|
|
98
|
-
- Added [CustomSelector](
|
|
105
|
+
- Added [CustomSelector](/packages/soleil/svelte-config/components/customselector)
|
|
99
106
|
|
|
100
107
|
## [1.8.4] - 2021-12-03
|
|
101
108
|
|
|
@@ -32,18 +32,22 @@
|
|
|
32
32
|
|
|
33
33
|
<div class="form-group {className}" class:hidden={!show}>
|
|
34
34
|
<input
|
|
35
|
-
bind:checked={value}
|
|
36
|
-
{name}
|
|
37
35
|
{id}
|
|
38
|
-
{
|
|
36
|
+
{name}
|
|
39
37
|
class="sr-only"
|
|
40
|
-
type="checkbox"
|
|
41
38
|
data-value-type="boolean"
|
|
39
|
+
{disabled}
|
|
40
|
+
type="checkbox"
|
|
41
|
+
bind:checked={value}
|
|
42
42
|
on:change={onChange}
|
|
43
43
|
/>
|
|
44
|
-
<label
|
|
44
|
+
<label class="checkbox-inline" class:disabled for={id}>
|
|
45
|
+
<slot name="label">{label}</slot>
|
|
46
|
+
</label>
|
|
47
|
+
<slot />
|
|
45
48
|
</div>
|
|
46
49
|
|
|
50
|
+
<!-- eslint-disable max-len -->
|
|
47
51
|
<style lang="scss">
|
|
48
52
|
label {
|
|
49
53
|
position: relative;
|
|
@@ -41,7 +41,9 @@
|
|
|
41
41
|
-->
|
|
42
42
|
|
|
43
43
|
<fieldset class="form-group {className}" class:hidden={!show}>
|
|
44
|
-
<legend class:sr-only={legendVisuallyHidden}>
|
|
44
|
+
<legend class:sr-only={legendVisuallyHidden}>
|
|
45
|
+
<slot name="legend">{legend}</slot>
|
|
46
|
+
</legend>
|
|
45
47
|
{#each options as option, index}
|
|
46
48
|
<input
|
|
47
49
|
id={`${id}_${index}`}
|
|
@@ -62,6 +64,7 @@
|
|
|
62
64
|
{option.label || option}
|
|
63
65
|
</label>
|
|
64
66
|
{/each}
|
|
67
|
+
<slot />
|
|
65
68
|
</fieldset>
|
|
66
69
|
|
|
67
70
|
<!-- eslint-disable -->
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { createEventDispatcher, onMount, tick } from 'svelte';
|
|
3
|
-
|
|
4
3
|
import { generateId, addGeneratedIds } from '../../utils';
|
|
5
4
|
import { resizer } from '../../actions';
|
|
6
5
|
import i18n from './i18n';
|
|
@@ -11,7 +10,7 @@
|
|
|
11
10
|
import EditModal from './internal/EditModal.svelte';
|
|
12
11
|
import AddModal from './internal/AddModal.svelte';
|
|
13
12
|
|
|
14
|
-
const
|
|
13
|
+
const configValues = window.CONFIG_VALUES || {};
|
|
15
14
|
const dispatch = createEventDispatcher();
|
|
16
15
|
|
|
17
16
|
export let label;
|
|
@@ -22,7 +21,7 @@
|
|
|
22
21
|
export let icon;
|
|
23
22
|
|
|
24
23
|
export let value = [];
|
|
25
|
-
value = name ?
|
|
24
|
+
value = name ? configValues[name] ?? value : value;
|
|
26
25
|
|
|
27
26
|
addGeneratedIds(value);
|
|
28
27
|
|
|
@@ -45,7 +44,10 @@
|
|
|
45
44
|
await tick();
|
|
46
45
|
items = value.map((id) => ({
|
|
47
46
|
id,
|
|
48
|
-
name:
|
|
47
|
+
name:
|
|
48
|
+
document.querySelector(`#modal_${id} .custom-list-item-template`)?.innerHTML ||
|
|
49
|
+
document.querySelector(`#modal_${id} input:not([type=radio],[type=checkbox])`)?.value ||
|
|
50
|
+
id,
|
|
49
51
|
}));
|
|
50
52
|
}
|
|
51
53
|
|
|
@@ -93,6 +95,10 @@
|
|
|
93
95
|
onChange();
|
|
94
96
|
}
|
|
95
97
|
|
|
98
|
+
function triggerUpdate() {
|
|
99
|
+
updateItems();
|
|
100
|
+
}
|
|
101
|
+
|
|
96
102
|
onMount(updateItems);
|
|
97
103
|
</script>
|
|
98
104
|
|
|
@@ -106,28 +112,30 @@
|
|
|
106
112
|
|
|
107
113
|
{#each modals as id, index (id)}
|
|
108
114
|
<EditModal {id} open={editId === id} on:save={onEditSave} on:close={onEditClose}>
|
|
109
|
-
<slot {id} {index} />
|
|
115
|
+
<slot {id} {index} {triggerUpdate} />
|
|
110
116
|
</EditModal>
|
|
111
117
|
{/each}
|
|
112
118
|
<AddModal {name} open={addModalOpen} on:save={onAddSave} on:close={onAddClose} let:id>
|
|
113
|
-
<slot {id} index={items.length} />
|
|
119
|
+
<slot {id} index={items.length} {triggerUpdate} />
|
|
114
120
|
</AddModal>
|
|
115
121
|
|
|
116
122
|
<div class="form-group" class:hidden={!show}>
|
|
117
123
|
<label class="control-label {required ? 'control-label--required' : ''}" for={domId}>
|
|
118
|
-
{label}
|
|
124
|
+
<slot name="label">{label}</slot>
|
|
119
125
|
</label>
|
|
120
126
|
<div class="list-component">
|
|
121
127
|
<div class="list-component__list-wrapper ui-resizable">
|
|
122
128
|
<Sortable {dragDisabled} {items} on:finalize={onFinalize} let:item>
|
|
123
129
|
<SortableItem
|
|
124
|
-
{
|
|
130
|
+
id={item.id}
|
|
125
131
|
{disabled}
|
|
126
132
|
{icon}
|
|
127
133
|
on:edit={onEdit}
|
|
128
134
|
on:remove={onRemove}
|
|
129
135
|
on:click={tempDisableDrag}
|
|
130
|
-
|
|
136
|
+
>
|
|
137
|
+
{@html item.name}
|
|
138
|
+
</SortableItem>
|
|
131
139
|
</Sortable>
|
|
132
140
|
<div class="ui-resizable-handle ui-resizable-s" use:resizer />
|
|
133
141
|
</div>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
title: CustomList
|
|
3
|
+
---
|
|
2
4
|
|
|
3
5
|
A sortable list component for adding multiple grouped configuration components in modals.
|
|
4
6
|
|
|
5
|
-

|
|
8
|
+

|
|
9
9
|
|
|
10
10
|
## Props
|
|
11
11
|
|
|
@@ -36,17 +36,19 @@ This id needs to be prefixed to the `name` attribute.
|
|
|
36
36
|
import { Panel, CustomList, InputField, NodeSelector } from '@soleil-se/svelte-config';
|
|
37
37
|
</script>
|
|
38
38
|
|
|
39
|
-
<Panel
|
|
39
|
+
<Panel>
|
|
40
40
|
<CustomList name="customList" label="Custom list" let:id>
|
|
41
41
|
<InputField name="{id}_name" label="Name" />
|
|
42
|
-
<NodeSelector name="{id}_page" label="Page"
|
|
42
|
+
<NodeSelector name="{id}_page" label="Page" />
|
|
43
43
|
</CustomList>
|
|
44
44
|
</Panel>
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
### Advanced
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
This component is currently **not** supported in advanced configs out of the box.
|
|
50
|
+
If you need to use it in an advanced config you can manually handle the state to normalize
|
|
51
|
+
and flatten it for saving to the server.
|
|
50
52
|
|
|
51
53
|
## AppData
|
|
52
54
|
|
|
@@ -74,10 +76,100 @@ No list of icons is available, but you can inspect an icon in the edit interface
|
|
|
74
76
|
import { Panel, CustomList, InputField, NodeSelector } from '@soleil-se/svelte-config';
|
|
75
77
|
</script>
|
|
76
78
|
|
|
77
|
-
<Panel
|
|
79
|
+
<Panel>
|
|
78
80
|
<CustomList name="customList" label="Custom list" icon="sitevision-icons file" let:id>
|
|
79
81
|
<InputField name="{id}_name" label="Name" />
|
|
80
|
-
<NodeSelector name="{id}_page" label="Page"
|
|
82
|
+
<NodeSelector name="{id}_page" label="Page" />
|
|
83
|
+
</CustomList>
|
|
84
|
+
</Panel>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## List item template
|
|
88
|
+
|
|
89
|
+
Sometimes you want full control over the list items, if some other value than the first input field
|
|
90
|
+
wants to be displayed or a completely custom template.
|
|
91
|
+
For this to work it's easiest to handle the modal content in a separate component.
|
|
92
|
+
|
|
93
|
+
```svelte
|
|
94
|
+
// App.svelte
|
|
95
|
+
<script>
|
|
96
|
+
import { Panel, CustomList } from '@soleil-se/svelte-config';
|
|
97
|
+
import Settings from './Settings.svelte';
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
<Panel>
|
|
101
|
+
<CustomList name="customList" label="Custom list" let:id>
|
|
102
|
+
<Settings {id} />
|
|
103
|
+
</CustomList>
|
|
104
|
+
</Panel>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
```svelte
|
|
108
|
+
// Settings.svelte
|
|
109
|
+
<script>
|
|
110
|
+
import { InputField, NodeSelector, CustomListItemTemplate } from '@soleil-se/svelte-config';
|
|
111
|
+
|
|
112
|
+
export let id;
|
|
113
|
+
let name;
|
|
114
|
+
</script>
|
|
115
|
+
|
|
116
|
+
<CustomListItemTemplate>
|
|
117
|
+
Page: {name}
|
|
118
|
+
</CustomListItemTemplate>
|
|
119
|
+
<InputField name="{id}_name" label="Name" bind:value={name} />
|
|
120
|
+
<NodeSelector name="{id}_page" label="Page" type="page-selector" />
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Dynamic content
|
|
124
|
+
|
|
125
|
+
A more advanced example with dynamically fetched content, a manual update of the list item is needed
|
|
126
|
+
on mount since the list doesn't know when all data is available.
|
|
127
|
+
|
|
128
|
+
```svelte
|
|
129
|
+
// App.svelte
|
|
130
|
+
<script>
|
|
131
|
+
import { Panel, CustomList } from '@soleil-se/svelte-config';
|
|
132
|
+
import Settings from './Settings.svelte';
|
|
133
|
+
</script>
|
|
134
|
+
|
|
135
|
+
<Panel>
|
|
136
|
+
<CustomList name="customList" label="Custom list" let:id let:triggerUpdate>
|
|
137
|
+
<Settings {id} {triggerUpdate} />
|
|
81
138
|
</CustomList>
|
|
82
139
|
</Panel>
|
|
83
140
|
```
|
|
141
|
+
|
|
142
|
+
```svelte
|
|
143
|
+
// Settings.svelte
|
|
144
|
+
<script>
|
|
145
|
+
import { NodeSelector, CustomListItemTemplate } from '@soleil-se/svelte-config';
|
|
146
|
+
import { onMount } from 'svelte';
|
|
147
|
+
|
|
148
|
+
export let id;
|
|
149
|
+
export let triggerUpdate;
|
|
150
|
+
|
|
151
|
+
let pageId;
|
|
152
|
+
let name;
|
|
153
|
+
let url;
|
|
154
|
+
|
|
155
|
+
async function fetchPageDetails() {
|
|
156
|
+
if (!pageId) return;
|
|
157
|
+
const res = await fetch(`/rest-api/1/0/${pageId}/properties`)
|
|
158
|
+
.then((res) => res.json());
|
|
159
|
+
|
|
160
|
+
name = res.displayName;
|
|
161
|
+
url = res.URL;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
onMount(() => {
|
|
165
|
+
await fetchPageDetails();
|
|
166
|
+
triggerUpdate();
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
</script>
|
|
170
|
+
|
|
171
|
+
<CustomListItemTemplate>
|
|
172
|
+
{name} ({url})
|
|
173
|
+
</CustomListItemTemplate>
|
|
174
|
+
<NodeSelector name="{id}_page" label="Page" on:change={fetchPageDetails} bind:value={pageId} />
|
|
175
|
+
```
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
|
|
14
14
|
const dispatch = createEventDispatcher();
|
|
15
15
|
|
|
16
|
-
$: if (open)
|
|
16
|
+
$: if (open) {
|
|
17
|
+
id = generateId(name || 'item');
|
|
18
|
+
}
|
|
17
19
|
|
|
18
20
|
const onClose = () => {
|
|
19
21
|
dispatch('close');
|
|
@@ -29,7 +31,7 @@
|
|
|
29
31
|
};
|
|
30
32
|
</script>
|
|
31
33
|
|
|
32
|
-
<Modal title={i18n('add')} on:save={onSave} on:close={onClose}
|
|
34
|
+
<Modal {open} title={i18n('add')} on:save={onSave} on:close={onClose} bind:element>
|
|
33
35
|
{#if id}
|
|
34
36
|
<slot {id} />
|
|
35
37
|
{/if}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import i18n from '../i18n';
|
|
3
3
|
import Modal from '../../Modal';
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
export let id;
|
|
6
6
|
export let open = false;
|
|
7
7
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
};
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
|
-
<div id="modal_{id}">
|
|
16
|
+
<div id="modal_{id}" style:display="contents">
|
|
17
17
|
<Modal title="{i18n('edit')} {name}" bind:open bind:element on:open={onOpen} on:save on:close>
|
|
18
18
|
<slot />
|
|
19
19
|
</Modal>
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
</script>
|
|
26
26
|
|
|
27
27
|
<ul
|
|
28
|
+
class="list-component__list"
|
|
29
|
+
on:consider={onConsider}
|
|
30
|
+
on:finalize={onFinalize}
|
|
28
31
|
use:dndzone={{
|
|
29
32
|
items,
|
|
30
33
|
flipDurationMs: 100,
|
|
@@ -34,12 +37,9 @@
|
|
|
34
37
|
autoAriaDisabled: true,
|
|
35
38
|
dragDisabled,
|
|
36
39
|
}}
|
|
37
|
-
on:consider={onConsider}
|
|
38
|
-
on:finalize={onFinalize}
|
|
39
|
-
class="list-component__list"
|
|
40
40
|
>
|
|
41
41
|
{#each items as item (item.id)}
|
|
42
|
-
<li aria-label={item.name} animate:flip={{ duration: 100 }}
|
|
42
|
+
<li aria-label={item.name} tabindex="-1" animate:flip={{ duration: 100 }}>
|
|
43
43
|
<slot {item} />
|
|
44
44
|
</li>
|
|
45
45
|
{/each}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { createEventDispatcher } from 'svelte';
|
|
3
3
|
|
|
4
4
|
export let id;
|
|
5
|
-
export let name;
|
|
6
5
|
export let disabled;
|
|
7
6
|
export let icon;
|
|
8
7
|
|
|
@@ -23,7 +22,9 @@
|
|
|
23
22
|
{#if icon}
|
|
24
23
|
<i class="sv-list-icon {icon}" aria-hidden="true" />
|
|
25
24
|
{/if}
|
|
26
|
-
<span class="item-name">
|
|
25
|
+
<span class="item-name">
|
|
26
|
+
<slot />
|
|
27
|
+
</span>
|
|
27
28
|
<div class="list-component__item-actions">
|
|
28
29
|
<button {disabled} on:click={editItem}>
|
|
29
30
|
<i class="glyphicons edit" aria-hidden="true" />
|
|
@@ -56,9 +57,9 @@
|
|
|
56
57
|
.list-component__item-actions {
|
|
57
58
|
button {
|
|
58
59
|
padding: 0;
|
|
60
|
+
appearance: none;
|
|
59
61
|
background: none;
|
|
60
62
|
border: none;
|
|
61
|
-
appearance: none;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
:global(li:focus-within) & i {
|
|
@@ -79,7 +79,11 @@
|
|
|
79
79
|
</span>
|
|
80
80
|
{/each}
|
|
81
81
|
{/if}
|
|
82
|
-
<label class="control-label {required ? 'control-label--required' : ''}" for={id}>
|
|
82
|
+
<label class="control-label {required ? 'control-label--required' : ''}" for={id}>
|
|
83
|
+
<slot name="label">
|
|
84
|
+
{label}
|
|
85
|
+
</slot>
|
|
86
|
+
</label>
|
|
83
87
|
<select
|
|
84
88
|
bind:this={element}
|
|
85
89
|
{id}
|
|
@@ -59,7 +59,9 @@
|
|
|
59
59
|
-->
|
|
60
60
|
|
|
61
61
|
<div class="form-group {className}" class:hidden={!show} {hidden}>
|
|
62
|
-
<label class="control-label {required ? 'control-label--required' : ''}" for={id}>
|
|
62
|
+
<label class="control-label {required ? 'control-label--required' : ''}" for={id}>
|
|
63
|
+
<slot name="label">{label}</slot>
|
|
64
|
+
</label>
|
|
63
65
|
<select
|
|
64
66
|
{id}
|
|
65
67
|
{name}
|
|
@@ -72,18 +72,18 @@
|
|
|
72
72
|
<NodeSelector
|
|
73
73
|
name="{name}Node"
|
|
74
74
|
label={i18n('selectImage')}
|
|
75
|
+
{required}
|
|
75
76
|
type="image"
|
|
76
77
|
bind:value={node}
|
|
77
78
|
on:change={onChange}
|
|
78
|
-
{required}
|
|
79
79
|
/>
|
|
80
80
|
<div class="form-group">
|
|
81
81
|
{#if !hideDecorative}
|
|
82
82
|
<Checkbox
|
|
83
|
-
class="checkbox-group"
|
|
84
|
-
bind:value={decorative}
|
|
85
83
|
name="{name}Decorative"
|
|
84
|
+
class="checkbox-group"
|
|
86
85
|
label={i18n('imageIsDecorative')}
|
|
86
|
+
bind:value={decorative}
|
|
87
87
|
on:change={onChange}
|
|
88
88
|
/>
|
|
89
89
|
{/if}
|
|
@@ -91,15 +91,15 @@
|
|
|
91
91
|
{#if useCustomAlt}
|
|
92
92
|
<InputField name="{name}Alt" label={i18n('altText')} required bind:value={alt} />
|
|
93
93
|
{:else}
|
|
94
|
-
<InputField label={i18n('altFromCaption')} value={imageArchiveAlt}
|
|
94
|
+
<InputField disabled label={i18n('altFromCaption')} readonly value={imageArchiveAlt}>
|
|
95
95
|
<input bind:this={validationEl} class="sr-only" />
|
|
96
96
|
</InputField>
|
|
97
97
|
{/if}
|
|
98
98
|
|
|
99
99
|
<Checkbox
|
|
100
100
|
class="checkbox-group"
|
|
101
|
-
bind:value={useCustomAlt}
|
|
102
101
|
label={i18n('customAltText')}
|
|
102
|
+
bind:value={useCustomAlt}
|
|
103
103
|
on:change={onUseCustomToggle}
|
|
104
104
|
/>
|
|
105
105
|
{/if}
|
|
@@ -54,35 +54,35 @@
|
|
|
54
54
|
-->
|
|
55
55
|
|
|
56
56
|
<div class="form-group {className}" class:hidden={!show}>
|
|
57
|
-
<label
|
|
58
|
-
{label}
|
|
57
|
+
<label class="control-label {isRequired ? 'control-label--required' : ''}" for={id}>
|
|
58
|
+
<slot name="label">{label}</slot>
|
|
59
59
|
</label>
|
|
60
60
|
{#if isTextarea}
|
|
61
61
|
<textarea
|
|
62
|
-
class="form-control"
|
|
63
|
-
required={isRequired}
|
|
64
62
|
{id}
|
|
65
63
|
{name}
|
|
64
|
+
class="form-control"
|
|
66
65
|
{disabled}
|
|
67
66
|
{readonly}
|
|
68
|
-
{
|
|
67
|
+
required={isRequired}
|
|
69
68
|
{rows}
|
|
69
|
+
{value}
|
|
70
70
|
{...$$restProps}
|
|
71
71
|
on:input={onInput}
|
|
72
72
|
/>
|
|
73
73
|
{:else}
|
|
74
74
|
<input
|
|
75
|
-
class="form-control"
|
|
76
|
-
required={isRequired}
|
|
77
75
|
{id}
|
|
78
76
|
{name}
|
|
79
|
-
|
|
77
|
+
class="form-control"
|
|
80
78
|
{disabled}
|
|
81
79
|
{readonly}
|
|
80
|
+
required={isRequired}
|
|
81
|
+
{type}
|
|
82
82
|
{value}
|
|
83
83
|
{...$$restProps}
|
|
84
|
-
use:action
|
|
85
84
|
on:input={onInput}
|
|
85
|
+
use:action
|
|
86
86
|
/>
|
|
87
87
|
{/if}
|
|
88
88
|
<slot />
|
|
@@ -50,15 +50,17 @@
|
|
|
50
50
|
-->
|
|
51
51
|
|
|
52
52
|
<div class="form-group" class:disabled class:hidden={!show}>
|
|
53
|
-
<label
|
|
53
|
+
<label class="control-label {required ? 'control-label--required' : ''}" for={id}>
|
|
54
|
+
<slot name="label">{label}</slot>
|
|
55
|
+
</label>
|
|
54
56
|
<input
|
|
55
57
|
{id}
|
|
56
58
|
{name}
|
|
57
|
-
type="hidden"
|
|
58
59
|
data-component={component}
|
|
59
|
-
{required}
|
|
60
60
|
data-sortable={sortable || undefined}
|
|
61
61
|
data-types={selectable}
|
|
62
|
+
{required}
|
|
63
|
+
type="hidden"
|
|
62
64
|
value={value.join(',')}
|
|
63
65
|
/>
|
|
64
66
|
{#if disabled}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
if (type.startsWith('tags')) {
|
|
38
|
-
throw new Error(
|
|
38
|
+
throw new Error("Type 'tags-selector' is not supported, use TagsSelector component.");
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
onMount(() => {
|
|
@@ -63,21 +63,21 @@
|
|
|
63
63
|
-->
|
|
64
64
|
|
|
65
65
|
<div class="form-group {className}" class:hidden={!show}>
|
|
66
|
-
<label
|
|
67
|
-
{label}
|
|
66
|
+
<label class="control-label {isRequired ? 'control-label--required' : ''}" for={id}>
|
|
67
|
+
<slot name="label">{label}</slot>
|
|
68
68
|
</label>
|
|
69
69
|
<input
|
|
70
|
-
class="form-control"
|
|
71
70
|
{id}
|
|
72
71
|
{name}
|
|
72
|
+
class="form-control"
|
|
73
|
+
data-component={component}
|
|
74
|
+
data-removable={removable ? '' : undefined}
|
|
75
|
+
data-types={selectable}
|
|
76
|
+
data-value={value}
|
|
73
77
|
{disabled}
|
|
74
78
|
{readonly}
|
|
75
79
|
required={isRequired}
|
|
76
|
-
data-removable={removable ? '' : undefined}
|
|
77
|
-
data-component={component}
|
|
78
|
-
data-types={selectable}
|
|
79
80
|
value={displayName}
|
|
80
|
-
data-value={value}
|
|
81
81
|
/>
|
|
82
82
|
{#if disabled}
|
|
83
83
|
<div class="disabled-overlay" />
|
|
@@ -49,18 +49,20 @@
|
|
|
49
49
|
-->
|
|
50
50
|
|
|
51
51
|
<div class="form-group {className}" class:hidden={!show}>
|
|
52
|
-
<label
|
|
52
|
+
<label class="control-label" for={id}>
|
|
53
|
+
<slot name="label">{label}</slot>
|
|
54
|
+
</label>
|
|
53
55
|
<input
|
|
54
56
|
{id}
|
|
55
57
|
{name}
|
|
56
|
-
{value}
|
|
57
58
|
class="form-control"
|
|
58
|
-
data-
|
|
59
|
+
data-component="number-spinner"
|
|
59
60
|
data-max={max}
|
|
61
|
+
data-min={min}
|
|
60
62
|
data-step={step}
|
|
61
63
|
{disabled}
|
|
62
64
|
{readonly}
|
|
63
|
-
|
|
65
|
+
{value}
|
|
64
66
|
/>
|
|
65
67
|
{#if disabled}
|
|
66
68
|
<div class="disabled-overlay" />
|
|
@@ -37,7 +37,9 @@
|
|
|
37
37
|
-->
|
|
38
38
|
|
|
39
39
|
<fieldset class="form-group" class:hidden={!show}>
|
|
40
|
-
<legend class:sr-only={legendVisuallyHidden}>
|
|
40
|
+
<legend class:sr-only={legendVisuallyHidden}>
|
|
41
|
+
<slot name="legend">{legend}</slot>
|
|
42
|
+
</legend>
|
|
41
43
|
{#each options as option, index}
|
|
42
44
|
<input
|
|
43
45
|
id={`${id}_${index}`}
|
|
@@ -58,6 +60,7 @@
|
|
|
58
60
|
</label>
|
|
59
61
|
{/each}
|
|
60
62
|
<input {name} type="hidden" {value} />
|
|
63
|
+
<slot />
|
|
61
64
|
</fieldset>
|
|
62
65
|
|
|
63
66
|
<style lang="scss">
|
|
@@ -54,20 +54,22 @@
|
|
|
54
54
|
|
|
55
55
|
<CustomSelector
|
|
56
56
|
{id}
|
|
57
|
-
{label}
|
|
58
57
|
{name}
|
|
59
|
-
{searchable}
|
|
60
|
-
{required}
|
|
61
58
|
{disabled}
|
|
59
|
+
{label}
|
|
62
60
|
{multiple}
|
|
63
|
-
{show}
|
|
64
61
|
{options}
|
|
62
|
+
{required}
|
|
63
|
+
{searchable}
|
|
64
|
+
{show}
|
|
65
65
|
{value}
|
|
66
66
|
on:input
|
|
67
67
|
on:change
|
|
68
68
|
>
|
|
69
|
+
<slot name="label" />
|
|
69
70
|
<slot />
|
|
70
71
|
{#if error}
|
|
72
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
|
71
73
|
<p class="alert alert-danger">{@html i18n('error')}</p>
|
|
72
74
|
{/if}
|
|
73
75
|
</CustomSelector>
|
|
@@ -27,9 +27,10 @@
|
|
|
27
27
|
[README](https://docs.soleilit.se/03.packages/@soleil&svelte-config/components/SelectField/)
|
|
28
28
|
-->
|
|
29
29
|
<div class="form-group" class:hidden={!show}>
|
|
30
|
-
<label class="control-label {required ? 'control-label--required' : ''}" for={id}>
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
<label class="control-label {required ? 'control-label--required' : ''}" for={id}>
|
|
31
|
+
<slot name="label">{label}</slot>
|
|
32
|
+
</label>
|
|
33
|
+
<select {id} {name} class="form-control" {disabled} {required} bind:value on:change={onChange}>
|
|
33
34
|
{#each options as option}
|
|
34
35
|
<option value={option.value ?? option}>
|
|
35
36
|
{option.label ?? option}
|
|
@@ -52,16 +52,16 @@
|
|
|
52
52
|
-->
|
|
53
53
|
|
|
54
54
|
<div class="form-group {className}" class:hidden={!show}>
|
|
55
|
-
<label
|
|
56
|
-
{label}
|
|
55
|
+
<label class="control-label {isRequired ? 'control-label--required' : ''}" for={id}>
|
|
56
|
+
<slot name="label">{label}</slot>
|
|
57
57
|
</label>
|
|
58
58
|
<input
|
|
59
|
-
class="form-control"
|
|
60
|
-
required={isRequired}
|
|
61
|
-
data-component="tags-selector"
|
|
62
59
|
{id}
|
|
63
60
|
{name}
|
|
61
|
+
class="form-control"
|
|
62
|
+
data-component="tags-selector"
|
|
64
63
|
{disabled}
|
|
64
|
+
required={isRequired}
|
|
65
65
|
{value}
|
|
66
66
|
/>
|
|
67
67
|
{#if disabled}
|
|
@@ -77,7 +77,9 @@
|
|
|
77
77
|
-->
|
|
78
78
|
|
|
79
79
|
<div class="form-group" class:hidden={!show}>
|
|
80
|
-
<label
|
|
80
|
+
<label class="control-label {required ? 'control-label--required' : ''}" for={id}>
|
|
81
|
+
<slot name="label">{label}</slot>
|
|
82
|
+
</label>
|
|
81
83
|
<div class="list-component">
|
|
82
84
|
<div class="list-component__list-wrapper ui-resizable">
|
|
83
85
|
<Sortable {items} on:finalize={onFinalize} let:item>
|
|
@@ -89,7 +91,7 @@
|
|
|
89
91
|
on:enter={() => addButtonElement.focus()}
|
|
90
92
|
/>
|
|
91
93
|
</Sortable>
|
|
92
|
-
<div
|
|
94
|
+
<div class="ui-resizable-handle ui-resizable-s" use:resizer />
|
|
93
95
|
</div>
|
|
94
96
|
<button
|
|
95
97
|
bind:this={addButtonElement}
|
|
@@ -103,7 +105,7 @@
|
|
|
103
105
|
{#if disabled}
|
|
104
106
|
<div class="disabled-overlay" />
|
|
105
107
|
{/if}
|
|
106
|
-
<DataHolder {id} {name} {
|
|
108
|
+
<DataHolder {id} {name} {required} {value} />
|
|
107
109
|
</div>
|
|
108
110
|
|
|
109
111
|
<style lang="scss">
|
package/createConfigApp/index.js
CHANGED
package/index.js
CHANGED
|
@@ -14,7 +14,7 @@ export { default as ImageSelector } from './components/ImageSelector';
|
|
|
14
14
|
export { default as TagSelector } from './components/TagSelector';
|
|
15
15
|
export { default as CustomSelector } from './components/CustomSelector';
|
|
16
16
|
export { default as Modal } from './components/Modal';
|
|
17
|
-
export { default as CustomList } from './components/CustomList';
|
|
17
|
+
export { default as CustomList, CustomListItemTemplate } from './components/CustomList';
|
|
18
18
|
export { default as RepositoryNodeSelector } from './components/RepositoryNodeSelector';
|
|
19
19
|
|
|
20
20
|
export { default as createConfigApp } from './createConfigApp';
|