Skip to content

Commit

Permalink
fix(layout): fix layout scale error
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Jan 4, 2021
1 parent 7a07b70 commit da76f3c
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 21 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

- 修复表格列配置已知问题
- 恢复 table 的`isTreeTable`属性
- 修复表格内存溢出问题
- 修复`layout` 收缩展开功能在分割模式下失效

## 2.0.0-rc.15 (2020-12-31)

Expand Down
5 changes: 3 additions & 2 deletions src/components/Basic/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
import BasicArrow from './src/BasicArrow.vue';
import BasicTitle from './src/BasicTitle.vue';

export { BasicArrow };
export { BasicArrow, BasicTitle };

// export const BasicArrow = createAsyncComponent(() => import('./src/BasicArrow.vue'));
export const BasicHelp = createAsyncComponent(() => import('./src/BasicHelp.vue'));
export const BasicTitle = createAsyncComponent(() => import('./src/BasicTitle.vue'));
// export const BasicTitle = createAsyncComponent(() => import('./src/BasicTitle.vue'));
7 changes: 5 additions & 2 deletions src/components/Description/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
export const Description = createAsyncComponent(() => import('./src/index'));
// import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
// export const Description = createAsyncComponent(() => import('./src/index'));

import Description from './src/index';

export { Description };
export * from './src/types';
export { useDescription } from './src/useDescription';
6 changes: 5 additions & 1 deletion src/components/Menu/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';

export const BasicMenu = createAsyncComponent(() => import('./src/BasicMenu.vue'));
import BasicMenu from './src/BasicMenu.vue';

// export const BasicMenu = createAsyncComponent(() => import('./src/BasicMenu.vue'));

export const MenuTag = createAsyncComponent(() => import('./src/components/MenuItemTag.vue'));

export { BasicMenu };
3 changes: 1 addition & 2 deletions src/components/Menu/src/useOpenKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export function useOpenKeys(
return;
}
const native = unref(getIsMixSidebar) && unref(getMixSideFixed);

useTimeoutFn(
() => {
const menuList = toRaw(menus.value);
Expand All @@ -37,7 +36,7 @@ export function useOpenKeys(
}
},
16,
native
!native
);
}

Expand Down
6 changes: 6 additions & 0 deletions src/components/Table/src/components/editable/EditableCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,16 @@
});
watchEffect(() => {
console.log('======================');
console.log(1);
console.log('======================');
defaultValueRef.value = props.value;
});
watchEffect(() => {
console.log('======================');
console.log(2);
console.log('======================');
const { editable } = props.column;
if (isBoolean(editable) || isBoolean(unref(getRowEditable))) {
isEdit.value = !!editable || unref(getRowEditable);
Expand Down
21 changes: 16 additions & 5 deletions src/components/Table/src/hooks/useDataSource.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { BasicTableProps, FetchParams, SorterResult } from '../types/table';
import type { PaginationProps } from '../types/pagination';

import { ref, unref, ComputedRef, computed, onMounted, watchEffect, reactive } from 'vue';
import { ref, unref, ComputedRef, computed, onMounted, watch, reactive } from 'vue';

import { useTimeoutFn } from '/@/hooks/core/useTimeout';

Expand Down Expand Up @@ -40,10 +40,21 @@ export function useDataSource(
});
const dataSourceRef = ref<Recordable[]>([]);

watchEffect(() => {
const { dataSource, api } = unref(propsRef);
!api && dataSource && (dataSourceRef.value = dataSource);
});
// watchEffect(() => {
// const { dataSource, api } = unref(propsRef);
// !api && dataSource && (dataSourceRef.value = dataSource);
// });

watch(
() => unref(propsRef).dataSource,
() => {
const { dataSource, api } = unref(propsRef);
!api && dataSource && (dataSourceRef.value = dataSource);
},
{
immediate: true,
}
);

function handleTableChange(
pagination: PaginationProps,
Expand Down
11 changes: 7 additions & 4 deletions src/components/Table/src/hooks/useLoading.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { ref, ComputedRef, unref, computed, watchEffect } from 'vue';
import { ref, ComputedRef, unref, computed, watch } from 'vue';
import type { BasicTableProps } from '../types/table';

export function useLoading(props: ComputedRef<BasicTableProps>) {
const loadingRef = ref(unref(props).loading);

watchEffect(() => {
loadingRef.value = unref(props).loading;
});
watch(
() => unref(props).loading,
(loading) => {
loadingRef.value = loading;
}
);

const getLoading = computed(() => {
return unref(loadingRef);
Expand Down
14 changes: 10 additions & 4 deletions src/components/Table/src/hooks/useTableScroll.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { BasicTableProps, TableRowSelection } from '../types/table';
import type { Ref, ComputedRef } from 'vue';
import { computed, unref, ref, nextTick, watchEffect } from 'vue';
import { computed, unref, ref, nextTick, watch } from 'vue';

import { getViewportOffset } from '/@/utils/domUtils';
import { isBoolean } from '/@/utils/is';
Expand Down Expand Up @@ -28,9 +28,15 @@ export function useTableScroll(
return canResize && !(scroll || {}).y;
});

watchEffect(() => {
unref(getCanResize) && debounceRedoHeight();
});
watch(
() => unref(getCanResize),
() => {
debounceRedoHeight();
},
{
immediate: true,
}
);

function redoHeight() {
if (unref(getCanResize)) {
Expand Down
3 changes: 2 additions & 1 deletion src/layouts/default/header/MultipleHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
getShowInsetHeaderRef,
getShowFullHeaderRef,
getHeaderTheme,
getShowHeader,
} = useHeaderSetting();
const { getFullContent } = useFullContent();
Expand Down Expand Up @@ -68,7 +69,7 @@
const getPlaceholderDomStyle = computed(
(): CSSProperties => {
let height = 0;
if (unref(getShowFullHeaderRef) || !unref(getSplit)) {
if ((unref(getShowFullHeaderRef) || !unref(getSplit)) && unref(getShowHeader)) {
height += HEADER_HEIGHT;
}
if (unref(getShowMultipleTab)) {
Expand Down
1 change: 1 addition & 0 deletions src/layouts/default/tabs/useTabDropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export function useTabDropdown(tabContentProps: TabContentProps) {
const isScale = !unref(getShowMenu) && !unref(getShowHeader);
setMenuSetting({
show: isScale,
hidden: !isScale,
});
setHeaderSetting({
show: isScale,
Expand Down

0 comments on commit da76f3c

Please sign in to comment.