Commit 44bb2288 authored by Sendya's avatar Sendya

deploy: alpha.5

parent bed5d170
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';
......@@ -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;
......@@ -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 => {
......@@ -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;
......@@ -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,
......@@ -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 (
......@@ -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>
......
......@@ -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;
......
export default function useControlledState<T, R = T>(
defaultStateValue: T | (() => T),
option?: {
defaultValue?: T | (() => T);
value?: T;
onChange?: (value: T, prevValue: T) => void;
postState?: (value: T) => T;
},
): [R, (value: T) => void] {
const triggerChange = () => {};
return [null, triggerChange];
}
......@@ -7,6 +7,7 @@
"moduleResolution": "node",
"jsx": "preserve",
"esModuleInterop": true,
"skipLibCheck": true,
"lib": [
"DOM",
"DOM.Iterable",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment