From 645c679abcf9bdb46dc66578613a6aae893a9ae7 Mon Sep 17 00:00:00 2001 From: Arthur Darkstone Date: Mon, 4 Nov 2024 10:42:39 +0800 Subject: [PATCH 1/9] docs: init vxe-table demos --- docs/src/_env/adapter/index.ts | 1 + docs/src/_env/adapter/vxe-table.ts | 63 +++++++ .../components/common-ui/vben-vxe-table.md | 6 +- docs/src/demos/vben-vxe-table/basic/index.vue | 87 +++++++++ .../vben-vxe-table/custom-cell/index.vue | 107 +++++++++++ .../demos/vben-vxe-table/edit-cell/index.vue | 57 ++++++ .../demos/vben-vxe-table/edit-row/index.vue | 94 ++++++++++ docs/src/demos/vben-vxe-table/fixed/index.vue | 69 +++++++ docs/src/demos/vben-vxe-table/form/index.vue | 110 +++++++++++ .../src/demos/vben-vxe-table/remote/index.vue | 74 ++++++++ docs/src/demos/vben-vxe-table/table-data.ts | 172 ++++++++++++++++++ docs/src/demos/vben-vxe-table/tree/index.vue | 62 +++++++ .../demos/vben-vxe-table/virtual/index.vue | 66 +++++++ 13 files changed, 967 insertions(+), 1 deletion(-) create mode 100644 docs/src/_env/adapter/vxe-table.ts create mode 100644 docs/src/demos/vben-vxe-table/basic/index.vue create mode 100644 docs/src/demos/vben-vxe-table/custom-cell/index.vue create mode 100644 docs/src/demos/vben-vxe-table/edit-cell/index.vue create mode 100644 docs/src/demos/vben-vxe-table/edit-row/index.vue create mode 100644 docs/src/demos/vben-vxe-table/fixed/index.vue create mode 100644 docs/src/demos/vben-vxe-table/form/index.vue create mode 100644 docs/src/demos/vben-vxe-table/remote/index.vue create mode 100644 docs/src/demos/vben-vxe-table/table-data.ts create mode 100644 docs/src/demos/vben-vxe-table/tree/index.vue create mode 100644 docs/src/demos/vben-vxe-table/virtual/index.vue diff --git a/docs/src/_env/adapter/index.ts b/docs/src/_env/adapter/index.ts index 698d687b924..6a9391be571 100644 --- a/docs/src/_env/adapter/index.ts +++ b/docs/src/_env/adapter/index.ts @@ -1 +1,2 @@ export * from './form'; +export * from './vxe-table'; diff --git a/docs/src/_env/adapter/vxe-table.ts b/docs/src/_env/adapter/vxe-table.ts new file mode 100644 index 00000000000..e47f893833a --- /dev/null +++ b/docs/src/_env/adapter/vxe-table.ts @@ -0,0 +1,63 @@ +import { h } from 'vue'; + +import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table'; + +import { Button, Image } from 'ant-design-vue'; + +import { useVbenForm } from './form'; + +setupVbenVxeTable({ + configVxeTable: (vxeUI) => { + vxeUI.setConfig({ + grid: { + align: 'center', + border: false, + columnConfig: { + resizable: true, + }, + minHeight: 180, + proxyConfig: { + autoLoad: true, + response: { + result: 'items', + total: 'total', + list: 'items', + }, + showActiveMsg: true, + showResponseMsg: false, + }, + round: true, + showOverflow: true, + size: 'small', + }, + }); + + // 表格配置项可以用 cellRender: { name: 'CellImage' }, + vxeUI.renderer.add('CellImage', { + renderDefault(_renderOpts, params) { + const { column, row } = params; + return h(Image, { src: row[column.field] }); + }, + }); + + // 表格配置项可以用 cellRender: { name: 'CellLink' }, + vxeUI.renderer.add('CellLink', { + renderDefault(renderOpts) { + const { props } = renderOpts; + return h( + Button, + { size: 'small', type: 'link' }, + { default: () => props?.text }, + ); + }, + }); + + // 这里可以自行扩展 vxe-table 的全局配置,比如自定义格式化 + // vxeUI.formats.add + }, + useVbenForm, +}); + +export { useVbenVxeGrid }; + +export type * from '@vben/plugins/vxe-table'; diff --git a/docs/src/components/common-ui/vben-vxe-table.md b/docs/src/components/common-ui/vben-vxe-table.md index a80ef5855ee..c5567578012 100644 --- a/docs/src/components/common-ui/vben-vxe-table.md +++ b/docs/src/components/common-ui/vben-vxe-table.md @@ -4,4 +4,8 @@ outline: deep # Vben Vxe Table 表格 -文档待补充,如果需要使用,可先行查看 vxe-table 文档和 示例代码,内部有部分注释。 +框架提供的Table 列表组件基于 [vxe-table](https://xuliangzhan.github.io/vxe-table/),结合`Vben Form表单`进行了二次封装。 + +其中,表头的 **表单搜索** 部分采用了`Vben Form表单`,表格主体部分使用了`vxe-grid`组件,支持表格的分页、排序、筛选等功能。 + + diff --git a/docs/src/demos/vben-vxe-table/basic/index.vue b/docs/src/demos/vben-vxe-table/basic/index.vue new file mode 100644 index 00000000000..b446114fa70 --- /dev/null +++ b/docs/src/demos/vben-vxe-table/basic/index.vue @@ -0,0 +1,87 @@ + + + diff --git a/docs/src/demos/vben-vxe-table/custom-cell/index.vue b/docs/src/demos/vben-vxe-table/custom-cell/index.vue new file mode 100644 index 00000000000..46fd29cce15 --- /dev/null +++ b/docs/src/demos/vben-vxe-table/custom-cell/index.vue @@ -0,0 +1,107 @@ + + + diff --git a/docs/src/demos/vben-vxe-table/edit-cell/index.vue b/docs/src/demos/vben-vxe-table/edit-cell/index.vue new file mode 100644 index 00000000000..9aebde86758 --- /dev/null +++ b/docs/src/demos/vben-vxe-table/edit-cell/index.vue @@ -0,0 +1,57 @@ + + + diff --git a/docs/src/demos/vben-vxe-table/edit-row/index.vue b/docs/src/demos/vben-vxe-table/edit-row/index.vue new file mode 100644 index 00000000000..f9d25cac597 --- /dev/null +++ b/docs/src/demos/vben-vxe-table/edit-row/index.vue @@ -0,0 +1,94 @@ + + + diff --git a/docs/src/demos/vben-vxe-table/fixed/index.vue b/docs/src/demos/vben-vxe-table/fixed/index.vue new file mode 100644 index 00000000000..399d35210d7 --- /dev/null +++ b/docs/src/demos/vben-vxe-table/fixed/index.vue @@ -0,0 +1,69 @@ + + + diff --git a/docs/src/demos/vben-vxe-table/form/index.vue b/docs/src/demos/vben-vxe-table/form/index.vue new file mode 100644 index 00000000000..fad0cf58ff3 --- /dev/null +++ b/docs/src/demos/vben-vxe-table/form/index.vue @@ -0,0 +1,110 @@ + + + diff --git a/docs/src/demos/vben-vxe-table/remote/index.vue b/docs/src/demos/vben-vxe-table/remote/index.vue new file mode 100644 index 00000000000..7fc98a08b35 --- /dev/null +++ b/docs/src/demos/vben-vxe-table/remote/index.vue @@ -0,0 +1,74 @@ + + + diff --git a/docs/src/demos/vben-vxe-table/table-data.ts b/docs/src/demos/vben-vxe-table/table-data.ts new file mode 100644 index 00000000000..d80ea5337a8 --- /dev/null +++ b/docs/src/demos/vben-vxe-table/table-data.ts @@ -0,0 +1,172 @@ +interface TableRowData { + address: string; + age: number; + id: number; + name: string; + nickname: string; + role: string; +} + +const roles = ['User', 'Admin', 'Manager', 'Guest']; + +export const MOCK_TABLE_DATA: TableRowData[] = (() => { + const data: TableRowData[] = []; + for (let i = 0; i < 10; i++) { + data.push({ + address: `New York${i}`, + age: i + 1, + id: i, + name: `Test${i}`, + nickname: `Test${i}`, + role: roles[Math.floor(Math.random() * roles.length)] as string, + }); + } + return data; +})(); + +export const MOCK_TREE_TABLE_DATA = [ + { + date: '2020-08-01', + id: 10_000, + name: 'Test1', + parentId: null, + size: 1024, + type: 'mp3', + }, + { + date: '2021-04-01', + id: 10_050, + name: 'Test2', + parentId: null, + size: 0, + type: 'mp4', + }, + { + date: '2020-03-01', + id: 24_300, + name: 'Test3', + parentId: 10_050, + size: 1024, + type: 'avi', + }, + { + date: '2021-04-01', + id: 20_045, + name: 'Test4', + parentId: 24_300, + size: 600, + type: 'html', + }, + { + date: '2021-04-01', + id: 10_053, + name: 'Test5', + parentId: 24_300, + size: 0, + type: 'avi', + }, + { + date: '2021-10-01', + id: 24_330, + name: 'Test6', + parentId: 10_053, + size: 25, + type: 'txt', + }, + { + date: '2020-01-01', + id: 21_011, + name: 'Test7', + parentId: 10_053, + size: 512, + type: 'pdf', + }, + { + date: '2021-06-01', + id: 22_200, + name: 'Test8', + parentId: 10_053, + size: 1024, + type: 'js', + }, + { + date: '2020-11-01', + id: 23_666, + name: 'Test9', + parentId: null, + size: 2048, + type: 'xlsx', + }, + { + date: '2021-06-01', + id: 23_677, + name: 'Test10', + parentId: 23_666, + size: 1024, + type: 'js', + }, + { + date: '2021-06-01', + id: 23_671, + name: 'Test11', + parentId: 23_677, + size: 1024, + type: 'js', + }, + { + date: '2021-06-01', + id: 23_672, + name: 'Test12', + parentId: 23_677, + size: 1024, + type: 'js', + }, + { + date: '2021-06-01', + id: 23_688, + name: 'Test13', + parentId: 23_666, + size: 1024, + type: 'js', + }, + { + date: '2021-06-01', + id: 23_681, + name: 'Test14', + parentId: 23_688, + size: 1024, + type: 'js', + }, + { + date: '2021-06-01', + id: 23_682, + name: 'Test15', + parentId: 23_688, + size: 1024, + type: 'js', + }, + { + date: '2020-10-01', + id: 24_555, + name: 'Test16', + parentId: null, + size: 224, + type: 'avi', + }, + { + date: '2021-06-01', + id: 24_566, + name: 'Test17', + parentId: 24_555, + size: 1024, + type: 'js', + }, + { + date: '2021-06-01', + id: 24_577, + name: 'Test18', + parentId: 24_555, + size: 1024, + type: 'js', + }, +]; diff --git a/docs/src/demos/vben-vxe-table/tree/index.vue b/docs/src/demos/vben-vxe-table/tree/index.vue new file mode 100644 index 00000000000..48e74703c2e --- /dev/null +++ b/docs/src/demos/vben-vxe-table/tree/index.vue @@ -0,0 +1,62 @@ + + + diff --git a/docs/src/demos/vben-vxe-table/virtual/index.vue b/docs/src/demos/vben-vxe-table/virtual/index.vue new file mode 100644 index 00000000000..f35a691b3df --- /dev/null +++ b/docs/src/demos/vben-vxe-table/virtual/index.vue @@ -0,0 +1,66 @@ + + + From 884d6d04aa34659100bf38ebd6378c7913300772 Mon Sep 17 00:00:00 2001 From: Arthur Darkstone Date: Mon, 4 Nov 2024 16:44:40 +0800 Subject: [PATCH 2/9] style: fix vxe-table index.scss import error --- docs/package.json | 6 +- docs/src/_env/adapter/theme.css | 91 +++++++++++++++++++ docs/src/_env/adapter/vxe-table.ts | 5 + .../components/common-ui/vben-vxe-table.md | 2 + docs/src/demos/vben-vxe-table/mock-api.ts | 8 ++ 5 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 docs/src/_env/adapter/theme.css create mode 100644 docs/src/demos/vben-vxe-table/mock-api.ts diff --git a/docs/package.json b/docs/package.json index 0585e667873..61bad10c072 100644 --- a/docs/package.json +++ b/docs/package.json @@ -14,17 +14,21 @@ "@vben-core/shadcn-ui": "workspace:*", "@vben/common-ui": "workspace:*", "@vben/locales": "workspace:*", + "@vben/plugins": "workspace:*", "@vben/styles": "workspace:*", "ant-design-vue": "catalog:", "lucide-vue-next": "catalog:", "medium-zoom": "catalog:", "radix-vue": "catalog:", - "vitepress-plugin-group-icons": "catalog:" + "vitepress-plugin-group-icons": "catalog:", + "vxe-pc-ui": "^4.2.38", + "vxe-table": "catalog:" }, "devDependencies": { "@nolebase/vitepress-plugin-git-changelog": "catalog:", "@vben/vite-config": "workspace:*", "@vite-pwa/vitepress": "catalog:", + "sass": "^1.80.6", "vitepress": "catalog:", "vue": "catalog:" } diff --git a/docs/src/_env/adapter/theme.css b/docs/src/_env/adapter/theme.css new file mode 100644 index 00000000000..a6e8ca1d3df --- /dev/null +++ b/docs/src/_env/adapter/theme.css @@ -0,0 +1,91 @@ +:root { + --vxe-ui-font-color: hsl(var(--foreground)); + --vxe-ui-font-primary-color: hsl(var(--primary)); + + /* --vxe-ui-font-lighten-color: #babdc0; + --vxe-ui-font-darken-color: #86898e; */ + --vxe-ui-font-disabled-color: hsl(var(--foreground) / 50%); + + /* base */ + --vxe-ui-base-popup-border-color: hsl(var(--border)); + --vxe-ui-input-disabled-color: hsl(var(--border) / 60%); + + /* --vxe-ui-base-popup-box-shadow: 0px 12px 30px 8px rgb(0 0 0 / 50%); */ + + /* layout */ + --vxe-ui-layout-background-color: hsl(var(--background)); + --vxe-ui-table-resizable-line-color: hsl(var(--border)); + + /* --vxe-ui-table-fixed-left-scrolling-box-shadow: 8px 0px 10px -5px hsl(var(--accent)); + --vxe-ui-table-fixed-right-scrolling-box-shadow: -8px 0px 10px -5px hsl(var(--accent)); */ + + /* input */ + --vxe-ui-input-border-color: hsl(var(--border)); + + /* --vxe-ui-input-placeholder-color: #8d9095; */ + + /* --vxe-ui-input-disabled-background-color: #262727; */ + + /* loading */ + --vxe-ui-loading-background-color: hsl(var(--overlay-content)); + + /* table */ + --vxe-ui-table-header-background-color: hsl(var(--accent)); + --vxe-ui-table-border-color: hsl(var(--border)); + --vxe-ui-table-row-hover-background-color: hsl(var(--accent-hover)); + --vxe-ui-table-row-striped-background-color: hsl(var(--accent) / 60%); + --vxe-ui-table-row-hover-striped-background-color: hsl(var(--accent)); + --vxe-ui-table-row-radio-checked-background-color: hsl(var(--accent)); + --vxe-ui-table-row-hover-radio-checked-background-color: hsl( + var(--accent-hover) + ); + --vxe-ui-table-row-checkbox-checked-background-color: hsl(var(--accent)); + --vxe-ui-table-row-hover-checkbox-checked-background-color: hsl( + var(--accent-hover) + ); + --vxe-ui-table-row-current-background-color: hsl(var(--accent)); + --vxe-ui-table-row-hover-current-background-color: hsl(var(--accent-hover)); + + /* --vxe-ui-table-fixed-scrolling-box-shadow-color: rgb(0 0 0 / 80%); */ +} + +.vxe-pager { + .vxe-pager--prev-btn:not(.is--disabled):active, + .vxe-pager--next-btn:not(.is--disabled):active, + .vxe-pager--num-btn:not(.is--disabled):active, + .vxe-pager--jump-prev:not(.is--disabled):active, + .vxe-pager--jump-next:not(.is--disabled):active, + .vxe-pager--prev-btn:not(.is--disabled):focus, + .vxe-pager--next-btn:not(.is--disabled):focus, + .vxe-pager--num-btn:not(.is--disabled):focus, + .vxe-pager--jump-prev:not(.is--disabled):focus, + .vxe-pager--jump-next:not(.is--disabled):focus { + color: hsl(var(--accent-foreground)); + background-color: hsl(var(--accent)); + border: 1px solid hsl(var(--border)); + box-shadow: 0 0 0 1px hsl(var(--border)); + } + + .vxe-pager { + &--wrapper { + display: flex; + align-items: center; + } + + &--sizes { + margin-right: auto; + } + } +} + +.vxe-pager--wrapper { + @apply justify-center md:justify-end; +} + +.vxe-tools--operate { + @apply ml-3; +} + +.vxe-table-custom--checkbox-option:hover { + background: none !important; +} diff --git a/docs/src/_env/adapter/vxe-table.ts b/docs/src/_env/adapter/vxe-table.ts index e47f893833a..c0b9dfee47a 100644 --- a/docs/src/_env/adapter/vxe-table.ts +++ b/docs/src/_env/adapter/vxe-table.ts @@ -6,6 +6,11 @@ import { Button, Image } from 'ant-design-vue'; import { useVbenForm } from './form'; +import 'vxe-table/styles/index.scss'; +// import 'vxe-table/styles/cssvar.scss'; +// import 'vxe-pc-ui/styles/cssvar.scss'; +// import './theme.css'; + setupVbenVxeTable({ configVxeTable: (vxeUI) => { vxeUI.setConfig({ diff --git a/docs/src/components/common-ui/vben-vxe-table.md b/docs/src/components/common-ui/vben-vxe-table.md index c5567578012..54ef3d9c7c0 100644 --- a/docs/src/components/common-ui/vben-vxe-table.md +++ b/docs/src/components/common-ui/vben-vxe-table.md @@ -9,3 +9,5 @@ outline: deep 其中,表头的 **表单搜索** 部分采用了`Vben Form表单`,表格主体部分使用了`vxe-grid`组件,支持表格的分页、排序、筛选等功能。 + + diff --git a/docs/src/demos/vben-vxe-table/mock-api.ts b/docs/src/demos/vben-vxe-table/mock-api.ts new file mode 100644 index 00000000000..08e3bffb484 --- /dev/null +++ b/docs/src/demos/vben-vxe-table/mock-api.ts @@ -0,0 +1,8 @@ +import { MOCK_TABLE_DATA } from './table-data'; + +export const getTableList = () => + new Promise((resolve) => { + setTimeout(() => { + resolve(MOCK_TABLE_DATA); + }, 600); + }); From 2eb9b079fdf1ef4622381eb3aa1c5db114a2f78a Mon Sep 17 00:00:00 2001 From: Arthur Darkstone Date: Mon, 4 Nov 2024 19:31:01 +0800 Subject: [PATCH 3/9] docs: fix vxe-table style & theme toggle problem --- .../theme/components/site-layout.vue | 6 + docs/package.json | 4 +- docs/src/_env/adapter/theme.css | 91 ---- docs/src/_env/adapter/vxe-table.ts | 16 +- .../components/common-ui/vben-vxe-table.md | 4 + docs/src/demos/vben-vxe-table/basic/index.vue | 5 +- .../vben-vxe-table/custom-cell/index.vue | 11 +- docs/src/demos/vben-vxe-table/mock-api.ts | 29 +- .../src/demos/vben-vxe-table/remote/index.vue | 11 +- docs/src/demos/vben-vxe-table/table-data.ts | 424 +++++++++++++++++- .../effects/plugins/src/vxe-table/index.ts | 4 + pnpm-lock.yaml | 125 ++++-- 12 files changed, 572 insertions(+), 158 deletions(-) delete mode 100644 docs/src/_env/adapter/theme.css diff --git a/docs/.vitepress/theme/components/site-layout.vue b/docs/.vitepress/theme/components/site-layout.vue index d643cae98a7..f50ed3d973c 100644 --- a/docs/.vitepress/theme/components/site-layout.vue +++ b/docs/.vitepress/theme/components/site-layout.vue @@ -11,6 +11,8 @@ import { // import { useAntdDesignTokens } from '@vben/hooks'; // import { initPreferences } from '@vben/preferences'; +import { setTheme } from '@vben/plugins/vxe-table'; + import { ConfigProvider, theme } from 'ant-design-vue'; import mediumZoom from 'medium-zoom'; import { useRoute } from 'vitepress'; @@ -32,6 +34,10 @@ watch( () => nextTick(() => initZoom()), ); +watch(isDark, (dark) => { + setTheme(dark ? 'dark' : 'light'); +}); + // initPreferences({ // namespace: 'docs', // }); diff --git a/docs/package.json b/docs/package.json index 61bad10c072..db10fe673b5 100644 --- a/docs/package.json +++ b/docs/package.json @@ -20,9 +20,7 @@ "lucide-vue-next": "catalog:", "medium-zoom": "catalog:", "radix-vue": "catalog:", - "vitepress-plugin-group-icons": "catalog:", - "vxe-pc-ui": "^4.2.38", - "vxe-table": "catalog:" + "vitepress-plugin-group-icons": "catalog:" }, "devDependencies": { "@nolebase/vitepress-plugin-git-changelog": "catalog:", diff --git a/docs/src/_env/adapter/theme.css b/docs/src/_env/adapter/theme.css deleted file mode 100644 index a6e8ca1d3df..00000000000 --- a/docs/src/_env/adapter/theme.css +++ /dev/null @@ -1,91 +0,0 @@ -:root { - --vxe-ui-font-color: hsl(var(--foreground)); - --vxe-ui-font-primary-color: hsl(var(--primary)); - - /* --vxe-ui-font-lighten-color: #babdc0; - --vxe-ui-font-darken-color: #86898e; */ - --vxe-ui-font-disabled-color: hsl(var(--foreground) / 50%); - - /* base */ - --vxe-ui-base-popup-border-color: hsl(var(--border)); - --vxe-ui-input-disabled-color: hsl(var(--border) / 60%); - - /* --vxe-ui-base-popup-box-shadow: 0px 12px 30px 8px rgb(0 0 0 / 50%); */ - - /* layout */ - --vxe-ui-layout-background-color: hsl(var(--background)); - --vxe-ui-table-resizable-line-color: hsl(var(--border)); - - /* --vxe-ui-table-fixed-left-scrolling-box-shadow: 8px 0px 10px -5px hsl(var(--accent)); - --vxe-ui-table-fixed-right-scrolling-box-shadow: -8px 0px 10px -5px hsl(var(--accent)); */ - - /* input */ - --vxe-ui-input-border-color: hsl(var(--border)); - - /* --vxe-ui-input-placeholder-color: #8d9095; */ - - /* --vxe-ui-input-disabled-background-color: #262727; */ - - /* loading */ - --vxe-ui-loading-background-color: hsl(var(--overlay-content)); - - /* table */ - --vxe-ui-table-header-background-color: hsl(var(--accent)); - --vxe-ui-table-border-color: hsl(var(--border)); - --vxe-ui-table-row-hover-background-color: hsl(var(--accent-hover)); - --vxe-ui-table-row-striped-background-color: hsl(var(--accent) / 60%); - --vxe-ui-table-row-hover-striped-background-color: hsl(var(--accent)); - --vxe-ui-table-row-radio-checked-background-color: hsl(var(--accent)); - --vxe-ui-table-row-hover-radio-checked-background-color: hsl( - var(--accent-hover) - ); - --vxe-ui-table-row-checkbox-checked-background-color: hsl(var(--accent)); - --vxe-ui-table-row-hover-checkbox-checked-background-color: hsl( - var(--accent-hover) - ); - --vxe-ui-table-row-current-background-color: hsl(var(--accent)); - --vxe-ui-table-row-hover-current-background-color: hsl(var(--accent-hover)); - - /* --vxe-ui-table-fixed-scrolling-box-shadow-color: rgb(0 0 0 / 80%); */ -} - -.vxe-pager { - .vxe-pager--prev-btn:not(.is--disabled):active, - .vxe-pager--next-btn:not(.is--disabled):active, - .vxe-pager--num-btn:not(.is--disabled):active, - .vxe-pager--jump-prev:not(.is--disabled):active, - .vxe-pager--jump-next:not(.is--disabled):active, - .vxe-pager--prev-btn:not(.is--disabled):focus, - .vxe-pager--next-btn:not(.is--disabled):focus, - .vxe-pager--num-btn:not(.is--disabled):focus, - .vxe-pager--jump-prev:not(.is--disabled):focus, - .vxe-pager--jump-next:not(.is--disabled):focus { - color: hsl(var(--accent-foreground)); - background-color: hsl(var(--accent)); - border: 1px solid hsl(var(--border)); - box-shadow: 0 0 0 1px hsl(var(--border)); - } - - .vxe-pager { - &--wrapper { - display: flex; - align-items: center; - } - - &--sizes { - margin-right: auto; - } - } -} - -.vxe-pager--wrapper { - @apply justify-center md:justify-end; -} - -.vxe-tools--operate { - @apply ml-3; -} - -.vxe-table-custom--checkbox-option:hover { - background: none !important; -} diff --git a/docs/src/_env/adapter/vxe-table.ts b/docs/src/_env/adapter/vxe-table.ts index c0b9dfee47a..87fc65e29ae 100644 --- a/docs/src/_env/adapter/vxe-table.ts +++ b/docs/src/_env/adapter/vxe-table.ts @@ -2,15 +2,10 @@ import { h } from 'vue'; import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table'; -import { Button, Image } from 'ant-design-vue'; +import { Button } from 'ant-design-vue'; import { useVbenForm } from './form'; -import 'vxe-table/styles/index.scss'; -// import 'vxe-table/styles/cssvar.scss'; -// import 'vxe-pc-ui/styles/cssvar.scss'; -// import './theme.css'; - setupVbenVxeTable({ configVxeTable: (vxeUI) => { vxeUI.setConfig({ @@ -37,11 +32,18 @@ setupVbenVxeTable({ }, }); + // const { theme } = useData(); + + // watch(theme.value, (t: string) => { + // console.log(t); + // // vxeUI.setTheme(t === 'dark' ? 'dark' : 'light'); + // }); + // 表格配置项可以用 cellRender: { name: 'CellImage' }, vxeUI.renderer.add('CellImage', { renderDefault(_renderOpts, params) { const { column, row } = params; - return h(Image, { src: row[column.field] }); + return h(Image, { src: row[column.field] } as any); }, }); diff --git a/docs/src/components/common-ui/vben-vxe-table.md b/docs/src/components/common-ui/vben-vxe-table.md index 54ef3d9c7c0..9146de394de 100644 --- a/docs/src/components/common-ui/vben-vxe-table.md +++ b/docs/src/components/common-ui/vben-vxe-table.md @@ -10,4 +10,8 @@ outline: deep + + + + diff --git a/docs/src/demos/vben-vxe-table/basic/index.vue b/docs/src/demos/vben-vxe-table/basic/index.vue index b446114fa70..963be8cfb17 100644 --- a/docs/src/demos/vben-vxe-table/basic/index.vue +++ b/docs/src/demos/vben-vxe-table/basic/index.vue @@ -66,11 +66,8 @@ function changeLoading() {