Skip to content

Commit 5c8b6ed

Browse files
committed
Add ignore mouse events feature
1 parent 16b8efd commit 5c8b6ed

File tree

4 files changed

+57
-33
lines changed

4 files changed

+57
-33
lines changed

public/widget.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -137,38 +137,38 @@
137137
]
138138
},
139139
{
140-
"name": "cn.widgetjs.widgets.labor_progress",
140+
"name": "cn.widgetjs.widgets.phone_reminder",
141141
"title": {
142-
"zh-CN": "打工进度"
142+
"zh-CN": "来电提醒"
143143
},
144144
"description": {
145-
"zh-CN": "打工人,打工魂"
145+
"zh-CN": "用灵动通知加语音,提醒重要事项"
146146
},
147147
"keywords": [
148148
"recommend"
149149
],
150150
"security": false,
151151
"permissions": [],
152152
"lang": "zh-CN",
153-
"width": 4,
153+
"width": 1,
154154
"height": 1,
155-
"maxWidth": 6,
155+
"maxWidth": 1,
156156
"webviewTag": false,
157-
"maxHeight": 2,
158-
"minWidth": 3,
157+
"maxHeight": 1,
158+
"minWidth": 1,
159159
"minHeight": 1,
160160
"movable": true,
161161
"singleton": false,
162162
"resizable": true,
163-
"path": "/widget/labor_progress",
163+
"path": "/widget/phone_reminder",
164164
"meta": {},
165-
"backgroundThrottling": true,
166-
"previewImage": "/images/preview_labor_progress.png",
165+
"backgroundThrottling": false,
166+
"previewImage": "/images/preview_phone_reminder.png",
167167
"categories": [
168168
"fun"
169169
],
170-
"supportDeployMode": 17,
171-
"configPagePath": "/widget/config/labor_progress?frame=true&transparent=false",
170+
"supportDeployMode": 65536,
171+
"configPagePath": "/widget/config/phone_reminder?frame=true&transparent=false",
172172
"routes": [],
173173
"socialLinks": [
174174
{
@@ -178,38 +178,38 @@
178178
]
179179
},
180180
{
181-
"name": "cn.widgetjs.widgets.phone_reminder",
181+
"name": "cn.widgetjs.widgets.labor_progress",
182182
"title": {
183-
"zh-CN": "来电提醒"
183+
"zh-CN": "打工进度"
184184
},
185185
"description": {
186-
"zh-CN": "用灵动通知加语音,提醒重要事项"
186+
"zh-CN": "打工人,打工魂"
187187
},
188188
"keywords": [
189189
"recommend"
190190
],
191191
"security": false,
192192
"permissions": [],
193193
"lang": "zh-CN",
194-
"width": 1,
194+
"width": 4,
195195
"height": 1,
196-
"maxWidth": 1,
196+
"maxWidth": 6,
197197
"webviewTag": false,
198-
"maxHeight": 1,
199-
"minWidth": 1,
198+
"maxHeight": 2,
199+
"minWidth": 3,
200200
"minHeight": 1,
201201
"movable": true,
202202
"singleton": false,
203203
"resizable": true,
204-
"path": "/widget/phone_reminder",
204+
"path": "/widget/labor_progress",
205205
"meta": {},
206-
"backgroundThrottling": false,
207-
"previewImage": "/images/preview_phone_reminder.png",
206+
"backgroundThrottling": true,
207+
"previewImage": "/images/preview_labor_progress.png",
208208
"categories": [
209209
"fun"
210210
],
211-
"supportDeployMode": 65536,
212-
"configPagePath": "/widget/config/phone_reminder?frame=true&transparent=false",
211+
"supportDeployMode": 17,
212+
"configPagePath": "/widget/config/labor_progress?frame=true&transparent=false",
213213
"routes": [],
214214
"socialLinks": [
215215
{

src/views/manager/DeployedWidgetCard.vue

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { DeployedWidgetApi, WidgetApi } from '@widget-js/core'
44
import type { PropType } from 'vue'
55
import { ref } from 'vue'
66
import { useI18n } from 'vue-i18n'
7+
import { Code, Delete, Refresh } from '@icon-park/vue-next'
78
import { useDebugConfig } from '@/composition/useAppConfig'
89
910
const props = defineProps({
@@ -16,6 +17,7 @@ const props = defineProps({
1617
const emits = defineEmits(['remove'])
1718
const widget = ref<Widget>()
1819
const { t, locale } = useI18n()
20+
const ignoreMouseEvents = ref<boolean>(props.deployedWidget.isIgnoreMouseEvents ?? false)
1921
WidgetApi.getWidget(props.deployedWidget.name).then((value) => {
2022
widget.value = value
2123
})
@@ -33,6 +35,10 @@ function openDevTools() {
3335
function refresh() {
3436
WidgetApi.reload(props.deployedWidget.id)
3537
}
38+
39+
function onIgnoreMouseEventChange() {
40+
WidgetApi.setIgnoreMouseEvents(props.deployedWidget.id, ignoreMouseEvents.value)
41+
}
3642
</script>
3743

3844
<template>
@@ -50,17 +56,21 @@ function refresh() {
5056
<!-- <span><AutoWidth class="mr-2" />W: {{ deployedWidget.width }} H: {{ deployedWidget.height }}</span> -->
5157
<!-- </div> -->
5258
</div>
53-
<div class="flex">
59+
<div class="flex items-center">
60+
<el-checkbox v-model="ignoreMouseEvents" class="mr-auto" @change="onIgnoreMouseEventChange">
61+
鼠标穿透
62+
</el-checkbox>
63+
<span class="ml-auto" />
5464
<el-button v-if="debugMode" size="small" type="primary" @click="openDevTools">
55-
DevTools
65+
<Code />
5666
</el-button>
5767
<el-button size="small" type="primary" @click="refresh">
58-
{{ t('manager.refresh') }}
68+
<Refresh />
5969
</el-button>
6070
<el-popconfirm :title="t('manager.confirmRemove')" width="200" @confirm="removeWidget">
6171
<template #reference>
6272
<el-button size="small" type="danger">
63-
{{ t('manager.remove') }}
73+
<Delete />
6474
</el-button>
6575
</template>
6676
</el-popconfirm>

src/views/manager/DeployedWidgetList.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
import { ref } from 'vue'
33
import type { DeployedWidget } from '@widget-js/core'
44
import { BrowserWindowApi, DeployedWidgetApi } from '@widget-js/core'
5+
import { useEventListener } from '@vueuse/core'
56
import DeployedWidgetCard from '@/views/manager/DeployedWidgetCard.vue'
67
7-
const widgets = ref<DeployedWidget[]>()
8+
const widgets = ref<DeployedWidget[]>([])
89
DeployedWidgetApi.getDeployedWidgets().then((value) => {
910
widgets.value = value
1011
})
@@ -13,10 +14,16 @@ function removeWidget(widget: DeployedWidget) {
1314
DeployedWidgetApi.removeDeployedWidget(widget.id)
1415
widgets.value = widgets.value.filter(it => it.id != widget.id)
1516
}
17+
18+
useEventListener('focus', () => {
19+
DeployedWidgetApi.getDeployedWidgets().then((value) => {
20+
widgets.value = value
21+
})
22+
})
1623
</script>
1724

1825
<template>
19-
<div class="flex flex-col gap-3 px-3">
26+
<div class="flex flex-col gap-3 px-3 pb-4">
2027
<DeployedWidgetCard v-for="widget in widgets" :key="widget.id" :deployed-widget="widget" @remove="removeWidget" />
2128
</div>
2229
</template>

src/views/tray/TrayMenuView.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ function copyAndReport() {
4646
<div class="title">
4747
{{ t('tray.runningWidgets') }}
4848
</div>
49-
<el-scrollbar height="400">
49+
<el-scrollbar height="390">
5050
<DeployedWidgetList />
5151
</el-scrollbar>
5252
</div>
5353
<div class="menus flex flex-col gap-2 my-2">
5454
<div class="menu-item" @click="AppApi.openAddWidgetWindow()">
5555
<Plus />
56-
{{ t('tray.addWidget') }}
56+
<div>{{ t('tray.addWidget') }}</div>
5757
</div>
5858
<div class="menu-item" @click="AppApi.openSettingWindow()">
5959
<Setting />
@@ -81,7 +81,7 @@ function copyAndReport() {
8181
</div>
8282
</template>
8383

84-
<style scoped lang="scss">
84+
<style lang="scss">
8585
.header, .footer {
8686
background: #f8f9fa;
8787
color: #303030;
@@ -101,12 +101,19 @@ function copyAndReport() {
101101
cursor: pointer;
102102
border-radius: 4px;
103103
background-color: rgba(0, 0, 0, 0.04);
104+
.i-icon {
105+
cursor: pointer;
106+
}
104107
&:hover {
105108
background-color: rgba(0, 0, 0, 0.08);
106109
}
107110
}
108111
}
109112
113+
.el-scrollbar{
114+
height: 390px;
115+
}
116+
110117
.widgets {
111118
border-bottom: 1px solid #e7e7e7;
112119
}

0 commit comments

Comments
 (0)