Skip to content

Commit

Permalink
fix(VxeTable): update vxeTable ,fix imports and support theme change
Browse files Browse the repository at this point in the history
  • Loading branch information
jinmao88 committed Jun 24, 2024
1 parent e7868e7 commit cae5538
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
"vue-router": "^4.3.2",
"vue-types": "^5.1.1",
"vuedraggable": "^4.1.0",
"vxe-table": "^4.6.3",
"vxe-table-plugin-export-xlsx": "^4.0.1",
"vxe-table": "^4.7.31",
"vxe-table-plugin-export-xlsx": "^4.0.2",
"xe-utils": "^3.5.25",
"xlsx": "^0.18.5"
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/VxeTable/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { withInstall } from '@/utils';
import vxeBasicTable from './src/VxeBasicTable';
import { VXETable } from 'vxe-table';
import { VxeUI } from 'vxe-table';
import VXETablePluginAntd from './src/components';
import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx';
import ExcelJS from 'exceljs';
Expand All @@ -10,4 +10,4 @@ export const VxeBasicTable = withInstall(vxeBasicTable);
export * from 'vxe-table';
export * from './src/types';

VXETable.use(VXETablePluginAntd).use(VXETablePluginExportXLSX, { ExcelJS });
VxeUI.use(VXETablePluginAntd).use(VXETablePluginExportXLSX, { ExcelJS });
18 changes: 14 additions & 4 deletions src/components/VxeTable/src/VxeBasicTable.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import { defineComponent, computed, ref } from 'vue';
import { defineComponent, computed, ref, watch } from 'vue';
import { BasicTableProps } from './types';
import { basicProps } from './props';
import { ignorePropKeys } from './const';
import { basicEmits } from './emits';
import XEUtils from 'xe-utils';
import type {
import {
VxeGridInstance,
VxeGridEventProps,
GridMethods,
TableMethods,
TableEditMethods,
TableValidatorMethods,
VxeUI,
VxeGlobalThemeName,
VxeGrid,
} from 'vxe-table';
import { Grid as VxeGrid } from 'vxe-table';

import { extendSlots } from '@/utils/helper/tsxHelper';
import { gridComponentMethodKeys } from './methods';
import { omit } from 'lodash-es';
import { useRootSetting } from '@/hooks/setting/useRootSetting';

export default defineComponent({
name: 'VxeBasicTable',
Expand All @@ -25,7 +28,14 @@ export default defineComponent({
setup(props, { emit, attrs }) {
const tableElRef = ref<VxeGridInstance>();
const emitEvents: VxeGridEventProps = {};

const { getDarkMode } = useRootSetting();
watch(
() => getDarkMode.value,
() => {
VxeUI.setTheme(getDarkMode.value as VxeGlobalThemeName);
},
{ immediate: true },
);
const extendTableMethods = (methodKeys) => {
const funcs: any = {};
methodKeys.forEach((name) => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/VxeTable/src/setting.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VXETable } from '..';
import { VxeUI } from '..';
import componentSetting from '@/settings/componentSetting';

VXETable.setup(componentSetting.vxeTable);
VxeUI.setConfig(componentSetting.vxeTable);

1 comment on commit cae5538

@doraemonxxx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jinmao88 . this revision and e7868e7 will broke the vxe table form isn't it?

pls see: https://vben.vvbin.cn/#/system/vxeTableAccount

Please sign in to comment.