@soleil-se/config-svelte 1.6.0 → 1.7.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
|
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.7.0] - 2021-09-24
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `sortable` prop for `ListSelector`.
|
|
13
|
+
|
|
8
14
|
## [1.6.0] - 2021-08-25
|
|
9
15
|
|
|
10
16
|
### Added
|
|
@@ -1,16 +1,37 @@
|
|
|
1
|
-
# LinkSelector
|
|
1
|
+
# LinkSelector (DEPRECATED)
|
|
2
2
|
|
|
3
3
|
Custom panel component for selecting a link.
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
+
::: warning DEPRECATED
|
|
8
|
+
Since Sitevision 9.1 a new type of node selector is avaliable for selecting links.
|
|
9
|
+
[NodeSelector](/03.packages/@soleil&svelte-config/components/NodeSelector/) should be used instead of this component.
|
|
10
|
+
|
|
11
|
+
`App.svelte`
|
|
12
|
+
|
|
13
|
+
```svelte
|
|
14
|
+
<NodeSelector label="Link" type="link" name="link" />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
A [sv:link](https://developer.sitevision.se/docs/public-api/node-types/node-types/2018-01-12-svlink) will be returned.
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import appData from '@sitevision/api/server/appData';
|
|
21
|
+
|
|
22
|
+
const uri = appData.get('link', 'rawURI');
|
|
23
|
+
const newWindow = appData.get('link', 'openInNewWindow');
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
:::
|
|
27
|
+
|
|
7
28
|
## AppData
|
|
8
29
|
|
|
9
30
|
If used with standard name all values will be prefixed with the name property provided to the component.
|
|
10
31
|
For example if `name="link"` the values will be available as `linkValue`, `linkType` and `linkNewWindow`.
|
|
11
32
|
|
|
12
33
|
```js
|
|
13
|
-
import appData from 'appData';
|
|
34
|
+
import appData from '@sitevision/api/server/appData';
|
|
14
35
|
|
|
15
36
|
const getLink = () => ({
|
|
16
37
|
value: appData.get('linkValue', 'URI'),
|
|
@@ -72,7 +93,7 @@ Top and bottom slots before and after link selector.
|
|
|
72
93
|
|
|
73
94
|
```svelte
|
|
74
95
|
<script>
|
|
75
|
-
import { LinkSelector } from '@soleil-se/svelte-config';
|
|
96
|
+
import { LinkSelector } from '@soleil-se/svelte-config';
|
|
76
97
|
</script>
|
|
77
98
|
|
|
78
99
|
<LinkSelector name="link" heading="Länk" />
|
|
@@ -83,16 +104,16 @@ import { LinkSelector } from '@soleil-se/svelte-config';
|
|
|
83
104
|
|
|
84
105
|
```svelte
|
|
85
106
|
<script>
|
|
86
|
-
import { LinkSelector } from '@soleil-se/svelte-config';
|
|
87
|
-
import { pluckPrefix, addPrefix, onSave } from '@soleil-se/svelte-config/utils';
|
|
107
|
+
import { LinkSelector } from '@soleil-se/svelte-config';
|
|
108
|
+
import { pluckPrefix, addPrefix, onSave } from '@soleil-se/svelte-config/utils';
|
|
88
109
|
|
|
89
|
-
// Plucks object properties with keys prefixed with 'link' and removes the prefix.
|
|
90
|
-
// { linkType, linkValue, linkNewWindow } -> { type, value, newWindow }
|
|
91
|
-
let link = pluckPrefix('link');
|
|
110
|
+
// Plucks object properties with keys prefixed with 'link' and removes the prefix.
|
|
111
|
+
// { linkType, linkValue, linkNewWindow } -> { type, value, newWindow }
|
|
112
|
+
let link = pluckPrefix('link');
|
|
92
113
|
|
|
93
|
-
// Prefixes keys in an object
|
|
94
|
-
// { type, value, newWindow } -> { linkType, linkValue, linkNewWindow }
|
|
95
|
-
onSave(() => addPrefix('link', link)))
|
|
114
|
+
// Prefixes keys in an object
|
|
115
|
+
// { type, value, newWindow } -> { linkType, linkValue, linkNewWindow }
|
|
116
|
+
onSave(() => addPrefix('link', link)))
|
|
96
117
|
|
|
97
118
|
</script>
|
|
98
119
|
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
export let type = 'page-list';
|
|
12
12
|
export let required = false;
|
|
13
13
|
export let disabled = false;
|
|
14
|
+
export let sortable = false;
|
|
14
15
|
export let selectable = [];
|
|
15
16
|
export let value = [];
|
|
16
17
|
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
[README](https://docs.soleilit.se/03.packages/@soleil&svelte-config/components/ListSelector/)
|
|
48
49
|
-->
|
|
49
50
|
|
|
50
|
-
<div class="form-group">
|
|
51
|
+
<div class="form-group" class:disabled>
|
|
51
52
|
<label for={id} class="control-label {required ? 'control-label--required' : ''}">{label}</label>
|
|
52
53
|
<input
|
|
53
54
|
{id}
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
type="hidden"
|
|
56
57
|
data-component={component}
|
|
57
58
|
{required}
|
|
59
|
+
data-sortable={sortable || undefined}
|
|
58
60
|
data-types={selectable}
|
|
59
61
|
value={value.join(',')}
|
|
60
62
|
/>
|
|
@@ -65,7 +67,7 @@
|
|
|
65
67
|
</div>
|
|
66
68
|
|
|
67
69
|
<style>
|
|
68
|
-
.form-group {
|
|
70
|
+
.form-group.disabled {
|
|
69
71
|
position: relative;
|
|
70
72
|
}
|
|
71
73
|
|
|
@@ -31,8 +31,10 @@ export let type = 'page';
|
|
|
31
31
|
export let value = [];
|
|
32
32
|
// If list is required.
|
|
33
33
|
export let required = false;
|
|
34
|
-
// If list is
|
|
34
|
+
// If list is disabled.
|
|
35
35
|
export let disabled = false;
|
|
36
|
+
// If list is sortable, since Sitevision 9.1.
|
|
37
|
+
export let sortable = false;
|
|
36
38
|
// Selectable types
|
|
37
39
|
export let selectable = [];
|
|
38
40
|
|
|
@@ -56,15 +58,15 @@ import { Panel, ListSelector } from '@soleil-se/svelte-config';
|
|
|
56
58
|
|
|
57
59
|
```svelte
|
|
58
60
|
<script>
|
|
59
|
-
import { Panel, ListSelector } from '@soleil-se/svelte-config';
|
|
60
|
-
import { onSave } from '@soleil-se/svelte-config/utils';
|
|
61
|
+
import { Panel, ListSelector } from '@soleil-se/svelte-config';
|
|
62
|
+
import { onSave } from '@soleil-se/svelte-config/utils';
|
|
61
63
|
|
|
62
|
-
const values = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
};
|
|
64
|
+
const values = {
|
|
65
|
+
pages: '',
|
|
66
|
+
...window.CONFIG_VALUES
|
|
67
|
+
};
|
|
66
68
|
|
|
67
|
-
onSave(() => values);
|
|
69
|
+
onSave(() => values);
|
|
68
70
|
|
|
69
71
|
</script>
|
|
70
72
|
|
|
@@ -93,7 +95,7 @@ You can omnit the `-list` suffix for the type prop.
|
|
|
93
95
|
|
|
94
96
|
## Selectable types
|
|
95
97
|
|
|
96
|
-
> :exclamation: Since
|
|
98
|
+
> :exclamation: Since Sitevision 7.0 :exclamation:
|
|
97
99
|
|
|
98
100
|
Filter what types should be selectable. See available types here:
|
|
99
101
|
<https://developer.sitevision.se/docs/webapps/configuration#h-Types-0>
|