@soleil-se/config-svelte 1.21.0 → 1.22.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,11 @@ 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.22.0] - 2024-02-13
|
|
9
|
+
|
|
10
|
+
- More lenient `@sitevision/api` peer dependency range.
|
|
11
|
+
- Try to use `window.sv.getValues()` if available since `window._getValues()` is deprecated.
|
|
12
|
+
|
|
8
13
|
## [1.21.0] - 2023-10-13
|
|
9
14
|
|
|
10
15
|
- Add `legendVisuallyHidden` prop for [RadioGroup](./components/RadioGroup) and [CheckboxGroup](./components/CheckboxGroup).
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { createEventDispatcher, onMount } from 'svelte';
|
|
2
|
+
import { createEventDispatcher, onMount, tick } from 'svelte';
|
|
3
|
+
|
|
3
4
|
import { generateId, addGeneratedIds } from '../../utils';
|
|
4
5
|
import { resizer } from '../../actions';
|
|
5
6
|
import i18n from './i18n';
|
|
@@ -32,64 +33,65 @@
|
|
|
32
33
|
let dragDisabled = disabled;
|
|
33
34
|
let addModalOpen = false;
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
function onAddOpen() {
|
|
36
37
|
addModalOpen = true;
|
|
37
|
-
}
|
|
38
|
+
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
function onAddClose() {
|
|
40
41
|
addModalOpen = false;
|
|
41
|
-
}
|
|
42
|
+
}
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
async function updateItems() {
|
|
45
|
+
await tick();
|
|
44
46
|
items = value.map((id) => ({
|
|
45
47
|
id,
|
|
46
48
|
name: document.querySelector(`#modal_${id} input`)?.value || id,
|
|
47
49
|
}));
|
|
48
|
-
}
|
|
50
|
+
}
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
function onChange() {
|
|
51
53
|
value = items.map((item) => item.id);
|
|
52
54
|
dispatch('input', value);
|
|
53
55
|
dispatch('change', value);
|
|
54
|
-
}
|
|
56
|
+
}
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
function onAddSave({ detail }) {
|
|
57
59
|
items = items.concat(detail);
|
|
58
60
|
modals = modals.concat(detail.id);
|
|
59
61
|
onChange();
|
|
60
|
-
}
|
|
62
|
+
}
|
|
61
63
|
|
|
62
|
-
|
|
64
|
+
function onEdit({ detail }) {
|
|
63
65
|
editId = detail;
|
|
64
|
-
}
|
|
66
|
+
}
|
|
65
67
|
|
|
66
|
-
|
|
68
|
+
function onRemove({ detail }) {
|
|
67
69
|
items = items.filter((item) => item.id !== detail);
|
|
68
70
|
modals = modals.filter((id) => id !== detail);
|
|
69
71
|
onChange();
|
|
70
|
-
}
|
|
72
|
+
}
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
function onEditSave() {
|
|
73
75
|
editId = undefined;
|
|
74
76
|
updateItems();
|
|
75
77
|
onChange();
|
|
76
|
-
}
|
|
78
|
+
}
|
|
77
79
|
|
|
78
|
-
|
|
80
|
+
function onEditClose() {
|
|
79
81
|
editId = undefined;
|
|
80
|
-
}
|
|
82
|
+
}
|
|
81
83
|
|
|
82
|
-
|
|
84
|
+
function tempDisableDrag() {
|
|
83
85
|
dragDisabled = true;
|
|
84
86
|
setTimeout(() => {
|
|
85
87
|
dragDisabled = disabled;
|
|
86
88
|
}, 300);
|
|
87
|
-
}
|
|
89
|
+
}
|
|
88
90
|
|
|
89
|
-
|
|
91
|
+
function onFinalize({ detail }) {
|
|
90
92
|
items = detail;
|
|
91
93
|
onChange();
|
|
92
|
-
}
|
|
94
|
+
}
|
|
93
95
|
|
|
94
96
|
onMount(updateItems);
|
|
95
97
|
</script>
|
|
@@ -112,12 +114,12 @@
|
|
|
112
114
|
</AddModal>
|
|
113
115
|
|
|
114
116
|
<div class="form-group" class:hidden={!show}>
|
|
115
|
-
<label
|
|
117
|
+
<label class="control-label {required ? 'control-label--required' : ''}" for={domId}>
|
|
116
118
|
{label}
|
|
117
119
|
</label>
|
|
118
120
|
<div class="list-component">
|
|
119
121
|
<div class="list-component__list-wrapper ui-resizable">
|
|
120
|
-
<Sortable {
|
|
122
|
+
<Sortable {dragDisabled} {items} on:finalize={onFinalize} let:item>
|
|
121
123
|
<SortableItem
|
|
122
124
|
{...item}
|
|
123
125
|
{disabled}
|
|
@@ -127,9 +129,9 @@
|
|
|
127
129
|
on:click={tempDisableDrag}
|
|
128
130
|
/>
|
|
129
131
|
</Sortable>
|
|
130
|
-
<div
|
|
132
|
+
<div class="ui-resizable-handle ui-resizable-s" use:resizer />
|
|
131
133
|
</div>
|
|
132
|
-
<button class="list-component__add-item btn btn-link" on:click={onAddOpen}
|
|
134
|
+
<button class="list-component__add-item btn btn-link" {disabled} on:click={onAddOpen}>
|
|
133
135
|
<i class="glyphicons plus" aria-hidden="true" />
|
|
134
136
|
{i18n('add')}
|
|
135
137
|
</button>
|
|
@@ -139,7 +141,7 @@
|
|
|
139
141
|
{/if}
|
|
140
142
|
</div>
|
|
141
143
|
|
|
142
|
-
<DataHolder {
|
|
144
|
+
<DataHolder {name} {domId} {required} {value} />
|
|
143
145
|
</div>
|
|
144
146
|
|
|
145
147
|
<style lang="scss">
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Wrapper component for Sitevision [Custom selector](https://developer.sitevision.se/docs/webapps/webapps-2/configuration/sitevision-components#h-Customselectorsince91).
|
|
4
4
|
|
|
5
|
-

|
|
6
6
|

|
|
7
7
|
|
|
8
8
|
## Props
|
package/createConfigApp/index.js
CHANGED
|
@@ -20,7 +20,7 @@ export default function createConfigApp(App) {
|
|
|
20
20
|
|
|
21
21
|
window.getValues = () => {
|
|
22
22
|
// eslint-disable-next-line no-underscore-dangle
|
|
23
|
-
const values = window
|
|
23
|
+
const values = window?.sv?.getValues() || window?._getValues();
|
|
24
24
|
return {
|
|
25
25
|
...values,
|
|
26
26
|
__lastEditTimestamp: new Date().getTime(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soleil-se/config-svelte",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"module": "./index.js",
|
|
6
6
|
"svelte": "./index.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"license": "UNLICENSED",
|
|
9
9
|
"sideEffects": false,
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@sitevision/api": "
|
|
11
|
+
"@sitevision/api": "*",
|
|
12
12
|
"svelte": "^3.46.0 || ^4.0.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|