From f56e5155128706380d93a1f50a729d5cf1ea00ee Mon Sep 17 00:00:00 2001 From: Shigma Date: Mon, 8 May 2023 01:01:54 +0800 Subject: [PATCH] feat(dataview): support refresh button, fix #79 --- packages/client/client/styles/index.scss | 1 + plugins/dataview/client/components/data-table.vue | 12 ++++++++---- plugins/dataview/client/icons/index.ts | 2 ++ plugins/dataview/client/icons/refresh.vue | 5 +++++ plugins/dataview/client/index.vue | 12 ++++++++++-- plugins/dataview/package.json | 2 +- 6 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 plugins/dataview/client/icons/refresh.vue diff --git a/packages/client/client/styles/index.scss b/packages/client/client/styles/index.scss index 2c03111b..0216a682 100644 --- a/packages/client/client/styles/index.scss +++ b/packages/client/client/styles/index.scss @@ -314,6 +314,7 @@ html.dark .el-popper.is-dark { .el-table__header-wrapper { --el-table-tr-bg-color: var(--card-bg); --el-table-header-bg-color: var(--bg2); + --el-table-row-hover-bg-color: var(--bg1); tr { td, th { diff --git a/plugins/dataview/client/components/data-table.vue b/plugins/dataview/client/components/data-table.vue index de359011..80387f05 100644 --- a/plugins/dataview/client/components/data-table.vue +++ b/plugins/dataview/client/components/data-table.vue @@ -10,8 +10,8 @@
- 应用修改 - 取消修改 + 应用修改 + 取消修改 双击单元格修改数据
@@ -187,6 +187,10 @@ async function updateData() { } watchEffect(updateData) +defineExpose({ + updateData, +}) + const currPage = computed({ get: () => Math.floor(state.offset / state.pageSize) + 1, set: p => state.offset = (p - 1) * state.pageSize @@ -465,7 +469,7 @@ async function onInsertRow() { } } .operations { - .k-button:last-child { + .el-button:last-child { margin-right: 0; } } @@ -492,7 +496,7 @@ async function onInsertRow() { } .cell-changed { &.el-table__cell { - padding: 2px; + padding: 0 2px; } .cell, diff --git a/plugins/dataview/client/icons/index.ts b/plugins/dataview/client/icons/index.ts index 39d894f3..7f04a3b5 100644 --- a/plugins/dataview/client/icons/index.ts +++ b/plugins/dataview/client/icons/index.ts @@ -1,4 +1,6 @@ import { icons } from '@koishijs/client' import Database from './database.vue' +import Refresh from './refresh.vue' icons.register('database', Database) +icons.register('refresh', Refresh) diff --git a/plugins/dataview/client/icons/refresh.vue b/plugins/dataview/client/icons/refresh.vue new file mode 100644 index 00000000..66a2b74b --- /dev/null +++ b/plugins/dataview/client/icons/refresh.vue @@ -0,0 +1,5 @@ + diff --git a/plugins/dataview/client/index.vue b/plugins/dataview/client/index.vue index 0d9d9f3e..32bf5ad9 100644 --- a/plugins/dataview/client/index.vue +++ b/plugins/dataview/client/index.vue @@ -5,6 +5,12 @@ ({{ formatSize(store.database.size) }}) + +