wx-svelte-tasklist 2.4.0 → 2.5.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 +4 -4
- package/src/components/Layout.svelte +7 -10
- package/src/components/Task.svelte +44 -2
- package/whatsnew.md +12 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wx-svelte-tasklist",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Simple Svelte component for adding a task list section on a page",
|
|
5
5
|
"productTag": "tasklist",
|
|
6
6
|
"productTrial": false,
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://svar.dev/svelte/core/",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@svar-ui/tasklist-locales": "2.
|
|
36
|
+
"@svar-ui/tasklist-locales": "2.5.0",
|
|
37
37
|
"@svar-ui/lib-data-provider": "1.7.1",
|
|
38
|
-
"@svar-ui/svelte-core": "2.
|
|
39
|
-
"@svar-ui/lib-dom": "0.
|
|
38
|
+
"@svar-ui/svelte-core": "2.5.0",
|
|
39
|
+
"@svar-ui/lib-dom": "0.12.0",
|
|
40
40
|
"@svar-ui/lib-state": "1.9.6"
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { getContext, setContext } from "svelte";
|
|
3
3
|
import { Button } from "@svar-ui/svelte-core";
|
|
4
|
-
import { delegateClick } from "@svar-ui/lib-dom";
|
|
5
4
|
import { tempID } from "@svar-ui/lib-state";
|
|
6
5
|
import Task from "./Task.svelte";
|
|
7
6
|
|
|
@@ -76,6 +75,10 @@
|
|
|
76
75
|
remove(id);
|
|
77
76
|
}
|
|
78
77
|
|
|
78
|
+
function onedit(id) {
|
|
79
|
+
if (!readonly) edit = id;
|
|
80
|
+
}
|
|
81
|
+
|
|
79
82
|
function onupdate({ task, content, status, next }) {
|
|
80
83
|
if (task.id === -1) {
|
|
81
84
|
edit = null;
|
|
@@ -98,21 +101,15 @@
|
|
|
98
101
|
edit = null;
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
|
-
|
|
102
|
-
const bodyClickHandlers = {
|
|
103
|
-
dblclick: id => {
|
|
104
|
-
if (!readonly) edit = id;
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
104
|
</script>
|
|
108
105
|
|
|
109
106
|
<div class="wx-tasks-list">
|
|
110
|
-
<div class="wx-list"
|
|
107
|
+
<div class="wx-list">
|
|
111
108
|
{#each data as task (task.id)}
|
|
112
|
-
<Task {task} {edit} {onupdate} {onremove} {readonly} />
|
|
109
|
+
<Task {task} {edit} {onupdate} {onremove} {onedit} {readonly} />
|
|
113
110
|
{/each}
|
|
114
111
|
{#if edit === -1}
|
|
115
|
-
<Task task={editTask} {edit} {onupdate}
|
|
112
|
+
<Task task={editTask} {edit} {onupdate} />
|
|
116
113
|
{/if}
|
|
117
114
|
</div>
|
|
118
115
|
{#if !readonly && edit !== -1}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Checkbox } from "@svar-ui/svelte-core";
|
|
4
4
|
import { clickOutside } from "@svar-ui/lib-dom";
|
|
5
5
|
|
|
6
|
-
let { task, edit, readonly, onupdate, onremove } = $props();
|
|
6
|
+
let { task, edit, readonly, onupdate, onremove, onedit } = $props();
|
|
7
7
|
|
|
8
8
|
const _ = getContext("wx-i18n").getGroup("tasklist");
|
|
9
9
|
|
|
@@ -46,6 +46,10 @@
|
|
|
46
46
|
adjustHeight();
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
+
|
|
50
|
+
function handleEditClick() {
|
|
51
|
+
onedit(task.id);
|
|
52
|
+
}
|
|
49
53
|
</script>
|
|
50
54
|
|
|
51
55
|
<div class="wx-task" class:wx-done={task.status}>
|
|
@@ -68,12 +72,21 @@
|
|
|
68
72
|
oninput={handleContent}
|
|
69
73
|
></textarea>
|
|
70
74
|
{:else}
|
|
71
|
-
|
|
75
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
76
|
+
<div class="wx-text-wrapper" ondblclick={() => onedit(task.id)}>
|
|
72
77
|
<span class="wx-text">{task.content}</span>
|
|
73
78
|
</div>
|
|
74
79
|
{/if}
|
|
75
80
|
</div>
|
|
76
81
|
|
|
82
|
+
<div class="wx-icon-edit">
|
|
83
|
+
{#if !readonly && edit !== task.id}
|
|
84
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
85
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
86
|
+
<i class="wxi-edit" onclick={handleEditClick}></i>
|
|
87
|
+
{/if}
|
|
88
|
+
</div>
|
|
89
|
+
|
|
77
90
|
<div class="wx-icon-close">
|
|
78
91
|
{#if !readonly && edit !== task.id}
|
|
79
92
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
@@ -174,6 +187,35 @@
|
|
|
174
187
|
color: var(--wx-color-font-alt);
|
|
175
188
|
}
|
|
176
189
|
|
|
190
|
+
.wx-icon-edit {
|
|
191
|
+
color: var(--wx-color-font-alt);
|
|
192
|
+
margin-left: 8px;
|
|
193
|
+
font-size: 20px;
|
|
194
|
+
height: 20px;
|
|
195
|
+
width: 20px;
|
|
196
|
+
opacity: 0;
|
|
197
|
+
transition: 0.3s linear;
|
|
198
|
+
display: none;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.wx-icon-edit .wxi-edit {
|
|
202
|
+
cursor: pointer;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.wx-icon-edit .wxi-edit:hover {
|
|
206
|
+
color: var(--wx-color-primary);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
@media (hover: none) {
|
|
210
|
+
.wx-icon-edit {
|
|
211
|
+
display: block;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.wx-task:hover .wx-icon-edit {
|
|
215
|
+
opacity: 1;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
177
219
|
.wx-icon-close {
|
|
178
220
|
color: var(--wx-color-font-alt);
|
|
179
221
|
margin-left: 8px;
|
package/whatsnew.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 2.5.0
|
|
2
|
+
|
|
3
|
+
- Using Svelte Core v2.5.0
|
|
4
|
+
|
|
5
|
+
## 2.4.1
|
|
6
|
+
|
|
7
|
+
### Fixes
|
|
8
|
+
|
|
9
|
+
- Tasks cannot be edited on touch devices
|
|
10
|
+
|
|
1
11
|
## 2.4.0
|
|
2
12
|
|
|
3
13
|
### Fixes
|
|
@@ -19,11 +29,11 @@
|
|
|
19
29
|
|
|
20
30
|
## 2.2.0
|
|
21
31
|
|
|
22
|
-
- Using
|
|
32
|
+
- Using Svelte Core v2.2.0
|
|
23
33
|
|
|
24
34
|
## 2.1.0
|
|
25
35
|
|
|
26
|
-
- Using
|
|
36
|
+
- Using Svelte Core v2.1.0
|
|
27
37
|
|
|
28
38
|
## 2.0.0
|
|
29
39
|
|