@v-c/menu 0.0.1
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/LICENSE +21 -0
- package/dist/Divider.cjs +38 -0
- package/dist/Divider.d.ts +4 -0
- package/dist/Divider.js +38 -0
- package/dist/Icon.cjs +38 -0
- package/dist/Icon.d.ts +7 -0
- package/dist/Icon.js +38 -0
- package/dist/Menu.cjs +580 -0
- package/dist/Menu.d.ts +77 -0
- package/dist/Menu.js +580 -0
- package/dist/MenuItem.cjs +350 -0
- package/dist/MenuItem.d.ts +14 -0
- package/dist/MenuItem.js +350 -0
- package/dist/MenuItemGroup.cjs +120 -0
- package/dist/MenuItemGroup.d.ts +16 -0
- package/dist/MenuItemGroup.js +120 -0
- package/dist/SubMenu/InlineSubMenuList.cjs +84 -0
- package/dist/SubMenu/InlineSubMenuList.d.ts +7 -0
- package/dist/SubMenu/InlineSubMenuList.js +84 -0
- package/dist/SubMenu/PopupTrigger.cjs +168 -0
- package/dist/SubMenu/PopupTrigger.d.ts +16 -0
- package/dist/SubMenu/PopupTrigger.js +168 -0
- package/dist/SubMenu/SubMenuList.cjs +28 -0
- package/dist/SubMenu/SubMenuList.d.ts +2 -0
- package/dist/SubMenu/SubMenuList.js +28 -0
- package/dist/SubMenu/index.cjs +532 -0
- package/dist/SubMenu/index.d.ts +18 -0
- package/dist/SubMenu/index.js +532 -0
- package/dist/context/IdContext.cjs +33 -0
- package/dist/context/IdContext.d.ts +12 -0
- package/dist/context/IdContext.js +33 -0
- package/dist/context/MenuContext.cjs +184 -0
- package/dist/context/MenuContext.d.ts +42 -0
- package/dist/context/MenuContext.js +184 -0
- package/dist/context/PathContext.cjs +100 -0
- package/dist/context/PathContext.d.ts +33 -0
- package/dist/context/PathContext.js +100 -0
- package/dist/context/PrivateContext.cjs +24 -0
- package/dist/context/PrivateContext.d.ts +8 -0
- package/dist/context/PrivateContext.js +24 -0
- package/dist/hooks/useAccessibility.cjs +210 -0
- package/dist/hooks/useAccessibility.d.ts +12 -0
- package/dist/hooks/useAccessibility.js +210 -0
- package/dist/hooks/useActive.cjs +31 -0
- package/dist/hooks/useActive.d.ts +9 -0
- package/dist/hooks/useActive.js +31 -0
- package/dist/hooks/useDirectionStyle.cjs +20 -0
- package/dist/hooks/useDirectionStyle.d.ts +2 -0
- package/dist/hooks/useDirectionStyle.js +20 -0
- package/dist/hooks/useKeyRecords.cjs +93 -0
- package/dist/hooks/useKeyRecords.d.ts +10 -0
- package/dist/hooks/useKeyRecords.js +93 -0
- package/dist/hooks/useMemoCallback.cjs +12 -0
- package/dist/hooks/useMemoCallback.d.ts +4 -0
- package/dist/hooks/useMemoCallback.js +12 -0
- package/dist/index.cjs +21 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +21 -0
- package/dist/interface.cjs +1 -0
- package/dist/interface.d.ts +94 -0
- package/dist/interface.js +1 -0
- package/dist/placements.cjs +77 -0
- package/dist/placements.d.ts +117 -0
- package/dist/placements.js +77 -0
- package/dist/utils/commonUtil.cjs +29 -0
- package/dist/utils/commonUtil.d.ts +1 -0
- package/dist/utils/commonUtil.js +29 -0
- package/dist/utils/motionUtil.cjs +12 -0
- package/dist/utils/motionUtil.d.ts +2 -0
- package/dist/utils/motionUtil.js +12 -0
- package/dist/utils/nodeUtil.cjs +82 -0
- package/dist/utils/nodeUtil.d.ts +3 -0
- package/dist/utils/nodeUtil.js +82 -0
- package/dist/utils/timeUtil.cjs +6 -0
- package/dist/utils/timeUtil.d.ts +1 -0
- package/dist/utils/timeUtil.js +6 -0
- package/dist/utils/warnUtil.cjs +16 -0
- package/dist/utils/warnUtil.d.ts +7 -0
- package/dist/utils/warnUtil.js +16 -0
- package/package.json +37 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ref, shallowRef, onBeforeUnmount } from "vue";
|
|
2
|
+
import { nextSlice } from "../utils/timeUtil.js";
|
|
3
|
+
const PATH_SPLIT = "__VC_UTIL_PATH_SPLIT__";
|
|
4
|
+
const getPathStr = (keyPath) => keyPath.join(PATH_SPLIT);
|
|
5
|
+
const getPathKeys = (keyPathStr) => keyPathStr.split(PATH_SPLIT);
|
|
6
|
+
const OVERFLOW_KEY = "vc-menu-more";
|
|
7
|
+
function useKeyRecords() {
|
|
8
|
+
const forceUpdateCount = ref(0);
|
|
9
|
+
const key2pathRef = shallowRef(/* @__PURE__ */ new Map());
|
|
10
|
+
const path2keyRef = shallowRef(/* @__PURE__ */ new Map());
|
|
11
|
+
const overflowKeys = ref([]);
|
|
12
|
+
const updateRef = ref(0);
|
|
13
|
+
const destroyRef = ref(false);
|
|
14
|
+
const forceUpdate = () => {
|
|
15
|
+
if (!destroyRef.value) {
|
|
16
|
+
forceUpdateCount.value += 1;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const registerPath = (key, keyPath) => {
|
|
20
|
+
if (process.env.NODE_ENV !== "production") {
|
|
21
|
+
if (key2pathRef.value.has(key)) {
|
|
22
|
+
console.warn(
|
|
23
|
+
`Duplicated key '${key}' used in Menu by path [${keyPath.join(" > ")}]`
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const connectedPath = getPathStr(keyPath);
|
|
28
|
+
path2keyRef.value.set(connectedPath, key);
|
|
29
|
+
key2pathRef.value.set(key, connectedPath);
|
|
30
|
+
updateRef.value += 1;
|
|
31
|
+
const id = updateRef.value;
|
|
32
|
+
nextSlice(() => {
|
|
33
|
+
if (id === updateRef.value) {
|
|
34
|
+
forceUpdate();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const unregisterPath = (key, keyPath) => {
|
|
39
|
+
const connectedPath = getPathStr(keyPath);
|
|
40
|
+
path2keyRef.value.delete(connectedPath);
|
|
41
|
+
key2pathRef.value.delete(key);
|
|
42
|
+
};
|
|
43
|
+
const refreshOverflowKeys = (keys) => {
|
|
44
|
+
overflowKeys.value = keys;
|
|
45
|
+
};
|
|
46
|
+
const getKeyPath = (eventKey, includeOverflow) => {
|
|
47
|
+
const fullPath = key2pathRef.value.get(eventKey) || "";
|
|
48
|
+
const keys = getPathKeys(fullPath);
|
|
49
|
+
if (includeOverflow && overflowKeys.value.includes(keys[0])) {
|
|
50
|
+
keys.unshift(OVERFLOW_KEY);
|
|
51
|
+
}
|
|
52
|
+
return keys;
|
|
53
|
+
};
|
|
54
|
+
const isSubPathKey = (pathKeys, eventKey) => pathKeys.filter((item) => item !== void 0).some((pathKey) => {
|
|
55
|
+
const pathKeyList = getKeyPath(pathKey, true);
|
|
56
|
+
return pathKeyList.includes(eventKey);
|
|
57
|
+
});
|
|
58
|
+
const getKeys = () => {
|
|
59
|
+
const keys = [...key2pathRef.value.keys()];
|
|
60
|
+
if (overflowKeys.value.length) {
|
|
61
|
+
keys.push(OVERFLOW_KEY);
|
|
62
|
+
}
|
|
63
|
+
return keys;
|
|
64
|
+
};
|
|
65
|
+
const getSubPathKeys = (key) => {
|
|
66
|
+
const connectedPath = `${key2pathRef.value.get(key)}${PATH_SPLIT}`;
|
|
67
|
+
const pathKeys = /* @__PURE__ */ new Set();
|
|
68
|
+
[...path2keyRef.value.keys()].forEach((pathKey) => {
|
|
69
|
+
if (pathKey.startsWith(connectedPath)) {
|
|
70
|
+
pathKeys.add(path2keyRef.value.get(pathKey));
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return pathKeys;
|
|
74
|
+
};
|
|
75
|
+
onBeforeUnmount(() => {
|
|
76
|
+
destroyRef.value = true;
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
// Register
|
|
80
|
+
registerPath,
|
|
81
|
+
unregisterPath,
|
|
82
|
+
refreshOverflowKeys,
|
|
83
|
+
// Util
|
|
84
|
+
isSubPathKey,
|
|
85
|
+
getKeyPath,
|
|
86
|
+
getKeys,
|
|
87
|
+
getSubPathKeys
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
OVERFLOW_KEY,
|
|
92
|
+
useKeyRecords as default
|
|
93
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
function useMemoCallback(callback) {
|
|
5
|
+
const fnRef = vue.ref(callback);
|
|
6
|
+
fnRef.value = callback;
|
|
7
|
+
const memoFn = ((...args) => {
|
|
8
|
+
return fnRef.value(...args);
|
|
9
|
+
});
|
|
10
|
+
return memoFn;
|
|
11
|
+
}
|
|
12
|
+
exports.default = useMemoCallback;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
function useMemoCallback(callback) {
|
|
3
|
+
const fnRef = ref(callback);
|
|
4
|
+
fnRef.value = callback;
|
|
5
|
+
const memoFn = ((...args) => {
|
|
6
|
+
return fnRef.value(...args);
|
|
7
|
+
});
|
|
8
|
+
return memoFn;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
useMemoCallback as default
|
|
12
|
+
};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const PathContext = require("./context/PathContext.cjs");
|
|
4
|
+
const Divider = require("./Divider.cjs");
|
|
5
|
+
const Menu = require("./Menu.cjs");
|
|
6
|
+
const MenuItem = require("./MenuItem.cjs");
|
|
7
|
+
const MenuItemGroup = require("./MenuItemGroup.cjs");
|
|
8
|
+
const index = require("./SubMenu/index.cjs");
|
|
9
|
+
const ExportMenu = Menu.default;
|
|
10
|
+
ExportMenu.Item = MenuItem.default;
|
|
11
|
+
ExportMenu.SubMenu = index.default;
|
|
12
|
+
ExportMenu.ItemGroup = MenuItemGroup.default;
|
|
13
|
+
ExportMenu.Divider = Divider.default;
|
|
14
|
+
exports.useFullPath = PathContext.useFullPath;
|
|
15
|
+
exports.Divider = Divider.default;
|
|
16
|
+
exports.Item = MenuItem.default;
|
|
17
|
+
exports.MenuItem = MenuItem.default;
|
|
18
|
+
exports.ItemGroup = MenuItemGroup.default;
|
|
19
|
+
exports.MenuItemGroup = MenuItemGroup.default;
|
|
20
|
+
exports.SubMenu = index.default;
|
|
21
|
+
exports.default = ExportMenu;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MenuRef } from './interface';
|
|
2
|
+
import { MenuProps, default as Menu } from './Menu';
|
|
3
|
+
import { MenuItemProps, default as MenuItem } from './MenuItem';
|
|
4
|
+
import { MenuItemGroupProps, default as MenuItemGroup } from './MenuItemGroup';
|
|
5
|
+
import { SubMenuProps, default as SubMenu } from './SubMenu';
|
|
6
|
+
import { useFullPath } from './context/PathContext';
|
|
7
|
+
import { default as Divider } from './Divider';
|
|
8
|
+
export { Divider, MenuItem as Item, MenuItemGroup as ItemGroup, MenuItem, MenuItemGroup, SubMenu,
|
|
9
|
+
/** @private Only used for antd internal. Do not use in your production. */
|
|
10
|
+
useFullPath, };
|
|
11
|
+
export type { MenuItemGroupProps, MenuItemProps, MenuProps, MenuRef, SubMenuProps, };
|
|
12
|
+
type MenuType = typeof Menu & {
|
|
13
|
+
Item: typeof MenuItem;
|
|
14
|
+
SubMenu: typeof SubMenu;
|
|
15
|
+
ItemGroup: typeof MenuItemGroup;
|
|
16
|
+
Divider: typeof Divider;
|
|
17
|
+
};
|
|
18
|
+
declare const ExportMenu: MenuType;
|
|
19
|
+
export default ExportMenu;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useFullPath } from "./context/PathContext.js";
|
|
2
|
+
import Divider from "./Divider.js";
|
|
3
|
+
import Menu from "./Menu.js";
|
|
4
|
+
import MenuItem from "./MenuItem.js";
|
|
5
|
+
import MenuItemGroup from "./MenuItemGroup.js";
|
|
6
|
+
import SubMenu from "./SubMenu/index.js";
|
|
7
|
+
const ExportMenu = Menu;
|
|
8
|
+
ExportMenu.Item = MenuItem;
|
|
9
|
+
ExportMenu.SubMenu = SubMenu;
|
|
10
|
+
ExportMenu.ItemGroup = MenuItemGroup;
|
|
11
|
+
ExportMenu.Divider = Divider;
|
|
12
|
+
export {
|
|
13
|
+
Divider,
|
|
14
|
+
MenuItem as Item,
|
|
15
|
+
MenuItemGroup as ItemGroup,
|
|
16
|
+
MenuItem,
|
|
17
|
+
MenuItemGroup,
|
|
18
|
+
SubMenu,
|
|
19
|
+
ExportMenu as default,
|
|
20
|
+
useFullPath
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Key, VueNode } from '@v-c/util/dist/type';
|
|
2
|
+
import { CSSProperties } from 'vue';
|
|
3
|
+
import { SubMenuProps } from './SubMenu';
|
|
4
|
+
interface ItemSharedProps {
|
|
5
|
+
style?: CSSProperties;
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SubMenuType extends ItemSharedProps {
|
|
9
|
+
type?: 'submenu';
|
|
10
|
+
label?: VueNode;
|
|
11
|
+
children: ItemType[];
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
key: string;
|
|
14
|
+
rootClassName?: string;
|
|
15
|
+
itemIcon?: RenderIconType;
|
|
16
|
+
expandIcon?: RenderIconType;
|
|
17
|
+
onMouseEnter?: MenuHoverEventHandler;
|
|
18
|
+
onMouseLeave?: MenuHoverEventHandler;
|
|
19
|
+
popupClassName?: string;
|
|
20
|
+
popupOffset?: number[];
|
|
21
|
+
popupStyle?: CSSProperties;
|
|
22
|
+
onClick?: MenuClickEventHandler;
|
|
23
|
+
onTitleClick?: (info: MenuTitleInfo) => void;
|
|
24
|
+
onTitleMouseEnter?: MenuHoverEventHandler;
|
|
25
|
+
onTitleMouseLeave?: MenuHoverEventHandler;
|
|
26
|
+
}
|
|
27
|
+
export interface MenuItemType extends ItemSharedProps {
|
|
28
|
+
type?: 'item';
|
|
29
|
+
label?: VueNode;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
itemIcon?: RenderIconType;
|
|
32
|
+
extra?: VueNode;
|
|
33
|
+
key: Key;
|
|
34
|
+
onMouseEnter?: MenuHoverEventHandler;
|
|
35
|
+
onMouseLeave?: MenuHoverEventHandler;
|
|
36
|
+
onClick?: MenuClickEventHandler;
|
|
37
|
+
}
|
|
38
|
+
export interface MenuItemGroupType extends ItemSharedProps {
|
|
39
|
+
type: 'group';
|
|
40
|
+
label?: VueNode;
|
|
41
|
+
children?: ItemType[];
|
|
42
|
+
}
|
|
43
|
+
export interface MenuDividerType extends ItemSharedProps {
|
|
44
|
+
type: 'divider';
|
|
45
|
+
}
|
|
46
|
+
export type ItemType = SubMenuType | MenuItemType | MenuItemGroupType | MenuDividerType | null;
|
|
47
|
+
export type MenuMode = 'horizontal' | 'vertical' | 'inline';
|
|
48
|
+
export type BuiltinPlacements = Record<string, any>;
|
|
49
|
+
export type TriggerSubMenuAction = 'click' | 'hover';
|
|
50
|
+
export interface RenderIconInfo {
|
|
51
|
+
isSelected?: boolean;
|
|
52
|
+
isOpen?: boolean;
|
|
53
|
+
isSubMenu?: boolean;
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export type RenderIconType = VueNode | ((props: RenderIconInfo) => VueNode) | boolean;
|
|
57
|
+
export interface MenuInfo {
|
|
58
|
+
key: string;
|
|
59
|
+
keyPath: string[];
|
|
60
|
+
/** @deprecated This will not support in future. You should avoid to use this */
|
|
61
|
+
item: VueNode;
|
|
62
|
+
domEvent: MouseEvent;
|
|
63
|
+
}
|
|
64
|
+
export interface MenuTitleInfo {
|
|
65
|
+
key: string;
|
|
66
|
+
domEvent: MouseEvent;
|
|
67
|
+
}
|
|
68
|
+
export type MenuHoverEventHandler = (info: {
|
|
69
|
+
key: string;
|
|
70
|
+
domEvent: MouseEvent;
|
|
71
|
+
}) => void;
|
|
72
|
+
export interface SelectInfo extends MenuInfo {
|
|
73
|
+
selectedKeys: string[];
|
|
74
|
+
}
|
|
75
|
+
export type SelectEventHandler = (info: SelectInfo) => void;
|
|
76
|
+
export type MenuClickEventHandler = (info: MenuInfo) => void;
|
|
77
|
+
export interface MenuRef {
|
|
78
|
+
/**
|
|
79
|
+
* Focus active child if any, or the first child which is not disabled will be focused.
|
|
80
|
+
* @param options
|
|
81
|
+
*/
|
|
82
|
+
focus: (options?: FocusOptions) => void;
|
|
83
|
+
list: HTMLUListElement;
|
|
84
|
+
findItem: (params: {
|
|
85
|
+
key: string;
|
|
86
|
+
}) => HTMLElement | null;
|
|
87
|
+
}
|
|
88
|
+
export type ComponentType = 'submenu' | 'item' | 'group' | 'divider';
|
|
89
|
+
export type Components = Partial<Record<ComponentType, any>>;
|
|
90
|
+
export type PopupRender = (node: any, info: {
|
|
91
|
+
item: SubMenuProps;
|
|
92
|
+
keys: string[];
|
|
93
|
+
}) => VueNode;
|
|
94
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const autoAdjustOverflow = {
|
|
4
|
+
adjustX: 1,
|
|
5
|
+
adjustY: 1
|
|
6
|
+
};
|
|
7
|
+
const placements = {
|
|
8
|
+
topLeft: {
|
|
9
|
+
points: ["bl", "tl"],
|
|
10
|
+
overflow: autoAdjustOverflow
|
|
11
|
+
},
|
|
12
|
+
topRight: {
|
|
13
|
+
points: ["br", "tr"],
|
|
14
|
+
overflow: autoAdjustOverflow
|
|
15
|
+
},
|
|
16
|
+
bottomLeft: {
|
|
17
|
+
points: ["tl", "bl"],
|
|
18
|
+
overflow: autoAdjustOverflow
|
|
19
|
+
},
|
|
20
|
+
bottomRight: {
|
|
21
|
+
points: ["tr", "br"],
|
|
22
|
+
overflow: autoAdjustOverflow
|
|
23
|
+
},
|
|
24
|
+
leftTop: {
|
|
25
|
+
points: ["tr", "tl"],
|
|
26
|
+
overflow: autoAdjustOverflow
|
|
27
|
+
},
|
|
28
|
+
leftBottom: {
|
|
29
|
+
points: ["br", "bl"],
|
|
30
|
+
overflow: autoAdjustOverflow
|
|
31
|
+
},
|
|
32
|
+
rightTop: {
|
|
33
|
+
points: ["tl", "tr"],
|
|
34
|
+
overflow: autoAdjustOverflow
|
|
35
|
+
},
|
|
36
|
+
rightBottom: {
|
|
37
|
+
points: ["bl", "br"],
|
|
38
|
+
overflow: autoAdjustOverflow
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const placementsRtl = {
|
|
42
|
+
topLeft: {
|
|
43
|
+
points: ["bl", "tl"],
|
|
44
|
+
overflow: autoAdjustOverflow
|
|
45
|
+
},
|
|
46
|
+
topRight: {
|
|
47
|
+
points: ["br", "tr"],
|
|
48
|
+
overflow: autoAdjustOverflow
|
|
49
|
+
},
|
|
50
|
+
bottomLeft: {
|
|
51
|
+
points: ["tl", "bl"],
|
|
52
|
+
overflow: autoAdjustOverflow
|
|
53
|
+
},
|
|
54
|
+
bottomRight: {
|
|
55
|
+
points: ["tr", "br"],
|
|
56
|
+
overflow: autoAdjustOverflow
|
|
57
|
+
},
|
|
58
|
+
rightTop: {
|
|
59
|
+
points: ["tr", "tl"],
|
|
60
|
+
overflow: autoAdjustOverflow
|
|
61
|
+
},
|
|
62
|
+
rightBottom: {
|
|
63
|
+
points: ["br", "bl"],
|
|
64
|
+
overflow: autoAdjustOverflow
|
|
65
|
+
},
|
|
66
|
+
leftTop: {
|
|
67
|
+
points: ["tl", "tr"],
|
|
68
|
+
overflow: autoAdjustOverflow
|
|
69
|
+
},
|
|
70
|
+
leftBottom: {
|
|
71
|
+
points: ["bl", "br"],
|
|
72
|
+
overflow: autoAdjustOverflow
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
exports.default = placements;
|
|
76
|
+
exports.placements = placements;
|
|
77
|
+
exports.placementsRtl = placementsRtl;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export declare const placements: {
|
|
2
|
+
topLeft: {
|
|
3
|
+
points: string[];
|
|
4
|
+
overflow: {
|
|
5
|
+
adjustX: number;
|
|
6
|
+
adjustY: number;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
topRight: {
|
|
10
|
+
points: string[];
|
|
11
|
+
overflow: {
|
|
12
|
+
adjustX: number;
|
|
13
|
+
adjustY: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
bottomLeft: {
|
|
17
|
+
points: string[];
|
|
18
|
+
overflow: {
|
|
19
|
+
adjustX: number;
|
|
20
|
+
adjustY: number;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
bottomRight: {
|
|
24
|
+
points: string[];
|
|
25
|
+
overflow: {
|
|
26
|
+
adjustX: number;
|
|
27
|
+
adjustY: number;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
leftTop: {
|
|
31
|
+
points: string[];
|
|
32
|
+
overflow: {
|
|
33
|
+
adjustX: number;
|
|
34
|
+
adjustY: number;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
leftBottom: {
|
|
38
|
+
points: string[];
|
|
39
|
+
overflow: {
|
|
40
|
+
adjustX: number;
|
|
41
|
+
adjustY: number;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
rightTop: {
|
|
45
|
+
points: string[];
|
|
46
|
+
overflow: {
|
|
47
|
+
adjustX: number;
|
|
48
|
+
adjustY: number;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
rightBottom: {
|
|
52
|
+
points: string[];
|
|
53
|
+
overflow: {
|
|
54
|
+
adjustX: number;
|
|
55
|
+
adjustY: number;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export declare const placementsRtl: {
|
|
60
|
+
topLeft: {
|
|
61
|
+
points: string[];
|
|
62
|
+
overflow: {
|
|
63
|
+
adjustX: number;
|
|
64
|
+
adjustY: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
topRight: {
|
|
68
|
+
points: string[];
|
|
69
|
+
overflow: {
|
|
70
|
+
adjustX: number;
|
|
71
|
+
adjustY: number;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
bottomLeft: {
|
|
75
|
+
points: string[];
|
|
76
|
+
overflow: {
|
|
77
|
+
adjustX: number;
|
|
78
|
+
adjustY: number;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
bottomRight: {
|
|
82
|
+
points: string[];
|
|
83
|
+
overflow: {
|
|
84
|
+
adjustX: number;
|
|
85
|
+
adjustY: number;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
rightTop: {
|
|
89
|
+
points: string[];
|
|
90
|
+
overflow: {
|
|
91
|
+
adjustX: number;
|
|
92
|
+
adjustY: number;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
rightBottom: {
|
|
96
|
+
points: string[];
|
|
97
|
+
overflow: {
|
|
98
|
+
adjustX: number;
|
|
99
|
+
adjustY: number;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
leftTop: {
|
|
103
|
+
points: string[];
|
|
104
|
+
overflow: {
|
|
105
|
+
adjustX: number;
|
|
106
|
+
adjustY: number;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
leftBottom: {
|
|
110
|
+
points: string[];
|
|
111
|
+
overflow: {
|
|
112
|
+
adjustX: number;
|
|
113
|
+
adjustY: number;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
export default placements;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const autoAdjustOverflow = {
|
|
2
|
+
adjustX: 1,
|
|
3
|
+
adjustY: 1
|
|
4
|
+
};
|
|
5
|
+
const placements = {
|
|
6
|
+
topLeft: {
|
|
7
|
+
points: ["bl", "tl"],
|
|
8
|
+
overflow: autoAdjustOverflow
|
|
9
|
+
},
|
|
10
|
+
topRight: {
|
|
11
|
+
points: ["br", "tr"],
|
|
12
|
+
overflow: autoAdjustOverflow
|
|
13
|
+
},
|
|
14
|
+
bottomLeft: {
|
|
15
|
+
points: ["tl", "bl"],
|
|
16
|
+
overflow: autoAdjustOverflow
|
|
17
|
+
},
|
|
18
|
+
bottomRight: {
|
|
19
|
+
points: ["tr", "br"],
|
|
20
|
+
overflow: autoAdjustOverflow
|
|
21
|
+
},
|
|
22
|
+
leftTop: {
|
|
23
|
+
points: ["tr", "tl"],
|
|
24
|
+
overflow: autoAdjustOverflow
|
|
25
|
+
},
|
|
26
|
+
leftBottom: {
|
|
27
|
+
points: ["br", "bl"],
|
|
28
|
+
overflow: autoAdjustOverflow
|
|
29
|
+
},
|
|
30
|
+
rightTop: {
|
|
31
|
+
points: ["tl", "tr"],
|
|
32
|
+
overflow: autoAdjustOverflow
|
|
33
|
+
},
|
|
34
|
+
rightBottom: {
|
|
35
|
+
points: ["bl", "br"],
|
|
36
|
+
overflow: autoAdjustOverflow
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const placementsRtl = {
|
|
40
|
+
topLeft: {
|
|
41
|
+
points: ["bl", "tl"],
|
|
42
|
+
overflow: autoAdjustOverflow
|
|
43
|
+
},
|
|
44
|
+
topRight: {
|
|
45
|
+
points: ["br", "tr"],
|
|
46
|
+
overflow: autoAdjustOverflow
|
|
47
|
+
},
|
|
48
|
+
bottomLeft: {
|
|
49
|
+
points: ["tl", "bl"],
|
|
50
|
+
overflow: autoAdjustOverflow
|
|
51
|
+
},
|
|
52
|
+
bottomRight: {
|
|
53
|
+
points: ["tr", "br"],
|
|
54
|
+
overflow: autoAdjustOverflow
|
|
55
|
+
},
|
|
56
|
+
rightTop: {
|
|
57
|
+
points: ["tr", "tl"],
|
|
58
|
+
overflow: autoAdjustOverflow
|
|
59
|
+
},
|
|
60
|
+
rightBottom: {
|
|
61
|
+
points: ["br", "bl"],
|
|
62
|
+
overflow: autoAdjustOverflow
|
|
63
|
+
},
|
|
64
|
+
leftTop: {
|
|
65
|
+
points: ["tl", "tr"],
|
|
66
|
+
overflow: autoAdjustOverflow
|
|
67
|
+
},
|
|
68
|
+
leftBottom: {
|
|
69
|
+
points: ["bl", "br"],
|
|
70
|
+
overflow: autoAdjustOverflow
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
export {
|
|
74
|
+
placements as default,
|
|
75
|
+
placements,
|
|
76
|
+
placementsRtl
|
|
77
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const toArray = require("@v-c/util/dist/Children/toArray");
|
|
4
|
+
const vue = require("vue");
|
|
5
|
+
function parseChildren(children, keyPath) {
|
|
6
|
+
return toArray.toArray(children).map((child, index) => {
|
|
7
|
+
if (vue.isVNode(child)) {
|
|
8
|
+
const key = child.key;
|
|
9
|
+
let eventKey = child.props?.eventKey ?? key;
|
|
10
|
+
const emptyKey = eventKey === null || eventKey === void 0;
|
|
11
|
+
if (emptyKey) {
|
|
12
|
+
eventKey = `tmp_key-${[...keyPath, index].join("-")}`;
|
|
13
|
+
}
|
|
14
|
+
const cloneProps = { key: eventKey, eventKey };
|
|
15
|
+
if (process.env.NODE_ENV !== "production" && emptyKey) {
|
|
16
|
+
cloneProps.warnKey = true;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
...child,
|
|
20
|
+
props: {
|
|
21
|
+
...child.props,
|
|
22
|
+
...cloneProps
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return child;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.parseChildren = parseChildren;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function parseChildren(children: any | undefined, keyPath: string[]): any[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { toArray } from "@v-c/util/dist/Children/toArray";
|
|
2
|
+
import { isVNode } from "vue";
|
|
3
|
+
function parseChildren(children, keyPath) {
|
|
4
|
+
return toArray(children).map((child, index) => {
|
|
5
|
+
if (isVNode(child)) {
|
|
6
|
+
const key = child.key;
|
|
7
|
+
let eventKey = child.props?.eventKey ?? key;
|
|
8
|
+
const emptyKey = eventKey === null || eventKey === void 0;
|
|
9
|
+
if (emptyKey) {
|
|
10
|
+
eventKey = `tmp_key-${[...keyPath, index].join("-")}`;
|
|
11
|
+
}
|
|
12
|
+
const cloneProps = { key: eventKey, eventKey };
|
|
13
|
+
if (process.env.NODE_ENV !== "production" && emptyKey) {
|
|
14
|
+
cloneProps.warnKey = true;
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
...child,
|
|
18
|
+
props: {
|
|
19
|
+
...child.props,
|
|
20
|
+
...cloneProps
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return child;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
parseChildren
|
|
29
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function getMotion(mode, motion, defaultMotions) {
|
|
4
|
+
if (motion) {
|
|
5
|
+
return motion;
|
|
6
|
+
}
|
|
7
|
+
if (defaultMotions) {
|
|
8
|
+
return defaultMotions?.[mode] || defaultMotions?.other;
|
|
9
|
+
}
|
|
10
|
+
return void 0;
|
|
11
|
+
}
|
|
12
|
+
exports.getMotion = getMotion;
|