@gx-design-vue/pro-layout-components 0.1.0-alpha.0
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/README.md +76 -0
- package/dist/AppsLogoComponents/AppLogoList.d.ts +24 -0
- package/dist/AppsLogoComponents/AppLogoList.js +43 -0
- package/dist/AppsLogoComponents/AppsLogo.d.ts +10 -0
- package/dist/AppsLogoComponents/AppsLogo.js +12 -0
- package/dist/AppsLogoComponents/DefaultContent.d.ts +27 -0
- package/dist/AppsLogoComponents/DefaultContent.js +43 -0
- package/dist/AppsLogoComponents/SimpleContent.d.ts +38 -0
- package/dist/AppsLogoComponents/SimpleContent.js +63 -0
- package/dist/AppsLogoComponents/index.d.ts +32 -0
- package/dist/AppsLogoComponents/index.js +71 -0
- package/dist/AppsLogoComponents/props.d.ts +26 -0
- package/dist/AppsLogoComponents/props.js +12 -0
- package/dist/AppsLogoComponents/style/default.d.ts +6 -0
- package/dist/AppsLogoComponents/style/default.js +70 -0
- package/dist/AppsLogoComponents/style/index.d.ts +7 -0
- package/dist/AppsLogoComponents/style/index.js +60 -0
- package/dist/AppsLogoComponents/style/simple.d.ts +6 -0
- package/dist/AppsLogoComponents/style/simple.js +83 -0
- package/dist/Icon/components/Paintbrush.d.ts +6 -0
- package/dist/Icon/components/Paintbrush.js +21 -0
- package/dist/Icon/components/Palette.d.ts +6 -0
- package/dist/Icon/components/Palette.js +20 -0
- package/dist/Icon/components/index.d.ts +10 -0
- package/dist/Icon/components/index.js +11 -0
- package/dist/Icon/index.d.ts +37 -0
- package/dist/Icon/index.js +24 -0
- package/dist/PageLock/Popup.d.ts +43 -0
- package/dist/PageLock/Popup.js +68 -0
- package/dist/PageLock/UserForm.d.ts +42 -0
- package/dist/PageLock/UserForm.js +68 -0
- package/dist/PageLock/index.d.ts +52 -0
- package/dist/PageLock/index.js +92 -0
- package/dist/PageLock/props.d.ts +51 -0
- package/dist/PageLock/props.js +29 -0
- package/dist/PageLock/style.d.ts +7 -0
- package/dist/PageLock/style.js +108 -0
- package/dist/PageLock/useFormState.d.ts +16 -0
- package/dist/PageLock/useFormState.js +19 -0
- package/dist/Paintbrush-EfUpNqey.js +14 -0
- package/dist/Palette-B5wq9KtV.js +13 -0
- package/dist/RightContent/Search/Panel.d.ts +42 -0
- package/dist/RightContent/Search/Panel.js +146 -0
- package/dist/RightContent/Search/index.d.ts +50 -0
- package/dist/RightContent/Search/index.js +118 -0
- package/dist/RightContent/Search/props.d.ts +17 -0
- package/dist/RightContent/Search/props.js +15 -0
- package/dist/RightContent/Search/style.d.ts +10 -0
- package/dist/RightContent/Search/style.js +96 -0
- package/dist/RightContent/index.d.ts +407 -0
- package/dist/RightContent/index.js +152 -0
- package/dist/RightContent/props.d.ts +64 -0
- package/dist/RightContent/props.js +63 -0
- package/dist/RightContent/style.d.ts +10 -0
- package/dist/RightContent/style.js +73 -0
- package/dist/ThemeEditor/components/BlockCheckbox.d.ts +39 -0
- package/dist/ThemeEditor/components/BlockCheckbox.js +42 -0
- package/dist/ThemeEditor/components/RegionalChange.d.ts +21 -0
- package/dist/ThemeEditor/components/RegionalChange.js +43 -0
- package/dist/ThemeEditor/components/Setting/index.d.ts +52 -0
- package/dist/ThemeEditor/components/Setting/index.js +125 -0
- package/dist/ThemeEditor/components/SwitchTab/index.d.ts +51 -0
- package/dist/ThemeEditor/components/SwitchTab/index.js +52 -0
- package/dist/ThemeEditor/components/SwitchTab/style.d.ts +6 -0
- package/dist/ThemeEditor/components/SwitchTab/style.js +54 -0
- package/dist/ThemeEditor/components/Tokens/Colors/ColorSvg.d.ts +7 -0
- package/dist/ThemeEditor/components/Tokens/Colors/ColorSvg.js +453 -0
- package/dist/ThemeEditor/components/Tokens/Colors/Primary.d.ts +7 -0
- package/dist/ThemeEditor/components/Tokens/Colors/Primary.js +58 -0
- package/dist/ThemeEditor/components/Tokens/Colors/Side.d.ts +7 -0
- package/dist/ThemeEditor/components/Tokens/Colors/Side.js +18 -0
- package/dist/ThemeEditor/components/Tokens/Colors/index.d.ts +7 -0
- package/dist/ThemeEditor/components/Tokens/Colors/index.js +15 -0
- package/dist/ThemeEditor/components/Tokens/context.d.ts +9 -0
- package/dist/ThemeEditor/components/Tokens/context.js +7 -0
- package/dist/ThemeEditor/components/Tokens/index.d.ts +45 -0
- package/dist/ThemeEditor/components/Tokens/index.js +69 -0
- package/dist/ThemeEditor/components/Tokens/utils/config.d.ts +10 -0
- package/dist/ThemeEditor/components/Tokens/utils/config.js +8 -0
- package/dist/ThemeEditor/components/Trigger.d.ts +21 -0
- package/dist/ThemeEditor/components/Trigger.js +46 -0
- package/dist/ThemeEditor/context.d.ts +14 -0
- package/dist/ThemeEditor/context.js +7 -0
- package/dist/ThemeEditor/index.d.ts +841 -0
- package/dist/ThemeEditor/index.js +165 -0
- package/dist/ThemeEditor/props.d.ts +57 -0
- package/dist/ThemeEditor/props.js +40 -0
- package/dist/ThemeEditor/style/animate.d.ts +9 -0
- package/dist/ThemeEditor/style/animate.js +38 -0
- package/dist/ThemeEditor/style/index.d.ts +10 -0
- package/dist/ThemeEditor/style/index.js +318 -0
- package/dist/ThemeEditor/style/theme.d.ts +6 -0
- package/dist/ThemeEditor/style/theme.js +71 -0
- package/dist/ThemeEditor/utils/config.d.ts +37 -0
- package/dist/ThemeEditor/utils/config.js +132 -0
- package/dist/ThemeEditor/utils/index.d.ts +9 -0
- package/dist/ThemeEditor/utils/index.js +64 -0
- package/dist/hooks/useClockTime/index.d.ts +11 -0
- package/dist/hooks/useClockTime/index.js +28 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +5 -0
- package/dist/pro-layout-components.esm.js +6258 -0
- package/dist/pro-layout-components.js +5 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/util.d.ts +10 -0
- package/dist/utils/util.js +17 -0
- package/global.d.ts +10 -0
- package/package.json +77 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getRightContentProps } from "../RightContent/props.js";
|
|
2
|
+
import { pick } from "es-toolkit";
|
|
3
|
+
|
|
4
|
+
//#region src/PageLock/props.ts
|
|
5
|
+
const rightContentProps = getRightContentProps();
|
|
6
|
+
const basicProps = {
|
|
7
|
+
hashId: String,
|
|
8
|
+
className: String
|
|
9
|
+
};
|
|
10
|
+
const publicPageLockProps = {
|
|
11
|
+
open: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: void 0
|
|
14
|
+
},
|
|
15
|
+
onOpenChange: Function,
|
|
16
|
+
"onUpdate:open": Function,
|
|
17
|
+
cryptoFn: Function,
|
|
18
|
+
...pick(rightContentProps, ["name", "avatar"])
|
|
19
|
+
};
|
|
20
|
+
const pageLockProps = {
|
|
21
|
+
...publicPageLockProps,
|
|
22
|
+
shortsKey: {
|
|
23
|
+
type: Object,
|
|
24
|
+
default: () => ({ disabled: false })
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { basicProps, pageLockProps, publicPageLockProps };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Keyframe } from "@gx-design-vue/pro-provider";
|
|
2
|
+
|
|
3
|
+
//#region src/PageLock/style.ts
|
|
4
|
+
const fadeIn = new Keyframe("fadeIn", {
|
|
5
|
+
"from": { opacity: 0 },
|
|
6
|
+
"to": { opacity: 1 }
|
|
7
|
+
});
|
|
8
|
+
const PageLockStyle = (token) => {
|
|
9
|
+
return { [token.componentCls]: {
|
|
10
|
+
"&-user-form": { [`${token.antCls}-form-item`]: { marginBlockEnd: 0 } },
|
|
11
|
+
"&-user-info": {
|
|
12
|
+
display: "flex",
|
|
13
|
+
flexDirection: "column",
|
|
14
|
+
justifyContent: "center",
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
gap: 20,
|
|
17
|
+
marginBlockEnd: token.marginLG
|
|
18
|
+
},
|
|
19
|
+
"&-user-name": {
|
|
20
|
+
fontWeight: 500,
|
|
21
|
+
fontSize: 18
|
|
22
|
+
},
|
|
23
|
+
"&-popup": {
|
|
24
|
+
display: "flex",
|
|
25
|
+
flexDirection: "column",
|
|
26
|
+
background: token.colorBgContainer,
|
|
27
|
+
position: "fixed",
|
|
28
|
+
inset: 0,
|
|
29
|
+
zIndex: 2200,
|
|
30
|
+
width: "100vw",
|
|
31
|
+
height: "100vh",
|
|
32
|
+
"&-enter": {
|
|
33
|
+
animationDuration: ".3s",
|
|
34
|
+
animationFillMode: "both",
|
|
35
|
+
animationName: fadeIn
|
|
36
|
+
},
|
|
37
|
+
"&-head": {
|
|
38
|
+
display: "flex",
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
justifyContent: "space-between",
|
|
41
|
+
marginBlock: token.marginLG,
|
|
42
|
+
color: token.colorTextSecondary,
|
|
43
|
+
paddingInline: 20,
|
|
44
|
+
fontSize: 20,
|
|
45
|
+
lineHeight: "28px",
|
|
46
|
+
fontWeight: 600
|
|
47
|
+
},
|
|
48
|
+
"&-lock-icon": {
|
|
49
|
+
cursor: "pointer",
|
|
50
|
+
transition: "all .3s",
|
|
51
|
+
"&:hover": {
|
|
52
|
+
transform: "scale(1.1)",
|
|
53
|
+
color: token.colorText
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"&-time": {
|
|
57
|
+
display: "flex",
|
|
58
|
+
paddingInline: "10%",
|
|
59
|
+
gap: "5rem",
|
|
60
|
+
flex: 1,
|
|
61
|
+
paddingBottom: "40px",
|
|
62
|
+
[`${token.componentCls}-popup-time-card`]: {
|
|
63
|
+
position: "relative",
|
|
64
|
+
width: "40%",
|
|
65
|
+
height: "100%",
|
|
66
|
+
display: "flex",
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
justifyContent: "center",
|
|
69
|
+
flex: "1 1 auto",
|
|
70
|
+
fontSize: 260,
|
|
71
|
+
borderRadius: token.borderRadiusLG,
|
|
72
|
+
background: token.colorFillContent
|
|
73
|
+
},
|
|
74
|
+
"&-range": {
|
|
75
|
+
position: "absolute",
|
|
76
|
+
left: "2%",
|
|
77
|
+
top: "2%",
|
|
78
|
+
fontSize: 16,
|
|
79
|
+
fontWeight: 600,
|
|
80
|
+
color: token.colorText
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"&-form": {
|
|
84
|
+
position: "relative",
|
|
85
|
+
display: "flex",
|
|
86
|
+
flexDirection: "column",
|
|
87
|
+
alignItems: "center",
|
|
88
|
+
justifyContent: "center",
|
|
89
|
+
gap: token.marginLG,
|
|
90
|
+
height: "100%",
|
|
91
|
+
[`${token.componentCls}-user-form`]: { width: 300 },
|
|
92
|
+
[`${token.componentCls}-popup-form-time`]: {
|
|
93
|
+
position: "absolute",
|
|
94
|
+
bottom: token.marginLG,
|
|
95
|
+
left: "50%",
|
|
96
|
+
transform: "translateX(-50%)",
|
|
97
|
+
display: "flex",
|
|
98
|
+
flexDirection: "column",
|
|
99
|
+
alignItems: "center",
|
|
100
|
+
justifyContent: "center"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
} };
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
export { PageLockStyle, fadeIn };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as ant_design_vue_es_form_useForm0 from "ant-design-vue/es/form/useForm";
|
|
2
|
+
|
|
3
|
+
//#region src/PageLock/useFormState.d.ts
|
|
4
|
+
interface FromState {
|
|
5
|
+
password: string;
|
|
6
|
+
}
|
|
7
|
+
declare function export_default(validator?: (value: string) => boolean): {
|
|
8
|
+
formState: {
|
|
9
|
+
password: string;
|
|
10
|
+
};
|
|
11
|
+
validate: <T = any>(names?: "password" | "password"[], option?: ant_design_vue_es_form_useForm0.validateOptions) => Promise<T>;
|
|
12
|
+
resetFields: (newValues?: ant_design_vue_es_form_useForm0.Props) => void;
|
|
13
|
+
validateInfos: Partial<Record<"password", ant_design_vue_es_form_useForm0.ValidateInfo>>;
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { FromState, export_default as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { reactive } from "vue";
|
|
2
|
+
import { useProForm } from "@gx-design-vue/pro-provider";
|
|
3
|
+
|
|
4
|
+
//#region src/PageLock/useFormState.ts
|
|
5
|
+
function useFormState_default(validator) {
|
|
6
|
+
const formState = reactive({ password: "" });
|
|
7
|
+
const { validate, resetFields, validateInfos } = useProForm(formState, { password: [{ validator: (_, value) => {
|
|
8
|
+
return (validator && value ? validator?.(value) : value) ? Promise.resolve() : Promise.reject(validator && value ? "密码错误" : "请输入锁屏密码");
|
|
9
|
+
} }] });
|
|
10
|
+
return {
|
|
11
|
+
formState,
|
|
12
|
+
validate,
|
|
13
|
+
resetFields,
|
|
14
|
+
validateInfos
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { useFormState_default as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createVNode, mergeProps } from "vue";
|
|
2
|
+
var PaintbrushIcon = (e = {}) => createVNode("svg", mergeProps({
|
|
3
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4
|
+
width: "1em",
|
|
5
|
+
height: "1em",
|
|
6
|
+
viewBox: "0 0 24 24"
|
|
7
|
+
}, e), [createVNode("g", {
|
|
8
|
+
fill: "none",
|
|
9
|
+
"fill-rule": "evenodd"
|
|
10
|
+
}, [createVNode("path", { d: "m12.594 23.258l-.012.002l-.071.035l-.02.004l-.014-.004l-.071-.036q-.016-.004-.024.006l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.016-.018m.264-.113l-.014.002l-.184.093l-.01.01l-.003.011l.018.43l.005.012l.008.008l.201.092q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.003-.011l.018-.43l-.003-.012l-.01-.01z" }, null), createVNode("path", {
|
|
11
|
+
fill: "currentColor",
|
|
12
|
+
d: "m8.464 4.222l12.021 12.02a1.01 1.01 0 0 1 0 1.415l-2.828 2.828a1 1 0 0 1-1.414 0L4.222 8.465a2 2 0 0 1 0-2.829l1.414-1.414a2 2 0 0 1 2.828 0M5 11.5c.444 0 .758.269.95.632l.053.112a3.87 3.87 0 0 0 1.385 1.672l.21.128c.358.202.62.525.62.955c0 .38-.203.68-.5.882l-.115.072a3.8 3.8 0 0 0-1.49 1.573l-.105.22c-.187.422-.512.754-1.008.754c-.452 0-.761-.274-.954-.641l-.054-.113a3.83 3.83 0 0 0-1.384-1.664l-.206-.126c-.359-.202-.621-.526-.621-.957c0-.383.208-.68.505-.883l.116-.072a3.76 3.76 0 0 0 1.482-1.565l.113-.236C4.18 11.826 4.51 11.5 5 11.5m5.586-2.328l-1.414 1.414l7.778 7.778l1.414-1.414zm6.845-1.77c.238-.481.8-.513 1.082-.097l.056.096c.216.435.574.804 1.043 1.04c.494.246.501.87.004 1.116a2.35 2.35 0 0 0-.954.872l-.09.164c-.24.486-.804.518-1.085.102l-.056-.096a2.3 2.3 0 0 0-.872-.945l-.17-.094c-.466-.232-.497-.79-.097-1.063l.092-.054a2.33 2.33 0 0 0 .957-.878l.09-.164ZM7.051 5.635L5.635 7.05l2.121 2.122l1.415-1.415L7.05 5.636ZM13.5 2c.294 0 .51.167.654.399l.06.11c.238.477.618.894 1.11 1.187l.196.107c.275.137.48.373.48.697c0 .283-.157.5-.38.64l-.105.06c-.52.26-.932.654-1.205 1.115l-.1.183c-.14.284-.374.502-.71.502c-.294 0-.51-.167-.654-.399l-.06-.11a2.9 2.9 0 0 0-1.11-1.187l-.196-.107c-.275-.137-.48-.374-.48-.698c0-.282.157-.499.38-.64l.105-.058c.52-.262.932-.654 1.205-1.116l.1-.183c.14-.284.374-.502.71-.502"
|
|
13
|
+
}, null)])]);
|
|
14
|
+
export { PaintbrushIcon as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createVNode, mergeProps } from "vue";
|
|
2
|
+
var PaletteIcon = (e = {}) => createVNode("svg", mergeProps({
|
|
3
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4
|
+
width: "1em",
|
|
5
|
+
height: "1em",
|
|
6
|
+
viewBox: "0 0 16 16"
|
|
7
|
+
}, e), [createVNode("path", {
|
|
8
|
+
fill: "currentColor",
|
|
9
|
+
"fill-rule": "evenodd",
|
|
10
|
+
d: "m14.489 8.388l-.001.006a.1.1 0 0 1-.027.028a.43.43 0 0 1-.264.082h-3.186c-3.118 0-4.68 3.77-2.476 5.974a6.5 6.5 0 1 1 5.953-6.09Zm-.292 1.616c.913 0 1.736-.618 1.79-1.529a8 8 0 1 0-7.032 7.468c1.243-.147 1.527-1.639.641-2.525c-1.26-1.26-.367-3.414 1.415-3.414zM10 5a1 1 0 1 1-2 0a1 1 0 0 1 2 0M6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2m0 2a1 1 0 1 1-2 0a1 1 0 0 1 2 0",
|
|
11
|
+
"clip-rule": "evenodd"
|
|
12
|
+
}, null)]);
|
|
13
|
+
export { PaletteIcon as default };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as vue220 from "vue";
|
|
2
|
+
import { PropType } from "vue";
|
|
3
|
+
import { AppRouteModule } from "@gx-design-vue/pro-layout";
|
|
4
|
+
import * as vue_jsx_runtime8 from "vue/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/RightContent/Search/Panel.d.ts
|
|
7
|
+
declare const _default: vue220.DefineComponent<vue220.ExtractPropTypes<{
|
|
8
|
+
className: PropType<string>;
|
|
9
|
+
hashId: PropType<string>;
|
|
10
|
+
keyword: PropType<string>;
|
|
11
|
+
onBlur: PropType<() => void>;
|
|
12
|
+
onClose: PropType<(clear?: boolean) => void>;
|
|
13
|
+
dataSource: {
|
|
14
|
+
type: PropType<AppRouteModule[]>;
|
|
15
|
+
default: () => any[];
|
|
16
|
+
};
|
|
17
|
+
historyKey: PropType<string>;
|
|
18
|
+
emptyProps: {
|
|
19
|
+
type: PropType<any>;
|
|
20
|
+
default: () => {};
|
|
21
|
+
};
|
|
22
|
+
}>, () => vue_jsx_runtime8.JSX.Element, {}, {}, {}, vue220.ComponentOptionsMixin, vue220.ComponentOptionsMixin, {}, string, vue220.PublicProps, Readonly<vue220.ExtractPropTypes<{
|
|
23
|
+
className: PropType<string>;
|
|
24
|
+
hashId: PropType<string>;
|
|
25
|
+
keyword: PropType<string>;
|
|
26
|
+
onBlur: PropType<() => void>;
|
|
27
|
+
onClose: PropType<(clear?: boolean) => void>;
|
|
28
|
+
dataSource: {
|
|
29
|
+
type: PropType<AppRouteModule[]>;
|
|
30
|
+
default: () => any[];
|
|
31
|
+
};
|
|
32
|
+
historyKey: PropType<string>;
|
|
33
|
+
emptyProps: {
|
|
34
|
+
type: PropType<any>;
|
|
35
|
+
default: () => {};
|
|
36
|
+
};
|
|
37
|
+
}>> & Readonly<{}>, {
|
|
38
|
+
dataSource: AppRouteModule[];
|
|
39
|
+
emptyProps: any;
|
|
40
|
+
}, {}, {}, {}, string, vue220.ComponentProvideOptions, true, {}, any>;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { _default as default };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { commonProps } from "./props.js";
|
|
2
|
+
import { uniqueByField } from "../../utils/util.js";
|
|
3
|
+
import { Fragment, cloneVNode, createTextVNode, createVNode, defineComponent, nextTick, onMounted, ref, unref, watch } from "vue";
|
|
4
|
+
import { classNames, cloneDeep, getPrefixCls, isArray, isString, isUrl } from "@gx-design-vue/pro-utils";
|
|
5
|
+
import { Empty } from "ant-design-vue";
|
|
6
|
+
import { useProLayoutMenuContext } from "@gx-design-vue/pro-layout";
|
|
7
|
+
import { CloseOutlined } from "@ant-design/icons-vue";
|
|
8
|
+
import { onKeyStroke, useLocalStorage, useThrottleFn } from "@vueuse/core";
|
|
9
|
+
import { useProAppContext } from "@gx-design-vue/pro-app";
|
|
10
|
+
import { pinyin } from "pinyin-pro";
|
|
11
|
+
import { useRouter } from "vue-router";
|
|
12
|
+
|
|
13
|
+
//#region src/RightContent/Search/Panel.tsx
|
|
14
|
+
const NoResult = ({ className, value }) => {
|
|
15
|
+
if (value) return createVNode(Empty, {
|
|
16
|
+
"image": Empty.PRESENTED_IMAGE_SIMPLE,
|
|
17
|
+
"description": `未找到搜索结果 "${value}"`
|
|
18
|
+
}, null);
|
|
19
|
+
return createVNode("div", { "class": className }, [createTextVNode("没有搜索历史")]);
|
|
20
|
+
};
|
|
21
|
+
var Panel_default = /* @__PURE__ */ defineComponent({
|
|
22
|
+
props: {
|
|
23
|
+
...commonProps,
|
|
24
|
+
className: String,
|
|
25
|
+
hashId: String,
|
|
26
|
+
keyword: String,
|
|
27
|
+
onBlur: Function,
|
|
28
|
+
onClose: Function
|
|
29
|
+
},
|
|
30
|
+
setup(props) {
|
|
31
|
+
const router = useRouter();
|
|
32
|
+
const { syncMatchedKeys } = useProLayoutMenuContext();
|
|
33
|
+
const { emptyText } = useProAppContext();
|
|
34
|
+
const searchHistory = useLocalStorage(props.historyKey || getPrefixCls({
|
|
35
|
+
suffixCls: "search-history",
|
|
36
|
+
isPor: true
|
|
37
|
+
}), []);
|
|
38
|
+
const activeIndex = ref(0);
|
|
39
|
+
const searchResults = ref(cloneDeep(unref(searchHistory)));
|
|
40
|
+
const handleSearch = useThrottleFn(search, 200);
|
|
41
|
+
function search(searchKey) {
|
|
42
|
+
searchKey = searchKey.trim();
|
|
43
|
+
if (!searchKey) {
|
|
44
|
+
searchResults.value = [];
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const results = [];
|
|
48
|
+
props.dataSource.forEach((item) => {
|
|
49
|
+
if (item.meta?.hideInMenu) return;
|
|
50
|
+
const name = item.meta?.title || item.name || "";
|
|
51
|
+
if (name.includes(searchKey)) results.push(item);
|
|
52
|
+
if (pinyin(name, {
|
|
53
|
+
toneType: "none",
|
|
54
|
+
type: "array",
|
|
55
|
+
pattern: "first"
|
|
56
|
+
}).includes(searchKey.toLowerCase())) results.push(item);
|
|
57
|
+
if (pinyin(name, {
|
|
58
|
+
toneType: "none",
|
|
59
|
+
type: "array",
|
|
60
|
+
pattern: "pinyin"
|
|
61
|
+
}).includes(searchKey.toLowerCase())) results.push(item);
|
|
62
|
+
});
|
|
63
|
+
searchResults.value = results;
|
|
64
|
+
if (results.length > 0) activeIndex.value = 0;
|
|
65
|
+
activeIndex.value = 0;
|
|
66
|
+
}
|
|
67
|
+
watch(() => props.keyword, (val) => {
|
|
68
|
+
if (val) handleSearch(val);
|
|
69
|
+
else searchResults.value = cloneDeep(unref(searchHistory));
|
|
70
|
+
});
|
|
71
|
+
function scrollIntoView() {
|
|
72
|
+
const element = document.querySelector(`[data-search-item="${activeIndex.value}"]`);
|
|
73
|
+
if (element) element.scrollIntoView({ block: "nearest" });
|
|
74
|
+
}
|
|
75
|
+
async function handleEnter() {
|
|
76
|
+
if (searchResults.value.length === 0) return;
|
|
77
|
+
const index = activeIndex.value;
|
|
78
|
+
if (searchResults.value.length === 0 || index < 0) return;
|
|
79
|
+
const row = searchResults.value[index];
|
|
80
|
+
if (row) {
|
|
81
|
+
const toPath = isString(row.redirect) ? row.redirect : row.path || "";
|
|
82
|
+
const target = row.meta?.link || "";
|
|
83
|
+
const hasUrl = isUrl(target);
|
|
84
|
+
if (searchHistory.value.every((item) => item.name !== row.name)) searchHistory.value.push(cloneDeep(row));
|
|
85
|
+
props.onClose?.(true);
|
|
86
|
+
await nextTick();
|
|
87
|
+
if (hasUrl && target && row.meta?.linkStatus === 1) window.open(target, "_blank");
|
|
88
|
+
else {
|
|
89
|
+
router.push({ path: toPath });
|
|
90
|
+
syncMatchedKeys(60);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function handleUp() {
|
|
95
|
+
if (searchResults.value.length === 0) return;
|
|
96
|
+
props.onBlur?.();
|
|
97
|
+
activeIndex.value--;
|
|
98
|
+
if (activeIndex.value < 0) activeIndex.value = searchResults.value.length - 1;
|
|
99
|
+
scrollIntoView();
|
|
100
|
+
}
|
|
101
|
+
function handleDown() {
|
|
102
|
+
if (searchResults.value.length === 0) return;
|
|
103
|
+
props.onBlur?.();
|
|
104
|
+
activeIndex.value++;
|
|
105
|
+
if (activeIndex.value > searchResults.value.length - 1) activeIndex.value = 0;
|
|
106
|
+
scrollIntoView();
|
|
107
|
+
}
|
|
108
|
+
onMounted(() => {
|
|
109
|
+
onKeyStroke("Enter", handleEnter);
|
|
110
|
+
onKeyStroke("ArrowUp", handleUp);
|
|
111
|
+
onKeyStroke("ArrowDown", handleDown);
|
|
112
|
+
});
|
|
113
|
+
function handleMouseenter(index) {
|
|
114
|
+
activeIndex.value = index;
|
|
115
|
+
}
|
|
116
|
+
function removeItem(e, row) {
|
|
117
|
+
e.stopPropagation();
|
|
118
|
+
searchResults.value = searchResults.value.filter((item) => item.name !== row.name);
|
|
119
|
+
searchHistory.value = searchHistory.value.filter((item) => item.name !== row.name);
|
|
120
|
+
activeIndex.value = activeIndex.value - 1 >= 0 ? activeIndex.value - 1 : 0;
|
|
121
|
+
scrollIntoView();
|
|
122
|
+
}
|
|
123
|
+
const getClassNames = (name) => classNames(`${props.className}${name ? `-${name}` : ""}`, props.hashId);
|
|
124
|
+
return () => {
|
|
125
|
+
const emptyTextRender = isArray(emptyText.value) ? emptyText.value : [emptyText.value];
|
|
126
|
+
return createVNode(Fragment, null, [searchResults.value.length > 0 ? createVNode(Fragment, null, [searchHistory.value.length > 0 && !props.keyword && createVNode("div", { "class": getClassNames("panel-title") }, [createTextVNode("搜索历史")]), createVNode("div", { "class": getClassNames("panel-list") }, [uniqueByField(searchResults.value, "name").map((item, index) => createVNode("div", {
|
|
127
|
+
"key": item.name,
|
|
128
|
+
"class": getClassNames(classNames("panel-item", index === activeIndex.value && "active")),
|
|
129
|
+
"data-search-item": index,
|
|
130
|
+
"onClick": () => handleEnter(),
|
|
131
|
+
"onMouseenter": () => handleMouseenter(index)
|
|
132
|
+
}, [createVNode("div", { "class": getClassNames("panel-item-left") }, [item.meta?.title]), searchHistory.value.length > 0 && !props.keyword && createVNode(CloseOutlined, { "onClick": (e) => removeItem(e, item) }, null)]))])]) : emptyText.value ? emptyTextRender.map((node) => {
|
|
133
|
+
return cloneVNode(node, {
|
|
134
|
+
...props.emptyProps,
|
|
135
|
+
text: props.keyword ? `未找到搜索结果 "${props.keyword}"` : true
|
|
136
|
+
});
|
|
137
|
+
}) : createVNode(NoResult, {
|
|
138
|
+
"className": getClassNames("result"),
|
|
139
|
+
"value": props.keyword
|
|
140
|
+
}, null)]);
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
//#endregion
|
|
146
|
+
export { Panel_default as default };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as vue271 from "vue";
|
|
2
|
+
import { PropType } from "vue";
|
|
3
|
+
import * as _gx_design_vue_pro_layout6 from "@gx-design-vue/pro-layout";
|
|
4
|
+
import * as ant_design_vue_es__util_type27 from "ant-design-vue/es/_util/type";
|
|
5
|
+
|
|
6
|
+
//#region src/RightContent/Search/index.d.ts
|
|
7
|
+
declare const _default: vue271.DefineComponent<vue271.ExtractPropTypes<{
|
|
8
|
+
dark: {
|
|
9
|
+
type: PropType<boolean>;
|
|
10
|
+
default: any;
|
|
11
|
+
};
|
|
12
|
+
disabledShortKey: {
|
|
13
|
+
type: PropType<boolean>;
|
|
14
|
+
default: boolean;
|
|
15
|
+
};
|
|
16
|
+
dataSource: {
|
|
17
|
+
type: PropType<_gx_design_vue_pro_layout6.AppRouteModule[]>;
|
|
18
|
+
default: () => any[];
|
|
19
|
+
};
|
|
20
|
+
historyKey: PropType<string>;
|
|
21
|
+
emptyProps: {
|
|
22
|
+
type: PropType<any>;
|
|
23
|
+
default: () => {};
|
|
24
|
+
};
|
|
25
|
+
}>, () => ant_design_vue_es__util_type27.VueNode, {}, {}, {}, vue271.ComponentOptionsMixin, vue271.ComponentOptionsMixin, {}, string, vue271.PublicProps, Readonly<vue271.ExtractPropTypes<{
|
|
26
|
+
dark: {
|
|
27
|
+
type: PropType<boolean>;
|
|
28
|
+
default: any;
|
|
29
|
+
};
|
|
30
|
+
disabledShortKey: {
|
|
31
|
+
type: PropType<boolean>;
|
|
32
|
+
default: boolean;
|
|
33
|
+
};
|
|
34
|
+
dataSource: {
|
|
35
|
+
type: PropType<_gx_design_vue_pro_layout6.AppRouteModule[]>;
|
|
36
|
+
default: () => any[];
|
|
37
|
+
};
|
|
38
|
+
historyKey: PropType<string>;
|
|
39
|
+
emptyProps: {
|
|
40
|
+
type: PropType<any>;
|
|
41
|
+
default: () => {};
|
|
42
|
+
};
|
|
43
|
+
}>> & Readonly<{}>, {
|
|
44
|
+
dataSource: _gx_design_vue_pro_layout6.AppRouteModule[];
|
|
45
|
+
emptyProps: any;
|
|
46
|
+
dark: boolean;
|
|
47
|
+
disabledShortKey: boolean;
|
|
48
|
+
}, {}, {}, {}, string, vue271.ComponentProvideOptions, true, {}, any>;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { _default as default };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { commonProps } from "./props.js";
|
|
2
|
+
import Panel_default from "./Panel.js";
|
|
3
|
+
import { useStyle } from "./style.js";
|
|
4
|
+
import { Fragment, computed, createTextVNode, createVNode, defineComponent, mergeProps, nextTick, ref } from "vue";
|
|
5
|
+
import { useState } from "@gx-design-vue/pro-hooks";
|
|
6
|
+
import { classNames, getLevelData, getPrefixCls, isWindowsOs } from "@gx-design-vue/pro-utils";
|
|
7
|
+
import { Input } from "ant-design-vue";
|
|
8
|
+
import { useProLayoutContext } from "@gx-design-vue/pro-layout";
|
|
9
|
+
import { ArrowUpOutlined, EnterOutlined, SearchOutlined } from "@ant-design/icons-vue";
|
|
10
|
+
import { useMagicKeys, whenever } from "@vueuse/core";
|
|
11
|
+
import { GProModal } from "@gx-design-vue/pro-modal";
|
|
12
|
+
|
|
13
|
+
//#region src/RightContent/Search/index.tsx
|
|
14
|
+
const ModalFooter = ({ className, hashId }) => createVNode("div", { "class": classNames(`${className}-footer`, hashId) }, [createVNode("div", { "class": classNames(`${className}-footer-icon`, hashId) }, [createVNode(EnterOutlined, null, null), createTextVNode("选择")]), createVNode("div", { "class": classNames(`${className}-footer-icon`, hashId) }, [
|
|
15
|
+
createVNode(ArrowUpOutlined, null, null),
|
|
16
|
+
createVNode(ArrowUpOutlined, { "rotate": 180 }, null),
|
|
17
|
+
createTextVNode("导航")
|
|
18
|
+
])]);
|
|
19
|
+
var Search_default = /* @__PURE__ */ defineComponent({
|
|
20
|
+
name: "SearchPageInput",
|
|
21
|
+
props: {
|
|
22
|
+
...commonProps,
|
|
23
|
+
dark: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: void 0
|
|
26
|
+
},
|
|
27
|
+
disabledShortKey: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
setup(props) {
|
|
33
|
+
const baseClass = getPrefixCls({
|
|
34
|
+
suffixCls: "page-search",
|
|
35
|
+
isPor: true
|
|
36
|
+
});
|
|
37
|
+
const { wrapSSR, hashId } = useStyle(baseClass);
|
|
38
|
+
const [keyword, changeKeyword] = useState("");
|
|
39
|
+
const [open, setOpen] = useState(false);
|
|
40
|
+
const layoutContext = useProLayoutContext();
|
|
41
|
+
const keys = useMagicKeys();
|
|
42
|
+
const cmd = isWindowsOs() ? keys["ctrl+k"] : keys["cmd+k"];
|
|
43
|
+
const inputRef = ref();
|
|
44
|
+
const dataSource = computed(() => {
|
|
45
|
+
if (props.dataSource.length) return getLevelData(props.dataSource);
|
|
46
|
+
if (layoutContext) return layoutContext.menu.value.flatMenus;
|
|
47
|
+
return [];
|
|
48
|
+
});
|
|
49
|
+
whenever(cmd, () => {
|
|
50
|
+
if (props.disabledShortKey) return;
|
|
51
|
+
setOpen(true);
|
|
52
|
+
});
|
|
53
|
+
whenever(open, () => {
|
|
54
|
+
nextTick(() => {
|
|
55
|
+
inputRef.value?.focus();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
const handleClose = (clear) => {
|
|
59
|
+
setOpen(false);
|
|
60
|
+
if (clear) changeKeyword("");
|
|
61
|
+
};
|
|
62
|
+
return () => {
|
|
63
|
+
const classNameProps = {
|
|
64
|
+
className: `${baseClass}`,
|
|
65
|
+
hashId: hashId.value
|
|
66
|
+
};
|
|
67
|
+
const modalClass = `${baseClass}-modal`;
|
|
68
|
+
return wrapSSR(createVNode(Fragment, null, [createVNode("div", {
|
|
69
|
+
"class": classNames(baseClass, hashId.value),
|
|
70
|
+
"onClick": () => setOpen(true)
|
|
71
|
+
}, [
|
|
72
|
+
createVNode(SearchOutlined, null, null),
|
|
73
|
+
createVNode("span", { "class": classNames(`${baseClass}-word`, hashId.value) }, [createTextVNode("搜索")]),
|
|
74
|
+
createVNode("span", { "class": classNames(`${baseClass}-word-icon`, hashId.value) }, [
|
|
75
|
+
createTextVNode("⌘"),
|
|
76
|
+
" ",
|
|
77
|
+
createVNode("kbd", null, [createTextVNode("K")])
|
|
78
|
+
])
|
|
79
|
+
]), createVNode(GProModal, {
|
|
80
|
+
"class": classNames(`${modalClass}`, hashId.value),
|
|
81
|
+
"width": 600,
|
|
82
|
+
"scrollProps": {
|
|
83
|
+
maxHeight: 400,
|
|
84
|
+
minHeight: 200
|
|
85
|
+
},
|
|
86
|
+
"centered": false,
|
|
87
|
+
"destroyOnClose": false,
|
|
88
|
+
"title": createVNode(Input, {
|
|
89
|
+
"style": {
|
|
90
|
+
width: `${600 * .8}px`,
|
|
91
|
+
padding: 0
|
|
92
|
+
},
|
|
93
|
+
"ref": inputRef,
|
|
94
|
+
"bordered": false,
|
|
95
|
+
"size": "large",
|
|
96
|
+
"placeholder": "搜索导航菜单",
|
|
97
|
+
"value": keyword.value,
|
|
98
|
+
"prefix": createVNode(SearchOutlined, null, null),
|
|
99
|
+
"onChange": (e) => changeKeyword(e.target.value)
|
|
100
|
+
}, null),
|
|
101
|
+
"open": open.value,
|
|
102
|
+
"footer": createVNode(ModalFooter, {
|
|
103
|
+
"className": modalClass,
|
|
104
|
+
"hashId": hashId.value
|
|
105
|
+
}, null),
|
|
106
|
+
"onCancel": () => handleClose()
|
|
107
|
+
}, { default: () => [createVNode(Panel_default, mergeProps(classNameProps, {
|
|
108
|
+
"emptyProps": props.emptyProps,
|
|
109
|
+
"keyword": keyword.value,
|
|
110
|
+
"dataSource": dataSource.value,
|
|
111
|
+
"onClose": handleClose
|
|
112
|
+
}), null)] })]));
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
//#endregion
|
|
118
|
+
export { Search_default as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
import { AppRouteModule } from "@gx-design-vue/pro-layout";
|
|
3
|
+
|
|
4
|
+
//#region src/RightContent/Search/props.d.ts
|
|
5
|
+
declare const commonProps: {
|
|
6
|
+
dataSource: {
|
|
7
|
+
type: PropType<AppRouteModule[]>;
|
|
8
|
+
default: () => any[];
|
|
9
|
+
};
|
|
10
|
+
historyKey: PropType<string>;
|
|
11
|
+
emptyProps: {
|
|
12
|
+
type: PropType<any>;
|
|
13
|
+
default: () => {};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { commonProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/RightContent/Search/props.ts
|
|
2
|
+
const commonProps = {
|
|
3
|
+
dataSource: {
|
|
4
|
+
type: Array,
|
|
5
|
+
default: () => []
|
|
6
|
+
},
|
|
7
|
+
historyKey: String,
|
|
8
|
+
emptyProps: {
|
|
9
|
+
type: Object,
|
|
10
|
+
default: () => ({})
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { commonProps };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as vue268 from "vue";
|
|
2
|
+
import * as ant_design_vue_es__util_type25 from "ant-design-vue/es/_util/type";
|
|
3
|
+
|
|
4
|
+
//#region src/RightContent/Search/style.d.ts
|
|
5
|
+
declare function useStyle(componentCls: string): {
|
|
6
|
+
wrapSSR: (node: ant_design_vue_es__util_type25.VueNode) => ant_design_vue_es__util_type25.VueNode;
|
|
7
|
+
hashId: vue268.ComputedRef<string>;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { useStyle };
|