Skip to content

Commit

Permalink
deploy: alpha.5
Browse files Browse the repository at this point in the history
  • Loading branch information
sendya committed Feb 2, 2021
1 parent bed5d17 commit 44bb228
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 31 deletions.
38 changes: 20 additions & 18 deletions src/BasicLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { computed, FunctionalComponent, CSSProperties, VNodeChild, VNode, ComputedRef } from 'vue';
import { computed, FunctionalComponent, CSSProperties, VNodeChild, VNode } from 'vue';
import 'ant-design-vue/es/layout/style';
import Layout from 'ant-design-vue/es/layout';
import { withInstall } from 'ant-design-vue/es/_util/type';
Expand All @@ -8,7 +8,6 @@ import { WrapContent } from './WrapContent';
import { default as Header, HeaderViewProps } from './Header';
import { RenderVNodeType, WithFalse } from './typings';
import { getComponentOrSlot, PropRenderType, PropTypes } from './utils';
import useMergedState from './hooks/useMergedState';
import './BasicLayout.less';

const defaultI18nRender = (key: string) => key;
Expand Down Expand Up @@ -50,27 +49,26 @@ export type BasicLayoutProps = SiderMenuWrapperProps &
disableContentMargin?: boolean;
};

const ProLayout: FunctionalComponent<BasicLayoutProps> = (props, { emit, slots, attrs }) => {
const ProLayout: FunctionalComponent<BasicLayoutProps> = (props, { emit, slots }) => {
const {
onCollapse: propsOnCollapse,
contentStyle,
disableContentMargin,
siderWidth = 208,
menu,
isChildrenLayout: propsIsChildrenLayout,
loading,
// loading,
layout,
matchMenuKeys,
navTheme,
menuData,
isMobile,
defaultCollapsed,
// defaultCollapsed,
} = props;
const isTop = computed(() => layout === 'top');
const isSide = computed(() => layout === 'side');
const isMix = computed(() => layout === 'mix');
// const isSide = computed(() => layout === 'side');
// const isMix = computed(() => layout === 'mix');

const handleCollapse = (collapsed: boolean) => {
propsOnCollapse && propsOnCollapse(collapsed);
emit('update:collapsed', collapsed);
};
const handleOpenKeys = (openKeys: string[] | false): void => {
Expand All @@ -92,10 +90,10 @@ const ProLayout: FunctionalComponent<BasicLayoutProps> = (props, { emit, slots,
};
});

const [collapsed, onCollapse] = useMergedState<boolean>(defaultCollapsed || false, {
value: props.collapsed,
onChange: propsOnCollapse,
});
// const [collapsed, onCollapse] = useMergedState<boolean>(defaultCollapsed || false, {
// value: props.collapsed,
// onChange: propsOnCollapse,
// });
const headerRender = (
props: BasicLayoutProps & {
hasSiderMenu: boolean;
Expand All @@ -119,8 +117,7 @@ const ProLayout: FunctionalComponent<BasicLayoutProps> = (props, { emit, slots,
hasSiderMenu: !isTop.value,
menuData,
isMobile,
collapsed,
onCollapse,
onCollapse: handleCollapse,
onSelect: handleSelect,
onOpenKeys: handleOpenKeys,
customHeaderRender,
Expand All @@ -133,7 +130,7 @@ const ProLayout: FunctionalComponent<BasicLayoutProps> = (props, { emit, slots,
);

const footerRender = getComponentOrSlot(props, slots, 'footerRender');
const menuRender = getComponentOrSlot(props, slots, 'menuRender');
// const menuRender = getComponentOrSlot(props, slots, 'menuRender');
// const menuHeaderRender = getComponentOrSlot(props, slots, 'menuHeaderRender');

return (
Expand All @@ -154,9 +151,14 @@ const ProLayout: FunctionalComponent<BasicLayoutProps> = (props, { emit, slots,
onOpenKeys={handleOpenKeys}
/>
)}
<Layout style={contentStyle}>
<Layout>
{headerDom}
<WrapContent style={props.contentStyle}>{slots.default?.()}</WrapContent>
<WrapContent
isChildrenLayout={propsIsChildrenLayout}
style={disableContentMargin ? null : contentStyle}
>
{slots.default?.()}
</WrapContent>
{footerRender !== false && footerRender && footerRender}
</Layout>
</Layout>
Expand Down
1 change: 0 additions & 1 deletion src/SiderMenu/SiderMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { useProProvider } from '../ProProvider';
import { useRouteContext } from '../RouteContext';
import { getMenuFirstChildren } from '../utils';
import './index.less';
import { emit } from 'process';

const { Sider } = Layout;

Expand Down
12 changes: 0 additions & 12 deletions src/hooks/useMergedState.ts

This file was deleted.

1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"moduleResolution": "node",
"jsx": "preserve",
"esModuleInterop": true,
"skipLibCheck": true,
"lib": [
"DOM",
"DOM.Iterable",
Expand Down

0 comments on commit 44bb228

Please sign in to comment.