x-ui-design 0.7.68 → 0.7.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/types/components/Menu/Item/Item.d.ts +4 -0
- package/dist/esm/types/components/Menu/Menu.d.ts +26 -0
- package/dist/esm/types/components/Menu/SubMenu/SubMenu.d.ts +4 -0
- package/dist/esm/types/components/Menu/index.d.ts +1 -0
- package/dist/esm/types/types/menu.d.ts +59 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/lib/components/DatePicker/DatePicker.tsx +1 -1
- package/lib/components/Menu/Item/Item.tsx +50 -0
- package/lib/components/Menu/Menu.tsx +197 -0
- package/lib/components/Menu/SubMenu/SubMenu.tsx +68 -0
- package/lib/components/Menu/index.css +115 -0
- package/lib/components/Menu/index.ts +1 -0
- package/lib/types/menu.ts +52 -0
- package/package.json +1 -1
- package/src/app/page.tsx +127 -35
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { FC, ReactNode, MouseEvent } from "react";
|
|
2
|
+
import { MenuMode, MenuProps } from "../../types/menu";
|
|
3
|
+
import MenuItem from "./Item/Item";
|
|
4
|
+
import SubMenu from "./SubMenu/SubMenu";
|
|
5
|
+
import "./index.css";
|
|
6
|
+
export declare const MenuContext: React.Context<{
|
|
7
|
+
mode: MenuMode;
|
|
8
|
+
inlineIndent: number;
|
|
9
|
+
inlineCollapsed: boolean;
|
|
10
|
+
selectedKeys: string[];
|
|
11
|
+
openKeys: string[];
|
|
12
|
+
toggleOpen: (key: string) => void;
|
|
13
|
+
onItemClick: (key: string, domEvent?: MouseEvent) => void;
|
|
14
|
+
triggerSubMenuAction?: "hover" | "click";
|
|
15
|
+
prefixCls: string;
|
|
16
|
+
} | null>;
|
|
17
|
+
declare const ItemGroup: FC<{
|
|
18
|
+
title?: ReactNode;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}>;
|
|
21
|
+
declare const Menu: FC<MenuProps> & {
|
|
22
|
+
Item: typeof MenuItem;
|
|
23
|
+
SubMenu: typeof SubMenu;
|
|
24
|
+
ItemGroup: typeof ItemGroup;
|
|
25
|
+
};
|
|
26
|
+
export default Menu;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Menu } from './Menu';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CSSProperties, MouseEvent, ReactNode } from "react";
|
|
2
|
+
export type MenuMode = "vertical" | "horizontal" | "inline";
|
|
3
|
+
export type ItemType = {
|
|
4
|
+
danger?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
extra?: ReactNode;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
key: string;
|
|
9
|
+
label?: ReactNode;
|
|
10
|
+
title?: ReactNode;
|
|
11
|
+
children?: ItemType[];
|
|
12
|
+
type?: string;
|
|
13
|
+
selected?: boolean;
|
|
14
|
+
itemKey?: string;
|
|
15
|
+
};
|
|
16
|
+
export type SubMenuItem = {
|
|
17
|
+
key: string;
|
|
18
|
+
title?: ReactNode;
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
itemKey: string;
|
|
22
|
+
};
|
|
23
|
+
export interface MenuProps {
|
|
24
|
+
prefixCls?: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
style?: CSSProperties;
|
|
27
|
+
defaultOpenKeys?: string[];
|
|
28
|
+
defaultSelectedKeys?: string[];
|
|
29
|
+
expandIcon?: ReactNode;
|
|
30
|
+
forceSubMenuRender?: boolean;
|
|
31
|
+
inlineCollapsed?: boolean;
|
|
32
|
+
inlineIndent?: number;
|
|
33
|
+
items?: ItemType[];
|
|
34
|
+
mode?: MenuMode;
|
|
35
|
+
multiple?: boolean;
|
|
36
|
+
openKeys?: string[];
|
|
37
|
+
overflowedIndicator?: ReactNode;
|
|
38
|
+
selectable?: boolean;
|
|
39
|
+
selectedKeys?: string[];
|
|
40
|
+
subMenuCloseDelay?: number;
|
|
41
|
+
subMenuOpenDelay?: number;
|
|
42
|
+
triggerSubMenuAction?: "hover" | "click";
|
|
43
|
+
onClick?: (info: {
|
|
44
|
+
key: string;
|
|
45
|
+
keyPath: string[];
|
|
46
|
+
domEvent?: MouseEvent;
|
|
47
|
+
}) => void;
|
|
48
|
+
onDeselect?: (info: {
|
|
49
|
+
key: string;
|
|
50
|
+
keyPath: string[];
|
|
51
|
+
}) => void;
|
|
52
|
+
onOpenChange?: (openKeys: string[]) => void;
|
|
53
|
+
onSelect?: (info: {
|
|
54
|
+
key: string;
|
|
55
|
+
keyPath: string[];
|
|
56
|
+
selectedKeys: string[];
|
|
57
|
+
}) => void;
|
|
58
|
+
children?: ReactNode;
|
|
59
|
+
}
|
package/dist/index.esm.js
CHANGED
|
@@ -2128,7 +2128,7 @@ const DatePicker = ({
|
|
|
2128
2128
|
}
|
|
2129
2129
|
if (typeof format === 'string') {
|
|
2130
2130
|
date = new Date(date);
|
|
2131
|
-
return format.replace(/YYYY/, date.getFullYear().toString()).replace(/MMM/, monthNames[date.getMonth()
|
|
2131
|
+
return format.replace(/YYYY/, date.getFullYear().toString()).replace(/MMM/, monthNames[date.getMonth()]).replace(/MM/, (date.getMonth() + 1).toString().padStart(2, '0')).replace(/DD/, date.getDate().toString().padStart(2, '0'));
|
|
2132
2132
|
}
|
|
2133
2133
|
return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`;
|
|
2134
2134
|
}
|