wx-svelte-core 2.3.1 → 2.4.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/package.json +3 -3
- package/readme.md +2 -2
- package/src/components/Checkbox.svelte +6 -4
- package/src/components/CheckboxGroup.svelte +3 -0
- package/src/components/ColorPicker.svelte +5 -3
- package/src/components/ColorSelect.svelte +5 -3
- package/src/components/Combo.svelte +6 -3
- package/src/components/Counter.svelte +5 -3
- package/src/components/DatePicker.svelte +2 -2
- package/src/components/DateRangePicker.svelte +2 -2
- package/src/components/Field.svelte +22 -8
- package/src/components/Fullscreen.svelte +82 -0
- package/src/components/MultiCombo.svelte +5 -3
- package/src/components/Popup.svelte +5 -4
- package/src/components/RadioButton.svelte +6 -4
- package/src/components/RadioButtonGroup.svelte +2 -0
- package/src/components/Select.svelte +5 -3
- package/src/components/Slider.svelte +5 -3
- package/src/components/Switch.svelte +5 -8
- package/src/components/Text.svelte +7 -5
- package/src/components/TextArea.svelte +5 -3
- package/src/components/TimePicker.svelte +6 -3
- package/src/components/helpers/getInputId.js +7 -0
- package/src/index.js +1 -0
- package/types/index.d.ts +9 -2
- package/whatsnew.md +22 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wx-svelte-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "SVAR Svelte Core - Svelte UI library of 20+ components and form controls",
|
|
5
5
|
"productTag": "core",
|
|
6
6
|
"productTrial": false,
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://svar.dev/svelte/core/",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@svar-ui/core-locales": "2.
|
|
37
|
-
"@svar-ui/lib-dom": "0.
|
|
36
|
+
"@svar-ui/core-locales": "2.4.0",
|
|
37
|
+
"@svar-ui/lib-dom": "0.11.1",
|
|
38
38
|
"@svar-ui/lib-svelte": "0.5.2"
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
package/readme.md
CHANGED
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
|
|
19
19
|
</div>
|
|
20
20
|
|
|
21
|
-
[SVAR Core library](https://svar.dev/svelte/core/) offers a set of 20+ ready-made Svelte UI components: form controls, popups, date and time picker,
|
|
21
|
+
[SVAR Svelte Core library](https://svar.dev/svelte/core/) offers a set of 20+ ready-made Svelte UI components: form controls, popups, date and time picker, selects, notifications, and more. All components are lightweight, responsive, fast-performing, and support TypeScript. The library comes in beautifully designed light and dark themes that are easy to customize.
|
|
22
22
|
|
|
23
23
|
<img src="https://svar.dev/images/github/github-core.png" alt="SVAR Core - Svelte UI Components Library" style="width: 752px;">
|
|
24
24
|
|
|
25
|
-
SVAR Core library includes the following components:
|
|
25
|
+
SVAR Svelte Core library includes the following components:
|
|
26
26
|
|
|
27
27
|
- buttons & form controls,
|
|
28
28
|
- calendar (datepicker),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { getInputId } from "./helpers/getInputId";
|
|
3
3
|
|
|
4
4
|
let {
|
|
5
|
-
id
|
|
5
|
+
id,
|
|
6
6
|
label = "",
|
|
7
7
|
inputValue = "",
|
|
8
8
|
value = $bindable(false),
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
onchange,
|
|
12
12
|
} = $props();
|
|
13
13
|
|
|
14
|
+
const inputId = $state(getInputId(id));
|
|
15
|
+
|
|
14
16
|
function handlerChange({ target }) {
|
|
15
17
|
value = target.checked;
|
|
16
18
|
onchange && onchange({ value, inputValue });
|
|
@@ -20,13 +22,13 @@
|
|
|
20
22
|
<div {style} class="wx-checkbox">
|
|
21
23
|
<input
|
|
22
24
|
type="checkbox"
|
|
23
|
-
{
|
|
25
|
+
id={inputId}
|
|
24
26
|
{disabled}
|
|
25
27
|
checked={value}
|
|
26
28
|
value={inputValue}
|
|
27
29
|
onchange={handlerChange}
|
|
28
30
|
/>
|
|
29
|
-
<label for={
|
|
31
|
+
<label for={inputId}>
|
|
30
32
|
<span></span>
|
|
31
33
|
{#if label}<span>{label}</span>{/if}
|
|
32
34
|
</label>
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import Checkbox from "./Checkbox.svelte";
|
|
3
|
+
import { setContext } from "svelte";
|
|
3
4
|
|
|
4
5
|
let { options = [], value = $bindable([]), type = "", onchange } = $props();
|
|
5
6
|
|
|
7
|
+
setContext("wx-input-id", null);
|
|
8
|
+
|
|
6
9
|
function handleChange(obj) {
|
|
7
10
|
if (obj.value) value = [...value, obj.inputValue];
|
|
8
11
|
else value = value.filter(a => a != obj.inputValue);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { uid } from "@svar-ui/lib-dom";
|
|
3
2
|
import Dropdown from "./Dropdown.svelte";
|
|
4
3
|
import ColorBoard from "./ColorBoard.svelte";
|
|
4
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
7
|
value = $bindable(""),
|
|
8
|
-
id
|
|
8
|
+
id,
|
|
9
9
|
placeholder = "",
|
|
10
10
|
title = "",
|
|
11
11
|
disabled = false,
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
onchange,
|
|
15
15
|
} = $props();
|
|
16
16
|
|
|
17
|
+
const inputId = $state(getInputId(id));
|
|
18
|
+
|
|
17
19
|
let popup = $state(false);
|
|
18
20
|
|
|
19
21
|
function handlePopup() {
|
|
@@ -43,7 +45,7 @@
|
|
|
43
45
|
{title}
|
|
44
46
|
{value}
|
|
45
47
|
readonly
|
|
46
|
-
{
|
|
48
|
+
id={inputId}
|
|
47
49
|
{placeholder}
|
|
48
50
|
{disabled}
|
|
49
51
|
class:wx-error={error}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { uid } from "@svar-ui/lib-dom";
|
|
3
2
|
import Dropdown from "./Dropdown.svelte";
|
|
3
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
4
4
|
|
|
5
5
|
const defaultColors = [
|
|
6
6
|
"#00a037",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
let {
|
|
16
16
|
colors = defaultColors,
|
|
17
17
|
value = $bindable(""),
|
|
18
|
-
id
|
|
18
|
+
id,
|
|
19
19
|
clear = false,
|
|
20
20
|
placeholder = "",
|
|
21
21
|
title = "",
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
onchange,
|
|
25
25
|
} = $props();
|
|
26
26
|
|
|
27
|
+
const inputId = $state(getInputId(id));
|
|
28
|
+
|
|
27
29
|
let popup = $state(false);
|
|
28
30
|
|
|
29
31
|
function selectColor(ev, color) {
|
|
@@ -50,7 +52,7 @@
|
|
|
50
52
|
{title}
|
|
51
53
|
{value}
|
|
52
54
|
readonly
|
|
53
|
-
{
|
|
55
|
+
id={inputId}
|
|
54
56
|
{placeholder}
|
|
55
57
|
{disabled}
|
|
56
58
|
class:wx-error={error}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import List from "./helpers/SuggestDropdown.svelte";
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
4
5
|
|
|
5
6
|
let {
|
|
6
7
|
value = $bindable(""),
|
|
7
|
-
id
|
|
8
|
+
id,
|
|
8
9
|
options = [],
|
|
9
10
|
textOptions = null,
|
|
10
11
|
textField = "label",
|
|
@@ -17,6 +18,8 @@
|
|
|
17
18
|
onchange,
|
|
18
19
|
} = $props();
|
|
19
20
|
|
|
21
|
+
const inputId = $state(getInputId(id));
|
|
22
|
+
|
|
20
23
|
let filterActive = $state(false);
|
|
21
24
|
let textInput = $state("");
|
|
22
25
|
|
|
@@ -115,7 +118,7 @@
|
|
|
115
118
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
116
119
|
<div class="wx-combo" {onclick} {onkeydown} {title}>
|
|
117
120
|
<input
|
|
118
|
-
{
|
|
121
|
+
id={inputId}
|
|
119
122
|
bind:this={inputElement}
|
|
120
123
|
value={text}
|
|
121
124
|
class:wx-error={error}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
3
3
|
|
|
4
4
|
let {
|
|
5
|
-
id
|
|
5
|
+
id,
|
|
6
6
|
value = $bindable(0),
|
|
7
7
|
step = 1,
|
|
8
8
|
min = 0,
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
onchange,
|
|
14
14
|
} = $props();
|
|
15
15
|
|
|
16
|
+
const inputId = $state(getInputId(id));
|
|
17
|
+
|
|
16
18
|
function dec() {
|
|
17
19
|
if (readonly || value <= min) return;
|
|
18
20
|
value -= step;
|
|
@@ -58,7 +60,7 @@
|
|
|
58
60
|
</svg>
|
|
59
61
|
</button>
|
|
60
62
|
<input
|
|
61
|
-
{
|
|
63
|
+
id={inputId}
|
|
62
64
|
type="text"
|
|
63
65
|
class="wx-input"
|
|
64
66
|
{disabled}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { getContext } from "svelte";
|
|
3
|
-
import {
|
|
3
|
+
import { dateToString } from "@svar-ui/lib-dom";
|
|
4
4
|
|
|
5
5
|
import Text from "./Text.svelte";
|
|
6
6
|
import Dropdown from "./Dropdown.svelte";
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
let {
|
|
11
11
|
value = $bindable(),
|
|
12
|
-
id
|
|
12
|
+
id,
|
|
13
13
|
disabled = false,
|
|
14
14
|
error = false,
|
|
15
15
|
width = "unset",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { getContext } from "svelte";
|
|
3
|
-
import {
|
|
3
|
+
import { dateToString } from "@svar-ui/lib-dom";
|
|
4
4
|
|
|
5
5
|
import Text from "./Text.svelte";
|
|
6
6
|
import Dropdown from "./Dropdown.svelte";
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
let {
|
|
11
11
|
value = $bindable(),
|
|
12
|
-
id
|
|
12
|
+
id,
|
|
13
13
|
disabled = false,
|
|
14
14
|
error = false,
|
|
15
15
|
width = "unset",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { uid } from "@svar-ui/lib-dom";
|
|
3
|
-
|
|
3
|
+
import { setContext } from "svelte";
|
|
4
4
|
let {
|
|
5
5
|
label = "",
|
|
6
6
|
position = "",
|
|
@@ -11,7 +11,15 @@
|
|
|
11
11
|
children,
|
|
12
12
|
} = $props();
|
|
13
13
|
|
|
14
|
-
let
|
|
14
|
+
let firstInputId = $state(null);
|
|
15
|
+
|
|
16
|
+
const registerInput = () => {
|
|
17
|
+
const id = uid();
|
|
18
|
+
if (!firstInputId) firstInputId = id;
|
|
19
|
+
return id;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
setContext("wx-input-id", registerInput);
|
|
15
23
|
</script>
|
|
16
24
|
|
|
17
25
|
<div
|
|
@@ -20,9 +28,15 @@
|
|
|
20
28
|
class:wx-required={required}
|
|
21
29
|
style={width ? `width: ${width}` : ""}
|
|
22
30
|
>
|
|
23
|
-
{#if label}
|
|
31
|
+
{#if label}
|
|
32
|
+
{#if firstInputId}
|
|
33
|
+
<label class="wx-label" for={firstInputId}>{label}</label>
|
|
34
|
+
{:else}
|
|
35
|
+
<div class="wx-label">{label}</div>
|
|
36
|
+
{/if}
|
|
37
|
+
{/if}
|
|
24
38
|
<div class="wx-field-control wx-{type}">
|
|
25
|
-
{@render children?.(
|
|
39
|
+
{@render children?.()}
|
|
26
40
|
</div>
|
|
27
41
|
</div>
|
|
28
42
|
|
|
@@ -37,7 +51,7 @@
|
|
|
37
51
|
flex-wrap: nowrap;
|
|
38
52
|
align-items: flex-start;
|
|
39
53
|
}
|
|
40
|
-
.wx-field.wx-left > label {
|
|
54
|
+
.wx-field.wx-left > .wx-label {
|
|
41
55
|
width: var(--wx-label-width);
|
|
42
56
|
flex-shrink: 0;
|
|
43
57
|
margin: 0 var(--wx-field-gutter) 0 0;
|
|
@@ -49,7 +63,7 @@
|
|
|
49
63
|
.wx-field.wx-left > .wx-field-control {
|
|
50
64
|
max-width: calc(100% - var(--wx-label-width) - var(--wx-field-gutter));
|
|
51
65
|
}
|
|
52
|
-
.wx-field.wx-error label {
|
|
66
|
+
.wx-field.wx-error .wx-label {
|
|
53
67
|
color: var(--wx-color-danger);
|
|
54
68
|
}
|
|
55
69
|
|
|
@@ -78,7 +92,7 @@
|
|
|
78
92
|
);
|
|
79
93
|
}
|
|
80
94
|
|
|
81
|
-
label {
|
|
95
|
+
.wx-label {
|
|
82
96
|
display: block;
|
|
83
97
|
margin: var(--wx-label-margin);
|
|
84
98
|
padding: var(--wx-label-padding);
|
|
@@ -89,7 +103,7 @@
|
|
|
89
103
|
color: var(--wx-label-font-color);
|
|
90
104
|
}
|
|
91
105
|
|
|
92
|
-
.wx-required label::after {
|
|
106
|
+
.wx-required .wx-label::after {
|
|
93
107
|
content: " *";
|
|
94
108
|
color: var(--wx-color-danger);
|
|
95
109
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { hotkeys } from "@svar-ui/lib-dom";
|
|
3
|
+
import Button from "./Button.svelte";
|
|
4
|
+
|
|
5
|
+
let { hotkey = null, toggleButton, children } = $props();
|
|
6
|
+
|
|
7
|
+
$effect(() => {
|
|
8
|
+
if (hotkey)
|
|
9
|
+
$hotkeys.configure(
|
|
10
|
+
{
|
|
11
|
+
[hotkey]: toggleFullscreen,
|
|
12
|
+
},
|
|
13
|
+
node
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
let node = null;
|
|
18
|
+
let inFullscreen = $state(false);
|
|
19
|
+
let icon = $derived(`wxi-${inFullscreen ? "collapse" : "expand"}`);
|
|
20
|
+
|
|
21
|
+
function toggleFullscreen() {
|
|
22
|
+
if (!inFullscreen && node) {
|
|
23
|
+
node.requestFullscreen();
|
|
24
|
+
} else if (inFullscreen) {
|
|
25
|
+
document.exitFullscreen();
|
|
26
|
+
}
|
|
27
|
+
inFullscreen = !inFullscreen;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const setFullscreenState = () => {
|
|
31
|
+
inFullscreen = document.fullscreenElement === node;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
$effect(() => {
|
|
35
|
+
document.addEventListener("fullscreenchange", setFullscreenState);
|
|
36
|
+
return () => {
|
|
37
|
+
document.removeEventListener(
|
|
38
|
+
"fullscreenchange",
|
|
39
|
+
setFullscreenState
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<div class="wx-fullscreen" bind:this={node} tabindex="-1">
|
|
46
|
+
{@render children?.()}
|
|
47
|
+
{#if toggleButton}
|
|
48
|
+
{@render toggleButton(toggleFullscreen, inFullscreen)}
|
|
49
|
+
{:else}
|
|
50
|
+
<Button css="wx-fullscreen-button" onclick={toggleFullscreen}>
|
|
51
|
+
<i class={`${icon} wx-fullscreen-icon`}> </i>
|
|
52
|
+
</Button>
|
|
53
|
+
{/if}
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<style>
|
|
57
|
+
.wx-fullscreen::backdrop {
|
|
58
|
+
background-color: var(--wx-background);
|
|
59
|
+
}
|
|
60
|
+
.wx-fullscreen {
|
|
61
|
+
position: relative;
|
|
62
|
+
height: 100%;
|
|
63
|
+
width: 100%;
|
|
64
|
+
outline: none;
|
|
65
|
+
}
|
|
66
|
+
.wx-fullscreen-icon {
|
|
67
|
+
font-size: 20px;
|
|
68
|
+
height: 20px;
|
|
69
|
+
margin: auto;
|
|
70
|
+
}
|
|
71
|
+
.wx-fullscreen :global(.wx-fullscreen-button) {
|
|
72
|
+
width: 40px;
|
|
73
|
+
height: 40px;
|
|
74
|
+
border: none;
|
|
75
|
+
border-radius: 50%;
|
|
76
|
+
position: absolute;
|
|
77
|
+
right: 25px;
|
|
78
|
+
bottom: 35px;
|
|
79
|
+
display: flex;
|
|
80
|
+
padding: initial;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { uid } from "@svar-ui/lib-dom";
|
|
3
2
|
import List from "./helpers/SuggestDropdown.svelte";
|
|
4
3
|
import Checkbox from "./Checkbox.svelte";
|
|
4
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
|
-
id
|
|
7
|
+
id,
|
|
8
8
|
value = $bindable([]),
|
|
9
9
|
options = [],
|
|
10
10
|
textOptions = null,
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
children,
|
|
19
19
|
} = $props();
|
|
20
20
|
|
|
21
|
+
const inputId = $state(getInputId(id));
|
|
22
|
+
|
|
21
23
|
let text = $state("");
|
|
22
24
|
let selected = $derived(
|
|
23
25
|
value ? (textOptions || options).filter(i => value.includes(i.id)) : []
|
|
@@ -117,7 +119,7 @@
|
|
|
117
119
|
</div>
|
|
118
120
|
<div class="wx-select">
|
|
119
121
|
<input
|
|
120
|
-
{
|
|
122
|
+
id={inputId}
|
|
121
123
|
type="text"
|
|
122
124
|
bind:this={inputElement}
|
|
123
125
|
bind:value={text}
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
at = "bottom",
|
|
9
9
|
parent = null,
|
|
10
10
|
oncancel,
|
|
11
|
-
mount,
|
|
12
11
|
children,
|
|
13
12
|
} = $props();
|
|
14
13
|
|
|
@@ -28,8 +27,10 @@
|
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
onMount(() => {
|
|
31
|
+
updatePosition();
|
|
32
|
+
requestAnimationFrame(updatePosition);
|
|
33
|
+
});
|
|
33
34
|
$effect(() => {
|
|
34
35
|
updatePosition(parent);
|
|
35
36
|
});
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
use:clickOutside={down}
|
|
44
45
|
bind:this={self}
|
|
45
46
|
class="wx-popup"
|
|
46
|
-
style="position:
|
|
47
|
+
style="position:absolute;top:{y}px;left:{x}px;width:{width};"
|
|
47
48
|
>
|
|
48
49
|
{@render children?.()}
|
|
49
50
|
</div>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
3
3
|
|
|
4
4
|
let {
|
|
5
|
-
id
|
|
5
|
+
id,
|
|
6
6
|
label = "",
|
|
7
7
|
value = $bindable(""),
|
|
8
8
|
name = "",
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
onchange,
|
|
12
12
|
} = $props();
|
|
13
13
|
|
|
14
|
+
const inputId = $state(getInputId(id));
|
|
15
|
+
|
|
14
16
|
function handlerChange(ev) {
|
|
15
17
|
value = ev.target.checked;
|
|
16
18
|
if (value) onchange && onchange({ value: true, inputValue });
|
|
@@ -20,14 +22,14 @@
|
|
|
20
22
|
<div class="wx-radio">
|
|
21
23
|
<input
|
|
22
24
|
type="radio"
|
|
23
|
-
{
|
|
25
|
+
id={inputId}
|
|
24
26
|
{disabled}
|
|
25
27
|
{name}
|
|
26
28
|
value={inputValue}
|
|
27
29
|
checked={value}
|
|
28
30
|
onchange={handlerChange}
|
|
29
31
|
/>
|
|
30
|
-
<label for={
|
|
32
|
+
<label for={inputId}>
|
|
31
33
|
<span></span>
|
|
32
34
|
{#if label}<span>{label}</span>{/if}
|
|
33
35
|
</label>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { uid } from "@svar-ui/lib-dom";
|
|
3
3
|
import RadioButton from "./RadioButton.svelte";
|
|
4
|
+
import { setContext } from "svelte";
|
|
4
5
|
|
|
5
6
|
let {
|
|
6
7
|
options = [{}],
|
|
@@ -9,6 +10,7 @@
|
|
|
9
10
|
onchange,
|
|
10
11
|
} = $props();
|
|
11
12
|
|
|
13
|
+
setContext("wx-input-id", null);
|
|
12
14
|
const name = uid();
|
|
13
15
|
|
|
14
16
|
function handleChange(ev) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
3
3
|
|
|
4
4
|
let {
|
|
5
5
|
value = $bindable(""),
|
|
@@ -10,10 +10,12 @@
|
|
|
10
10
|
error = false,
|
|
11
11
|
textField = "label",
|
|
12
12
|
clear = false,
|
|
13
|
-
id
|
|
13
|
+
id,
|
|
14
14
|
onchange,
|
|
15
15
|
} = $props();
|
|
16
16
|
|
|
17
|
+
const inputId = $state(getInputId(id));
|
|
18
|
+
|
|
17
19
|
function unselect() {
|
|
18
20
|
value = "";
|
|
19
21
|
onchange && onchange({ value });
|
|
@@ -26,7 +28,7 @@
|
|
|
26
28
|
|
|
27
29
|
<div class="wx-select">
|
|
28
30
|
<select
|
|
29
|
-
{
|
|
31
|
+
id={inputId}
|
|
30
32
|
bind:value
|
|
31
33
|
{disabled}
|
|
32
34
|
class:wx-error={error}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
3
3
|
|
|
4
4
|
let {
|
|
5
|
-
id
|
|
5
|
+
id,
|
|
6
6
|
label = "",
|
|
7
7
|
width = "",
|
|
8
8
|
min = 0,
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
onchange,
|
|
15
15
|
} = $props();
|
|
16
16
|
|
|
17
|
+
const inputId = $state(getInputId(id));
|
|
18
|
+
|
|
17
19
|
let bgStyle = $derived(() => {
|
|
18
20
|
return disabled
|
|
19
21
|
? ""
|
|
@@ -40,7 +42,7 @@
|
|
|
40
42
|
{#if label}<label for={id}>{label}</label>{/if}
|
|
41
43
|
<div>
|
|
42
44
|
<input
|
|
43
|
-
{
|
|
45
|
+
id={inputId}
|
|
44
46
|
type="range"
|
|
45
47
|
{min}
|
|
46
48
|
{max}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
3
3
|
|
|
4
|
-
let {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
disabled = false,
|
|
8
|
-
onchange,
|
|
9
|
-
} = $props();
|
|
4
|
+
let { id, value = $bindable(false), disabled = false, onchange } = $props();
|
|
5
|
+
|
|
6
|
+
const inputId = $state(getInputId(id));
|
|
10
7
|
|
|
11
8
|
function onChange(event) {
|
|
12
9
|
value = event.target.checked;
|
|
@@ -20,7 +17,7 @@
|
|
|
20
17
|
checked={value}
|
|
21
18
|
onchange={onChange}
|
|
22
19
|
{disabled}
|
|
23
|
-
{
|
|
20
|
+
id={inputId}
|
|
24
21
|
/>
|
|
25
22
|
<span></span>
|
|
26
23
|
</label>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { uid } from "@svar-ui/lib-dom";
|
|
3
2
|
import { onMount } from "svelte";
|
|
3
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
4
4
|
|
|
5
5
|
let {
|
|
6
6
|
value = $bindable(""),
|
|
7
|
-
id
|
|
7
|
+
id,
|
|
8
8
|
readonly = false,
|
|
9
9
|
focus = false,
|
|
10
10
|
select = false,
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
onchange,
|
|
21
21
|
} = $props();
|
|
22
22
|
|
|
23
|
+
const inputId = $state(getInputId(id));
|
|
24
|
+
|
|
23
25
|
let cssString = $derived(
|
|
24
26
|
icon && css.indexOf("wx-icon-left") === -1
|
|
25
27
|
? "wx-icon-right " + css
|
|
@@ -57,7 +59,7 @@
|
|
|
57
59
|
<input
|
|
58
60
|
bind:value
|
|
59
61
|
bind:this={input}
|
|
60
|
-
{
|
|
62
|
+
id={inputId}
|
|
61
63
|
{readonly}
|
|
62
64
|
{disabled}
|
|
63
65
|
{placeholder}
|
|
@@ -71,7 +73,7 @@
|
|
|
71
73
|
<input
|
|
72
74
|
bind:value
|
|
73
75
|
bind:this={input}
|
|
74
|
-
{
|
|
76
|
+
id={inputId}
|
|
75
77
|
{readonly}
|
|
76
78
|
{disabled}
|
|
77
79
|
{placeholder}
|
|
@@ -85,7 +87,7 @@
|
|
|
85
87
|
<input
|
|
86
88
|
bind:value
|
|
87
89
|
bind:this={input}
|
|
88
|
-
{
|
|
90
|
+
id={inputId}
|
|
89
91
|
{readonly}
|
|
90
92
|
{disabled}
|
|
91
93
|
{placeholder}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
3
3
|
|
|
4
4
|
let {
|
|
5
5
|
value = $bindable(""),
|
|
6
|
-
id
|
|
6
|
+
id,
|
|
7
7
|
placeholder = "",
|
|
8
8
|
title = "",
|
|
9
9
|
disabled = false,
|
|
@@ -11,13 +11,15 @@
|
|
|
11
11
|
readonly = false,
|
|
12
12
|
onchange,
|
|
13
13
|
} = $props();
|
|
14
|
+
|
|
15
|
+
const inputId = $state(getInputId(id));
|
|
14
16
|
</script>
|
|
15
17
|
|
|
16
18
|
<textarea
|
|
17
19
|
class="wx-textarea"
|
|
18
20
|
class:wx-error={error}
|
|
19
21
|
bind:value
|
|
20
|
-
{
|
|
22
|
+
id={inputId}
|
|
21
23
|
{disabled}
|
|
22
24
|
{placeholder}
|
|
23
25
|
{readonly}
|
|
@@ -6,14 +6,15 @@
|
|
|
6
6
|
import TwoState from "./TwoState.svelte";
|
|
7
7
|
|
|
8
8
|
import { getContext } from "svelte";
|
|
9
|
-
import { dateToString
|
|
9
|
+
import { dateToString } from "@svar-ui/lib-dom";
|
|
10
10
|
import { defaultLocale } from "./helpers/locale";
|
|
11
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
11
12
|
|
|
12
13
|
const defValue = new Date(0, 0, 0, 0, 0);
|
|
13
14
|
|
|
14
15
|
let {
|
|
15
16
|
value = $bindable(defValue),
|
|
16
|
-
id
|
|
17
|
+
id,
|
|
17
18
|
title = "",
|
|
18
19
|
css = "",
|
|
19
20
|
disabled = false,
|
|
@@ -22,6 +23,8 @@
|
|
|
22
23
|
onchange,
|
|
23
24
|
} = $props();
|
|
24
25
|
|
|
26
|
+
const inputId = $state(getInputId(id));
|
|
27
|
+
|
|
25
28
|
const { calendar: calendarLocale, formats } = (
|
|
26
29
|
getContext("wx-i18n") || defaultLocale()
|
|
27
30
|
).getRaw();
|
|
@@ -123,7 +126,7 @@
|
|
|
123
126
|
onclick={click}
|
|
124
127
|
>
|
|
125
128
|
<Text
|
|
126
|
-
{
|
|
129
|
+
id={inputId}
|
|
127
130
|
{css}
|
|
128
131
|
{title}
|
|
129
132
|
value={textValue}
|
package/src/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { default as ColorPicker } from "./components/ColorPicker.svelte";
|
|
|
8
8
|
export { default as Combo } from "./components/Combo.svelte";
|
|
9
9
|
export { default as DatePicker } from "./components/DatePicker.svelte";
|
|
10
10
|
export { default as DateRangePicker } from "./components/DateRangePicker.svelte";
|
|
11
|
+
export { default as Fullscreen } from "./components/Fullscreen.svelte";
|
|
11
12
|
export { default as Icon } from "./components/Icon.svelte";
|
|
12
13
|
export { default as MultiCombo } from "./components/MultiCombo.svelte";
|
|
13
14
|
export { default as Popup } from "./components/Popup.svelte";
|
package/types/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TPosition } from "@svar-ui/lib-dom";
|
|
1
2
|
import type { Component } from "svelte";
|
|
2
3
|
import type { Snippet } from "svelte";
|
|
3
4
|
|
|
@@ -129,6 +130,12 @@ export declare const DateRangePicker: Component<{
|
|
|
129
130
|
}) => void;
|
|
130
131
|
}>;
|
|
131
132
|
|
|
133
|
+
export declare const Fullscreen: Component<{
|
|
134
|
+
toggleButton?: Snippet<[(ev: MouseEvent) => void, boolean]>;
|
|
135
|
+
children?: () => any;
|
|
136
|
+
hotkey?: string;
|
|
137
|
+
}>;
|
|
138
|
+
|
|
132
139
|
export declare const Icon: Component<{
|
|
133
140
|
css?: string;
|
|
134
141
|
title?: string;
|
|
@@ -154,9 +161,8 @@ export declare const MultiCombo: Component<{
|
|
|
154
161
|
export declare const Popup: Component<{
|
|
155
162
|
left?: number;
|
|
156
163
|
top?: number;
|
|
157
|
-
at?:
|
|
164
|
+
at?: TPosition;
|
|
158
165
|
parent?: HTMLElement;
|
|
159
|
-
mount?: any;
|
|
160
166
|
children?: () => any;
|
|
161
167
|
oncancel?: (ev: MouseEvent) => void;
|
|
162
168
|
}>;
|
|
@@ -435,5 +441,6 @@ export declare const SuggestDropdown: Component<{
|
|
|
435
441
|
}>;
|
|
436
442
|
|
|
437
443
|
export type { ILocale, Terms } from "@svar-ui/lib-dom";
|
|
444
|
+
export type { TPosition } from "@svar-ui/lib-dom";
|
|
438
445
|
|
|
439
446
|
export declare function popupContainer(node: HTMLElement): void;
|
package/whatsnew.md
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
|
-
## 2.
|
|
1
|
+
## Version 2.4.0
|
|
2
|
+
|
|
3
|
+
### New features
|
|
4
|
+
|
|
5
|
+
- Fullscreen component
|
|
6
|
+
|
|
7
|
+
### Updates
|
|
8
|
+
|
|
9
|
+
- Enhanced syntax of Field component that ensures proper label-input association
|
|
10
|
+
- More options to precisely position and align Popup
|
|
11
|
+
|
|
12
|
+
### Fixes
|
|
13
|
+
|
|
14
|
+
- Incorrect position of Popup in relatively positioned continer
|
|
15
|
+
- Incorrect position of Popup close to container edges
|
|
16
|
+
|
|
17
|
+
### Breaking changes
|
|
18
|
+
|
|
19
|
+
- Popup `mount` property was removed
|
|
20
|
+
|
|
21
|
+
## Version 2.3.1
|
|
2
22
|
|
|
3
23
|
### Fixes
|
|
4
24
|
|
|
5
25
|
- Incorrect location of d.ts files
|
|
6
26
|
|
|
7
|
-
## 2.3.0
|
|
27
|
+
## Version 2.3.0
|
|
8
28
|
|
|
9
29
|
### New features
|
|
10
30
|
|