@soleil-se/config-svelte 1.16.0 → 1.16.2
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 +8 -0
- package/components/CustomList/Component.svelte +3 -2
- package/components/CustomList/internal/SortableItem.svelte +3 -2
- package/components/ListSelector/Component.svelte +1 -1
- package/components/Modal/Component.svelte +5 -3
- package/components/Modal/api/updateGlobalValues.js +28 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ 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.16.2] - 2022-11-24
|
|
9
|
+
|
|
10
|
+
- [ListSelector](./components/ListSelector) now works properly in [CustomList](./components/CustomList).
|
|
11
|
+
|
|
12
|
+
## [1.16.1] - 2022-11-18
|
|
13
|
+
|
|
14
|
+
- Suppress `a11y-click-events-have-key-events` since the key events are handled on other elements.
|
|
15
|
+
|
|
8
16
|
## [1.16.0] - 2022-11-09
|
|
9
17
|
|
|
10
18
|
- Add singular and plural suffix support for [NumberSpinner](./components/NumberSpinner)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
3
2
|
import { createEventDispatcher, onMount } from 'svelte';
|
|
4
3
|
import { generateId, addGeneratedIds } from '../../utils';
|
|
5
4
|
import { resizer } from '../../actions';
|
|
@@ -72,7 +71,9 @@
|
|
|
72
71
|
|
|
73
72
|
const tempDisableDrag = () => {
|
|
74
73
|
dragDisabled = true;
|
|
75
|
-
setTimeout(() => {
|
|
74
|
+
setTimeout(() => {
|
|
75
|
+
dragDisabled = disabled;
|
|
76
|
+
}, 300);
|
|
76
77
|
};
|
|
77
78
|
|
|
78
79
|
const onFinalize = ({ detail }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { createEventDispatcher } from 'svelte';
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
export let id;
|
|
5
5
|
export let name;
|
|
6
6
|
export let disabled;
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
const removeItem = () => {
|
|
16
16
|
dispatch('remove', id);
|
|
17
17
|
};
|
|
18
|
-
|
|
19
18
|
</script>
|
|
20
19
|
|
|
20
|
+
<!-- This is handled by the click event on the edit button -->
|
|
21
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
21
22
|
<div class="list-component__item" on:dblclick={editItem} on:click>
|
|
22
23
|
{#if icon}
|
|
23
24
|
<i class="sv-list-icon {icon}" aria-hidden="true" />
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
selectable = Array.isArray(selectable) ? selectable.join(',') : selectable;
|
|
20
20
|
// SiteVision saves as an object, we need the value as comma separated string.
|
|
21
|
-
value = (values[name] ?? value).map((v) => v.value);
|
|
21
|
+
value = (values[name] ?? value).map((v) => v.value || v);
|
|
22
22
|
const onChange = (val) => {
|
|
23
23
|
value = val ? val.split(',') : [];
|
|
24
24
|
dispatch('input', value);
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
export let title;
|
|
11
11
|
export let open = false;
|
|
12
12
|
export let element;
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
const dispatch = createEventDispatcher();
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
const id = generateId('modal');
|
|
17
17
|
const titleId = `${id}_title`;
|
|
18
18
|
const duration = 250;
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
let saveButtonElement;
|
|
21
21
|
let a11yDialog;
|
|
22
22
|
|
|
@@ -124,6 +124,8 @@
|
|
|
124
124
|
aria-hidden="true"
|
|
125
125
|
style="--duration: {duration}ms;"
|
|
126
126
|
>
|
|
127
|
+
<!-- This is handled by the keydown event on svelte:window-->
|
|
128
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
127
129
|
<div class="overlay" on:click={close} />
|
|
128
130
|
<div class="modal-dialog" role="document">
|
|
129
131
|
<div class="modal-content">
|
|
@@ -1,15 +1,37 @@
|
|
|
1
|
+
function getNodeSelectorValue({ element, value }) {
|
|
2
|
+
const displayName = element.value;
|
|
3
|
+
return { displayName, value };
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
function getListSelectorValue({ element, value }) {
|
|
7
|
+
const displayNames = [...element.nextElementSibling.querySelectorAll('span.item-name')]
|
|
8
|
+
.map((itemNameElement) => itemNameElement.textContent.trim());
|
|
9
|
+
|
|
10
|
+
return value.map((id, i) => ({
|
|
11
|
+
displayName: displayNames[i],
|
|
12
|
+
value: id,
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getValue({ element, value }) {
|
|
17
|
+
const isNodeSelector = !!element.dataset.value;
|
|
18
|
+
const isListSelector = element.getAttribute('data-component')?.includes('-list');
|
|
19
|
+
|
|
20
|
+
if (isNodeSelector) {
|
|
21
|
+
return getNodeSelectorValue({ element, value });
|
|
22
|
+
} if (isListSelector) {
|
|
23
|
+
return getListSelectorValue({ element, value });
|
|
24
|
+
}
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
|
|
1
28
|
export default function updateGlobalValues(modalElement) {
|
|
2
29
|
// eslint-disable-next-line no-underscore-dangle
|
|
3
30
|
const values = window._getValues();
|
|
4
31
|
Object.entries(values).forEach(([name, value]) => {
|
|
5
32
|
const element = modalElement.querySelector(`[name="${name}"]`);
|
|
6
33
|
if (element) {
|
|
7
|
-
|
|
8
|
-
const displayName = element.value;
|
|
9
|
-
window.CONFIG_VALUES[name] = { displayName, value };
|
|
10
|
-
} else {
|
|
11
|
-
window.CONFIG_VALUES[name] = value;
|
|
12
|
-
}
|
|
34
|
+
window.CONFIG_VALUES[name] = getValue({ element, value });
|
|
13
35
|
}
|
|
14
36
|
});
|
|
15
37
|
}
|