Skip to content

Commit 1294220

Browse files
authored
chore(types): update Layout types (#2705)
1 parent 69509e9 commit 1294220

File tree

6 files changed

+65
-39
lines changed

6 files changed

+65
-39
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ es/
77
lib/
88
_site/
99
dist/
10+
types/

types/layout/layout-content.d.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
1+
import { CSSProperties } from 'vue';
12
// Project: https://github.com/vueComponent/ant-design-vue
23
// Definitions by: Pythonfo <https://github.com/Pythonfo>
34
// Copy from: akki-jat <https://github.com/akki-jat>
45
// Definitions: https://github.com/vueComponent/ant-design-vue/types
56

67
import { AntdComponent } from '../component';
78

8-
export default class LayoutContent extends AntdComponent {
9+
export interface LayoutContentProps {
910
/**
1011
* container className
1112
* @default undefined
1213
* @type string
1314
*/
14-
class: string;
15+
class?: string;
1516

1617
/**
1718
* to customize the styles
18-
* @type string | object
19+
* @type CSSProperties
1920
*/
20-
style: string | object;
21+
style?: CSSProperties;
2122

2223
/**
2324
* whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering
2425
* @type boolean
2526
*/
26-
hasSider: boolean;
27+
hasSider?: boolean;
28+
}
29+
30+
export default class LayoutContent extends AntdComponent {
31+
$props: LayoutContentProps;
2732
}

types/layout/layout-footer.d.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
1+
import { CSSProperties } from 'vue';
12
// Project: https://github.com/vueComponent/ant-design-vue
23
// Definitions by: Pythonfo <https://github.com/Pythonfo>
34
// Copy from: akki-jat <https://github.com/akki-jat>
45
// Definitions: https://github.com/vueComponent/ant-design-vue/types
56

67
import { AntdComponent } from '../component';
78

8-
export default class LayoutFooter extends AntdComponent {
9+
export interface LayoutFooterProps {
910
/**
1011
* container className
1112
* @default undefined
1213
* @type string
1314
*/
14-
class: string;
15+
class?: string;
1516

1617
/**
1718
* to customize the styles
18-
* @type string | object
19+
* @type CSSProperties
1920
*/
20-
style: string | object;
21+
style?: CSSProperties;
2122

2223
/**
2324
* whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering
2425
* @type boolean
2526
*/
26-
hasSider: boolean;
27+
hasSider?: boolean;
28+
}
29+
30+
export default class LayoutFooter extends AntdComponent {
31+
$props: LayoutFooterProps;
2732
}

types/layout/layout-header.d.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
1+
import { CSSProperties } from 'vue';
12
// Project: https://github.com/vueComponent/ant-design-vue
23
// Definitions by: Pythonfo <https://github.com/Pythonfo>
34
// Copy from: akki-jat <https://github.com/akki-jat>
45
// Definitions: https://github.com/vueComponent/ant-design-vue/types
56

67
import { AntdComponent } from '../component';
78

8-
export default class LayoutHeader extends AntdComponent {
9+
export interface LayoutHeaderProps {
910
/**
1011
* container className
1112
* @default undefined
1213
* @type string
1314
*/
14-
class: string;
15+
class?: string;
1516

1617
/**
1718
* to customize the styles
18-
* @type string | object
19+
* @type CSSProperties
1920
*/
20-
style: string | object;
21+
style?: CSSProperties;
2122

2223
/**
2324
* whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering
2425
* @type boolean
2526
*/
26-
hasSider: boolean;
27+
hasSider?: boolean;
28+
}
29+
30+
export default class LayoutHeader extends AntdComponent {
31+
$props: LayoutHeaderProps;
2732
}

types/layout/layout-sider.d.ts

+19-14
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,84 @@
1+
import { CSSProperties, Slot, VNodeChild } from 'vue';
12
// Project: https://github.com/vueComponent/ant-design-vue
23
// Definitions by: akki-jat <https://github.com/akki-jat>
34
// Definitions: https://github.com/vueComponent/ant-design-vue/types
45

56
import { AntdComponent } from '../component';
67

7-
export declare class LayoutSider extends AntdComponent {
8+
export interface LayoutSiderProps {
89
/**
910
* container className
1011
* @type string
1112
*/
12-
class: string;
13+
class?: string;
1314

1415
/**
1516
* whether can be collapsed
1617
* @default false
1718
* @type boolean
1819
*/
19-
collapsible: boolean;
20+
collapsible?: boolean;
2021

2122
/**
2223
* to set the current status
2324
* @type boolean
2425
*/
25-
collapsed: boolean;
26+
collapsed?: boolean;
2627

2728
/**
2829
* to set the initial status
2930
* @default false
3031
* @type boolean
3132
*/
32-
defaultCollapsed: boolean;
33+
defaultCollapsed?: boolean;
3334

3435
/**
3536
* reverse direction of arrow, for a sider that expands from the right
3637
* @default false
3738
* @type boolean
3839
*/
39-
reverseArrow: boolean;
40+
reverseArrow?: boolean;
4041

4142
/**
4243
* to customize the styles
43-
* @type object | string
44+
* @type CSSProperties
4445
*/
45-
style: object | string;
46+
style?: CSSProperties;
4647

4748
/**
4849
* specify the customized trigger, set to null to hide the trigger
49-
* @type string | slot
50+
* @type string | | VNodeChild | JSX.Element
5051
*/
51-
trigger: any;
52+
trigger?: string | VNodeChild | JSX.Element;
5253

5354
/**
5455
* width of the sidebar
5556
* @default 200
5657
* @type number | string
5758
*/
58-
width: number | string;
59+
width?: number | string;
5960

6061
/**
6162
* width of the collapsed sidebar, by setting to 0 a special trigger will appear
6263
* @default 80
6364
* @type number
6465
*/
65-
collapsedWidth: number;
66+
collapsedWidth?: number;
6667

6768
/**
6869
* breakpoints of the responsive layout
6970
* @type string
7071
*/
71-
breakpoint: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
72+
breakpoint?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
7273

7374
/**
7475
* color theme of the sidebar
7576
* @default 'dark'
7677
* @type string
7778
*/
78-
theme: 'light' | 'dark';
79+
theme?: 'light' | 'dark';
80+
}
81+
82+
export declare class LayoutSider extends AntdComponent {
83+
$props: LayoutSiderProps;
7984
}

types/layout/layout.d.ts

+15-10
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,34 @@ import { LayoutSider } from './layout-sider';
77
import LayoutHeader from './layout-header';
88
import LayoutContent from './layout-content';
99
import LayoutFooter from './layout-footer';
10+
import { CSSProperties } from 'vue';
1011

11-
export declare class Layout extends AntdComponent {
12-
static Header: typeof LayoutHeader;
13-
static Content: typeof LayoutContent;
14-
static Footer: typeof LayoutFooter;
15-
static Sider: typeof LayoutSider;
16-
12+
export interface LayoutProps {
1713
/**
1814
* container className
1915
* @default undefined
2016
* @type string
2117
*/
22-
class: string;
18+
class?: string;
2319

2420
/**
2521
* to customize the styles
26-
* @type string | object
22+
* @type CSSProperties
2723
*/
28-
style: string | object;
24+
style?: CSSProperties;
2925

3026
/**
3127
* whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering
3228
* @type boolean
3329
*/
34-
hasSider: boolean;
30+
hasSider?: boolean;
31+
}
32+
33+
export declare class Layout extends AntdComponent {
34+
static Header: typeof LayoutHeader;
35+
static Content: typeof LayoutContent;
36+
static Footer: typeof LayoutFooter;
37+
static Sider: typeof LayoutSider;
38+
39+
$props: LayoutProps;
3540
}

0 commit comments

Comments
 (0)