Commit 74e62cbc712bdd4d4826e5fe80f537d87e44ffce
1 parent
bd6b203f
feat: add useDesign
Showing
52 changed files
with
260 additions
and
385 deletions
.ls-lint.yml
@@ -3,6 +3,7 @@ ls: | @@ -3,6 +3,7 @@ ls: | ||
3 | .js: kebab-case | PascalCase | 3 | .js: kebab-case | PascalCase |
4 | .vue: PascalCase | regex:^index | 4 | .vue: PascalCase | regex:^index |
5 | .ts: camelCase | PascalCase | 5 | .ts: camelCase | PascalCase |
6 | + .tsx: camelCase | PascalCase | ||
6 | .d.ts: kebab-case | 7 | .d.ts: kebab-case |
7 | .mock.ts: kebab-case | 8 | .mock.ts: kebab-case |
8 | .data.ts: camelCase | kebab-case | 9 | .data.ts: camelCase | kebab-case |
src/App.vue
@@ -4,7 +4,9 @@ | @@ -4,7 +4,9 @@ | ||
4 | :locale="antConfigLocale" | 4 | :locale="antConfigLocale" |
5 | :transform-cell-text="transformCellText" | 5 | :transform-cell-text="transformCellText" |
6 | > | 6 | > |
7 | - <router-view /> | 7 | + <AppProvider> |
8 | + <router-view /> | ||
9 | + </AppProvider> | ||
8 | </ConfigProvider> | 10 | </ConfigProvider> |
9 | </template> | 11 | </template> |
10 | 12 | ||
@@ -17,9 +19,11 @@ | @@ -17,9 +19,11 @@ | ||
17 | import { useLockPage } from '/@/hooks/web/useLockPage'; | 19 | import { useLockPage } from '/@/hooks/web/useLockPage'; |
18 | import { useLocale } from '/@/hooks/web/useLocale'; | 20 | import { useLocale } from '/@/hooks/web/useLocale'; |
19 | 21 | ||
22 | + import { AppProvider } from '/@/components/Application'; | ||
23 | + | ||
20 | export default defineComponent({ | 24 | export default defineComponent({ |
21 | name: 'App', | 25 | name: 'App', |
22 | - components: { ConfigProvider }, | 26 | + components: { ConfigProvider, AppProvider }, |
23 | setup() { | 27 | setup() { |
24 | // Initialize vuex internal system configuration | 28 | // Initialize vuex internal system configuration |
25 | initAppConfigStore(); | 29 | initAppConfigStore(); |
src/components/Application/index.ts
1 | -import AppLocalePickerLib from './src/AppLocalePicker.vue'; | ||
2 | -import AppLogoLib from './src/AppLogo.vue'; | 1 | +import AppLocalePicker from './src/AppLocalePicker.vue'; |
2 | +import AppLogo from './src/AppLogo.vue'; | ||
3 | +import AppProvider from './src/AppProvider.vue'; | ||
3 | import { withInstall } from '../util'; | 4 | import { withInstall } from '../util'; |
4 | 5 | ||
5 | -export const AppLocalePicker = withInstall(AppLocalePickerLib); | ||
6 | -export const AppLogo = withInstall(AppLogoLib); | 6 | +withInstall(AppLocalePicker, AppLogo, AppProvider); |
7 | + | ||
8 | +export { useAppProviderContext } from './src/useAppContext'; | ||
9 | + | ||
10 | +export { AppLocalePicker, AppLogo, AppProvider }; |
src/components/Application/src/AppLocalePicker.vue
@@ -69,8 +69,8 @@ | @@ -69,8 +69,8 @@ | ||
69 | }); | 69 | }); |
70 | </script> | 70 | </script> |
71 | 71 | ||
72 | -<style lang="less"> | ||
73 | - .app-locale-picker-overlay { | 72 | +<style lang="less" scoped> |
73 | + :global(.app-locale-picker-overlay) { | ||
74 | .ant-dropdown-menu-item { | 74 | .ant-dropdown-menu-item { |
75 | min-width: 160px; | 75 | min-width: 160px; |
76 | } | 76 | } |
src/components/Application/src/AppLogo.vue
@@ -4,12 +4,14 @@ | @@ -4,12 +4,14 @@ | ||
4 | --> | 4 | --> |
5 | <template> | 5 | <template> |
6 | <div | 6 | <div |
7 | - class="app-logo anticon" | ||
8 | - :class="{ theme, 'collapsed-show-title': getCollapsedShowTitle }" | 7 | + class="anticon" |
8 | + :class="[prefixCls, theme, { 'collapsed-show-title': getCollapsedShowTitle }]" | ||
9 | @click="handleGoHome" | 9 | @click="handleGoHome" |
10 | > | 10 | > |
11 | <img src="/@/assets/images/logo.png" /> | 11 | <img src="/@/assets/images/logo.png" /> |
12 | - <div class="app-logo__title ml-2 ellipsis" v-show="showTitle">{{ globSetting.title }}</div> | 12 | + <div class="ml-2 ellipsis" :class="[`${prefixCls}__title`]" v-show="showTitle"> |
13 | + {{ globSetting.title }} | ||
14 | + </div> | ||
13 | </div> | 15 | </div> |
14 | </template> | 16 | </template> |
15 | <script lang="ts"> | 17 | <script lang="ts"> |
@@ -23,6 +25,8 @@ | @@ -23,6 +25,8 @@ | ||
23 | 25 | ||
24 | import { propTypes } from '/@/utils/propTypes'; | 26 | import { propTypes } from '/@/utils/propTypes'; |
25 | 27 | ||
28 | + import { useDesign } from '/@/hooks/web/useDesign'; | ||
29 | + | ||
26 | export default defineComponent({ | 30 | export default defineComponent({ |
27 | name: 'AppLogo', | 31 | name: 'AppLogo', |
28 | props: { | 32 | props: { |
@@ -34,6 +38,8 @@ | @@ -34,6 +38,8 @@ | ||
34 | showTitle: propTypes.bool.def(true), | 38 | showTitle: propTypes.bool.def(true), |
35 | }, | 39 | }, |
36 | setup() { | 40 | setup() { |
41 | + const { prefixCls } = useDesign('app-logo'); | ||
42 | + | ||
37 | const { getCollapsedShowTitle } = useMenuSetting(); | 43 | const { getCollapsedShowTitle } = useMenuSetting(); |
38 | 44 | ||
39 | const globSetting = useGlobSetting(); | 45 | const globSetting = useGlobSetting(); |
@@ -48,17 +54,19 @@ | @@ -48,17 +54,19 @@ | ||
48 | handleGoHome, | 54 | handleGoHome, |
49 | globSetting, | 55 | globSetting, |
50 | getCollapsedShowTitle, | 56 | getCollapsedShowTitle, |
57 | + prefixCls, | ||
51 | }; | 58 | }; |
52 | }, | 59 | }, |
53 | }); | 60 | }); |
54 | </script> | 61 | </script> |
55 | <style lang="less" scoped> | 62 | <style lang="less" scoped> |
56 | @import (reference) '../../../design/index.less'; | 63 | @import (reference) '../../../design/index.less'; |
64 | + @prefix-cls: ~'@{namespace}-app-logo'; | ||
57 | 65 | ||
58 | - .app-logo { | 66 | + .@{prefix-cls} { |
59 | display: flex; | 67 | display: flex; |
60 | align-items: center; | 68 | align-items: center; |
61 | - padding-left: 10px; | 69 | + padding-left: 12px; |
62 | cursor: pointer; | 70 | cursor: pointer; |
63 | 71 | ||
64 | &.collapsed-show-title { | 72 | &.collapsed-show-title { |
src/components/Application/src/AppProvider.vue
0 → 100644
1 | +<template> | ||
2 | + <slot /> | ||
3 | +</template> | ||
4 | +<script lang="ts"> | ||
5 | + import type { PropType } from 'vue'; | ||
6 | + import { defineComponent, toRefs } from 'vue'; | ||
7 | + | ||
8 | + import { createAppProviderContext } from './useAppContext'; | ||
9 | + export default defineComponent({ | ||
10 | + name: 'AppProvider', | ||
11 | + inheritAttrs: false, | ||
12 | + props: { | ||
13 | + prefixCls: { | ||
14 | + type: String as PropType<string>, | ||
15 | + default: 'vben', | ||
16 | + }, | ||
17 | + }, | ||
18 | + setup(props) { | ||
19 | + const { prefixCls } = toRefs(props); | ||
20 | + createAppProviderContext({ prefixCls }); | ||
21 | + return {}; | ||
22 | + }, | ||
23 | + }); | ||
24 | +</script> |
src/components/Application/src/useAppContext.ts
0 → 100644
1 | +import { InjectionKey, Ref } from 'vue'; | ||
2 | +import { createContext, useContext } from '/@/hooks/core/useContext'; | ||
3 | + | ||
4 | +export interface AppProviderContextProps { | ||
5 | + prefixCls: Ref<string>; | ||
6 | +} | ||
7 | + | ||
8 | +const key: InjectionKey<AppProviderContextProps> = Symbol(); | ||
9 | + | ||
10 | +export function createAppProviderContext(context: AppProviderContextProps) { | ||
11 | + return createContext<AppProviderContextProps>(context, key); | ||
12 | +} | ||
13 | + | ||
14 | +export function useAppProviderContext() { | ||
15 | + return useContext<AppProviderContextProps>(key); | ||
16 | +} |
src/components/Authority/index.ts
src/components/Basic/index.ts
1 | -import BasicArrowLib from './src/BasicArrow.vue'; | ||
2 | -import BasicHelpLib from './src/BasicHelp.vue'; | ||
3 | -import BasicTitleLib from './src/BasicTitle.vue'; | 1 | +import BasicArrow from './src/BasicArrow.vue'; |
2 | +import BasicHelp from './src/BasicHelp.vue'; | ||
3 | +import BasicTitle from './src/BasicTitle.vue'; | ||
4 | 4 | ||
5 | import { withInstall } from '../util'; | 5 | import { withInstall } from '../util'; |
6 | 6 | ||
7 | -export const BasicArrow = withInstall(BasicArrowLib); | ||
8 | -export const BasicHelp = withInstall(BasicHelpLib); | ||
9 | -export const BasicTitle = withInstall(BasicTitleLib); | 7 | +withInstall(BasicArrow, BasicHelp, BasicTitle); |
8 | + | ||
9 | +export { BasicArrow, BasicHelp, BasicTitle }; |
src/components/Button/index.ts
src/components/ClickOutSide/index.ts
1 | -import ClickOutSideLib from './src/index.vue'; | 1 | +import ClickOutSide from './src/index.vue'; |
2 | import { withInstall } from '../util'; | 2 | import { withInstall } from '../util'; |
3 | 3 | ||
4 | -export const ClickOutSide = withInstall(ClickOutSideLib); | 4 | +withInstall(ClickOutSide); |
5 | + | ||
6 | +export { ClickOutSide }; |
src/components/Container/index.ts
1 | -import ScrollContainerLib from './src/ScrollContainer.vue'; | ||
2 | -import CollapseContainerLib from './src/collapse/CollapseContainer.vue'; | ||
3 | -import LazyContainerLib from './src/LazyContainer.vue'; | 1 | +import ScrollContainer from './src/ScrollContainer.vue'; |
2 | +import CollapseContainer from './src/collapse/CollapseContainer.vue'; | ||
3 | +import LazyContainer from './src/LazyContainer.vue'; | ||
4 | import { withInstall } from '../util'; | 4 | import { withInstall } from '../util'; |
5 | 5 | ||
6 | +withInstall(ScrollContainer, CollapseContainer, LazyContainer); | ||
7 | + | ||
6 | export * from './src/types'; | 8 | export * from './src/types'; |
7 | 9 | ||
8 | -export const ScrollContainer = withInstall(ScrollContainerLib); | ||
9 | -export const CollapseContainer = withInstall(CollapseContainerLib); | ||
10 | -export const LazyContainer = withInstall(LazyContainerLib); | 10 | +export { ScrollContainer, CollapseContainer, LazyContainer }; |
src/components/CountTo/index.ts
1 | // Transform vue-count-to to support vue3 version | 1 | // Transform vue-count-to to support vue3 version |
2 | 2 | ||
3 | -import CountToLib from './src/index.vue'; | 3 | +import CountTo from './src/index.vue'; |
4 | import { withInstall } from '../util'; | 4 | import { withInstall } from '../util'; |
5 | 5 | ||
6 | -export const CountTo = withInstall(CountToLib); | 6 | +withInstall(CountTo); |
7 | +export { CountTo }; |
src/components/Description/index.ts
1 | -import DescriptionLib from './src/index'; | 1 | +import Description from './src/index'; |
2 | 2 | ||
3 | import { withInstall } from '../util'; | 3 | import { withInstall } from '../util'; |
4 | 4 | ||
5 | +withInstall(Description); | ||
6 | + | ||
5 | export * from './src/types'; | 7 | export * from './src/types'; |
6 | export { useDescription } from './src/useDescription'; | 8 | export { useDescription } from './src/useDescription'; |
7 | - | ||
8 | -export const Description = withInstall(DescriptionLib); | 9 | +export { Description }; |
src/components/Drawer/index.ts
1 | -import BasicDrawerLib from './src/BasicDrawer'; | 1 | +import BasicDrawer from './src/BasicDrawer'; |
2 | import { withInstall } from '../util'; | 2 | import { withInstall } from '../util'; |
3 | 3 | ||
4 | +withInstall(BasicDrawer); | ||
4 | export * from './src/types'; | 5 | export * from './src/types'; |
5 | export { useDrawer, useDrawerInner } from './src/useDrawer'; | 6 | export { useDrawer, useDrawerInner } from './src/useDrawer'; |
6 | -export const BasicDrawer = withInstall(BasicDrawerLib); | 7 | +export { BasicDrawer }; |
src/components/Dropdown/index.ts
1 | -import DropdownLib from './src/Dropdown'; | 1 | +import Dropdown from './src/Dropdown'; |
2 | import { withInstall } from '../util'; | 2 | import { withInstall } from '../util'; |
3 | 3 | ||
4 | +withInstall(Dropdown); | ||
4 | export * from './src/types'; | 5 | export * from './src/types'; |
5 | 6 | ||
6 | -export const Dropdown = withInstall(DropdownLib); | 7 | +export { Dropdown }; |
src/components/Excel/index.ts
1 | -import ImportExcelLib from './src/ImportExcel.vue'; | ||
2 | -import ExportExcelModelLib from './src/ExportExcelModel.vue'; | 1 | +import ImportExcel from './src/ImportExcel.vue'; |
2 | +import ExportExcelModel from './src/ExportExcelModel.vue'; | ||
3 | 3 | ||
4 | import { withInstall } from '../util'; | 4 | import { withInstall } from '../util'; |
5 | 5 | ||
6 | +withInstall(ImportExcel, ExportExcelModel); | ||
7 | + | ||
6 | export * from './src/types'; | 8 | export * from './src/types'; |
7 | 9 | ||
8 | export { jsonToSheetXlsx, aoaToSheetXlsx } from './src/Export2Excel'; | 10 | export { jsonToSheetXlsx, aoaToSheetXlsx } from './src/Export2Excel'; |
9 | 11 | ||
10 | -export const ImportExcel = withInstall(ImportExcelLib); | ||
11 | -export const ExportExcelModel = withInstall(ExportExcelModelLib); | 12 | +export { ImportExcel, ExportExcelModel }; |
src/components/Form/index.ts
1 | -import BasicFormLib from './src/BasicForm.vue'; | 1 | +import BasicForm from './src/BasicForm.vue'; |
2 | import { withInstall } from '../util'; | 2 | import { withInstall } from '../util'; |
3 | 3 | ||
4 | +withInstall(BasicForm); | ||
5 | + | ||
4 | export * from './src/types/form'; | 6 | export * from './src/types/form'; |
5 | export * from './src/types/formItem'; | 7 | export * from './src/types/formItem'; |
6 | 8 | ||
7 | export { useComponentRegister } from './src/hooks/useComponentRegister'; | 9 | export { useComponentRegister } from './src/hooks/useComponentRegister'; |
8 | export { useForm } from './src/hooks/useForm'; | 10 | export { useForm } from './src/hooks/useForm'; |
9 | 11 | ||
10 | -export const BasicForm = withInstall(BasicFormLib); | 12 | +export { BasicForm }; |
src/components/Loading/index.ts
1 | import './src/indicator'; | 1 | import './src/indicator'; |
2 | -import LoadingLib from './src/index.vue'; | 2 | +import Loading from './src/index.vue'; |
3 | import { withInstall } from '../util'; | 3 | import { withInstall } from '../util'; |
4 | 4 | ||
5 | +withInstall(Loading); | ||
5 | export { useLoading } from './src/useLoading'; | 6 | export { useLoading } from './src/useLoading'; |
6 | export { createLoading } from './src/createLoading'; | 7 | export { createLoading } from './src/createLoading'; |
7 | 8 | ||
8 | -export const Loading = withInstall(LoadingLib); | 9 | +export { Loading }; |
src/components/Markdown/index.ts
1 | -import MarkDownLib from './src/index.vue'; | 1 | +import MarkDown from './src/index.vue'; |
2 | 2 | ||
3 | import { withInstall } from '../util'; | 3 | import { withInstall } from '../util'; |
4 | 4 | ||
5 | +withInstall(MarkDown); | ||
6 | + | ||
5 | export * from './src/types'; | 7 | export * from './src/types'; |
6 | 8 | ||
7 | -export const MarkDown = withInstall(MarkDownLib); | 9 | +export { MarkDown }; |
src/components/Menu/index.ts
src/components/Menu/src/BasicMenu.tsx
@@ -15,7 +15,6 @@ import { | @@ -15,7 +15,6 @@ import { | ||
15 | ComputedRef, | 15 | ComputedRef, |
16 | } from 'vue'; | 16 | } from 'vue'; |
17 | import { Menu } from 'ant-design-vue'; | 17 | import { Menu } from 'ant-design-vue'; |
18 | -import SearchInput from './SearchInput.vue'; | ||
19 | import MenuContent from './MenuContent'; | 18 | import MenuContent from './MenuContent'; |
20 | // import { ScrollContainer } from '/@/components/Container'; | 19 | // import { ScrollContainer } from '/@/components/Container'; |
21 | 20 | ||
@@ -24,8 +23,7 @@ import { ThemeEnum } from '/@/enums/appEnum'; | @@ -24,8 +23,7 @@ import { ThemeEnum } from '/@/enums/appEnum'; | ||
24 | 23 | ||
25 | import { appStore } from '/@/store/modules/app'; | 24 | import { appStore } from '/@/store/modules/app'; |
26 | 25 | ||
27 | -import { useSearchInput } from './hooks/useSearchInput'; | ||
28 | -import { useOpenKeys } from './hooks/useOpenKeys'; | 26 | +import { useOpenKeys } from './useOpenKeys'; |
29 | import { useRouter } from 'vue-router'; | 27 | import { useRouter } from 'vue-router'; |
30 | 28 | ||
31 | import { isFunction } from '/@/utils/is'; | 29 | import { isFunction } from '/@/utils/is'; |
@@ -43,51 +41,39 @@ export default defineComponent({ | @@ -43,51 +41,39 @@ export default defineComponent({ | ||
43 | emits: ['menuClick'], | 41 | emits: ['menuClick'], |
44 | setup(props, { slots, emit }) { | 42 | setup(props, { slots, emit }) { |
45 | const currentParentPath = ref(''); | 43 | const currentParentPath = ref(''); |
44 | + | ||
46 | const menuState = reactive<MenuState>({ | 45 | const menuState = reactive<MenuState>({ |
47 | defaultSelectedKeys: [], | 46 | defaultSelectedKeys: [], |
48 | mode: props.mode, | 47 | mode: props.mode, |
49 | theme: computed(() => props.theme) as ComputedRef<ThemeEnum>, | 48 | theme: computed(() => props.theme) as ComputedRef<ThemeEnum>, |
50 | openKeys: [], | 49 | openKeys: [], |
51 | - searchValue: '', | ||
52 | selectedKeys: [], | 50 | selectedKeys: [], |
53 | collapsedOpenKeys: [], | 51 | collapsedOpenKeys: [], |
54 | }); | 52 | }); |
55 | 53 | ||
56 | const { getCollapsed } = useMenuSetting(); | 54 | const { getCollapsed } = useMenuSetting(); |
57 | - const { currentRoute } = useRouter(); | ||
58 | 55 | ||
59 | - const { items, flatItems, isAppMenu, mode, accordion } = toRefs(props); | 56 | + const { currentRoute } = useRouter(); |
60 | 57 | ||
61 | - const { handleInputChange, handleInputClick } = useSearchInput({ | ||
62 | - flatMenusRef: flatItems, | ||
63 | - emit: emit, | ||
64 | - menuState, | ||
65 | - handleMenuChange, | ||
66 | - }); | 58 | + const { items, flatItems, mode, accordion } = toRefs(props); |
67 | 59 | ||
68 | const { handleOpenChange, resetKeys, setOpenKeys } = useOpenKeys( | 60 | const { handleOpenChange, resetKeys, setOpenKeys } = useOpenKeys( |
69 | menuState, | 61 | menuState, |
70 | items, | 62 | items, |
71 | flatItems, | 63 | flatItems, |
72 | - isAppMenu, | ||
73 | mode, | 64 | mode, |
74 | accordion | 65 | accordion |
75 | ); | 66 | ); |
76 | 67 | ||
77 | const getOpenKeys = computed(() => { | 68 | const getOpenKeys = computed(() => { |
78 | - if (props.isAppMenu) { | ||
79 | - return unref(getCollapsed) ? menuState.collapsedOpenKeys : menuState.openKeys; | ||
80 | - } | ||
81 | - return menuState.openKeys; | 69 | + return unref(getCollapsed) ? menuState.collapsedOpenKeys : menuState.openKeys; |
82 | }); | 70 | }); |
83 | 71 | ||
84 | // menu外层样式 | 72 | // menu外层样式 |
85 | const getMenuWrapStyle = computed((): any => { | 73 | const getMenuWrapStyle = computed((): any => { |
86 | - const { showLogo, search } = props; | 74 | + const { showLogo } = props; |
87 | let offset = 0; | 75 | let offset = 0; |
88 | - if (search) { | ||
89 | - offset += 54; | ||
90 | - } | 76 | + |
91 | if (showLogo) { | 77 | if (showLogo) { |
92 | offset += 46; | 78 | offset += 46; |
93 | } | 79 | } |
@@ -110,7 +96,7 @@ export default defineComponent({ | @@ -110,7 +96,7 @@ export default defineComponent({ | ||
110 | cls.push('basic-menu__sidebar-hor'); | 96 | cls.push('basic-menu__sidebar-hor'); |
111 | } | 97 | } |
112 | 98 | ||
113 | - if (!props.isHorizontal && props.isAppMenu && appStore.getProjectConfig.menuSetting.split) { | 99 | + if (!props.isHorizontal && appStore.getProjectConfig.menuSetting.split) { |
114 | cls.push('basic-menu__second'); | 100 | cls.push('basic-menu__second'); |
115 | } | 101 | } |
116 | return cls; | 102 | return cls; |
@@ -197,7 +183,6 @@ export default defineComponent({ | @@ -197,7 +183,6 @@ export default defineComponent({ | ||
197 | level={index} | 183 | level={index} |
198 | isHorizontal={props.isHorizontal} | 184 | isHorizontal={props.isHorizontal} |
199 | showTitle={unref(showTitle)} | 185 | showTitle={unref(showTitle)} |
200 | - searchValue={menuState.searchValue} | ||
201 | />, | 186 | />, |
202 | ]} | 187 | ]} |
203 | </Menu.Item> | 188 | </Menu.Item> |
@@ -212,7 +197,6 @@ export default defineComponent({ | @@ -212,7 +197,6 @@ export default defineComponent({ | ||
212 | item={menu} | 197 | item={menu} |
213 | level={index} | 198 | level={index} |
214 | isHorizontal={props.isHorizontal} | 199 | isHorizontal={props.isHorizontal} |
215 | - searchValue={menuState.searchValue} | ||
216 | />, | 200 | />, |
217 | ], | 201 | ], |
218 | default: () => renderMenuItem(menu.children, index + 1), | 202 | default: () => renderMenuItem(menu.children, index + 1), |
@@ -227,11 +211,9 @@ export default defineComponent({ | @@ -227,11 +211,9 @@ export default defineComponent({ | ||
227 | const { selectedKeys, defaultSelectedKeys, mode, theme } = menuState; | 211 | const { selectedKeys, defaultSelectedKeys, mode, theme } = menuState; |
228 | 212 | ||
229 | const inlineCollapsedObj = isInline | 213 | const inlineCollapsedObj = isInline |
230 | - ? props.isAppMenu | ||
231 | - ? { | ||
232 | - inlineCollapsed: unref(getCollapsed), | ||
233 | - } | ||
234 | - : { inlineCollapsed: props.inlineCollapsed } | 214 | + ? { |
215 | + inlineCollapsed: unref(getCollapsed), | ||
216 | + } | ||
235 | : {}; | 217 | : {}; |
236 | return ( | 218 | return ( |
237 | <Menu | 219 | <Menu |
@@ -267,17 +249,8 @@ export default defineComponent({ | @@ -267,17 +249,8 @@ export default defineComponent({ | ||
267 | ) : ( | 249 | ) : ( |
268 | <section class={[`basic-menu-wrap`, !unref(showTitle) && 'hide-title']}> | 250 | <section class={[`basic-menu-wrap`, !unref(showTitle) && 'hide-title']}> |
269 | {getSlot(slots, 'header')} | 251 | {getSlot(slots, 'header')} |
270 | - <SearchInput | ||
271 | - class={!props.search ? 'hidden' : ''} | ||
272 | - theme={props.theme as ThemeEnum} | ||
273 | - onChange={handleInputChange} | ||
274 | - onClick={handleInputClick} | ||
275 | - collapsed={unref(getCollapsed)} | ||
276 | - /> | ||
277 | 252 | ||
278 | - {/* <section style={unref(getMenuWrapStyle)}> */} | ||
279 | <section style={unref(getMenuWrapStyle)} class="basic-menu__content"> | 253 | <section style={unref(getMenuWrapStyle)} class="basic-menu__content"> |
280 | - {/* <ScrollContainer>{() => renderMenu()}</ScrollContainer> */} | ||
281 | {renderMenu()} | 254 | {renderMenu()} |
282 | </section> | 255 | </section> |
283 | </section> | 256 | </section> |
src/components/Menu/src/BasicMenu.vue
0 → 100644
src/components/Menu/src/MenuContent.tsx
@@ -8,11 +8,6 @@ import { useI18n } from '/@/hooks/web/useI18n'; | @@ -8,11 +8,6 @@ import { useI18n } from '/@/hooks/web/useI18n'; | ||
8 | export default defineComponent({ | 8 | export default defineComponent({ |
9 | name: 'MenuContent', | 9 | name: 'MenuContent', |
10 | props: { | 10 | props: { |
11 | - searchValue: { | ||
12 | - type: String as PropType<string>, | ||
13 | - default: '', | ||
14 | - }, | ||
15 | - | ||
16 | item: { | 11 | item: { |
17 | type: Object as PropType<MenuType>, | 12 | type: Object as PropType<MenuType>, |
18 | default: null, | 13 | default: null, |
@@ -35,11 +30,7 @@ export default defineComponent({ | @@ -35,11 +30,7 @@ export default defineComponent({ | ||
35 | setup(props) { | 30 | setup(props) { |
36 | const { t } = useI18n(); | 31 | const { t } = useI18n(); |
37 | 32 | ||
38 | - const getI18nName = computed(() => { | ||
39 | - const { name } = props.item; | ||
40 | - | ||
41 | - return t(name); | ||
42 | - }); | 33 | + const getI18nName = computed(() => t(props.item?.name)); |
43 | /** | 34 | /** |
44 | * @description: 渲染图标 | 35 | * @description: 渲染图标 |
45 | */ | 36 | */ |
@@ -71,28 +62,18 @@ export default defineComponent({ | @@ -71,28 +62,18 @@ export default defineComponent({ | ||
71 | const { showTitle } = props; | 62 | const { showTitle } = props; |
72 | const { icon } = props.item; | 63 | const { icon } = props.item; |
73 | const name = unref(getI18nName); | 64 | const name = unref(getI18nName); |
74 | - const searchValue = props.searchValue || ''; | ||
75 | - const index = name.indexOf(searchValue); | ||
76 | 65 | ||
77 | - const beforeStr = name.substr(0, index); | ||
78 | - const afterStr = name.substr(index + searchValue.length); | ||
79 | const cls = showTitle ? ['show-title'] : ['basic-menu__name']; | 66 | const cls = showTitle ? ['show-title'] : ['basic-menu__name']; |
80 | 67 | ||
81 | return ( | 68 | return ( |
82 | <> | 69 | <> |
83 | {renderIcon(icon!)} | 70 | {renderIcon(icon!)} |
84 | - {index > -1 && searchValue ? ( | ||
85 | - <span class={cls}> | ||
86 | - {beforeStr} | ||
87 | - <span class={`basic-menu__keyword`}>{searchValue}</span> | ||
88 | - {afterStr} | ||
89 | - </span> | ||
90 | - ) : ( | 71 | + { |
91 | <span class={[cls]}> | 72 | <span class={[cls]}> |
92 | {name} | 73 | {name} |
93 | {renderTag()} | 74 | {renderTag()} |
94 | </span> | 75 | </span> |
95 | - )} | 76 | + } |
96 | </> | 77 | </> |
97 | ); | 78 | ); |
98 | }; | 79 | }; |
src/components/Menu/src/SearchInput.vue deleted
100644 → 0
1 | -<template> | ||
2 | - <section class="menu-search-input" @Click="handleClick" :class="searchClass"> | ||
3 | - <a-input-search | ||
4 | - :placeholder="t('component.menu.search')" | ||
5 | - class="menu-search-input__search" | ||
6 | - allowClear | ||
7 | - @change="handleChange" | ||
8 | - /> | ||
9 | - </section> | ||
10 | -</template> | ||
11 | -<script lang="ts"> | ||
12 | - import type { PropType } from 'vue'; | ||
13 | - import { defineComponent, computed } from 'vue'; | ||
14 | - import { ThemeEnum } from '/@/enums/appEnum'; | ||
15 | - // hook | ||
16 | - import { useDebounce } from '/@/hooks/core/useDebounce'; | ||
17 | - import { useI18n } from '/@/hooks/web/useI18n'; | ||
18 | - // | ||
19 | - export default defineComponent({ | ||
20 | - name: 'BasicMenuSearchInput', | ||
21 | - props: { | ||
22 | - // Whether to expand, used in the left menu | ||
23 | - collapsed: { | ||
24 | - type: Boolean as PropType<boolean>, | ||
25 | - default: true, | ||
26 | - }, | ||
27 | - theme: { | ||
28 | - type: String as PropType<ThemeEnum>, | ||
29 | - }, | ||
30 | - }, | ||
31 | - setup(props, { emit }) { | ||
32 | - const { t } = useI18n(); | ||
33 | - | ||
34 | - const [debounceEmitChange] = useDebounce(emitChange, 200); | ||
35 | - | ||
36 | - function emitChange(value?: string): void { | ||
37 | - emit('change', value); | ||
38 | - } | ||
39 | - | ||
40 | - function handleChange(e: ChangeEvent): void { | ||
41 | - const { collapsed } = props; | ||
42 | - if (collapsed) return; | ||
43 | - debounceEmitChange(e.target.value); | ||
44 | - } | ||
45 | - | ||
46 | - function handleClick(): void { | ||
47 | - emit('click'); | ||
48 | - } | ||
49 | - | ||
50 | - const searchClass = computed(() => { | ||
51 | - const cls: string[] = []; | ||
52 | - cls.push(props.theme ? `menu-search-input__search--${props.theme}` : ''); | ||
53 | - cls.push(props.collapsed ? 'hide-search-icon' : ''); | ||
54 | - return cls; | ||
55 | - }); | ||
56 | - | ||
57 | - return { handleClick, searchClass, handleChange, t }; | ||
58 | - }, | ||
59 | - }); | ||
60 | -</script> | ||
61 | -<style lang="less"> | ||
62 | - @import (reference) '../../../design/index.less'; | ||
63 | - // 输入框背景颜色 深 | ||
64 | - @input-dark-bg-color: #516085; | ||
65 | - | ||
66 | - @icon-color: #c0c4cc; | ||
67 | - | ||
68 | - .menu-search-input { | ||
69 | - margin: 12px 8px; | ||
70 | - | ||
71 | - &.hide-search-icon { | ||
72 | - .ant-input, | ||
73 | - .ant-input-suffix { | ||
74 | - opacity: 0; | ||
75 | - transition: all 0.5s; | ||
76 | - } | ||
77 | - } | ||
78 | - | ||
79 | - &__search--dark { | ||
80 | - .ant-input-affix-wrapper, | ||
81 | - .ant-input { | ||
82 | - .set-bg(); | ||
83 | - } | ||
84 | - | ||
85 | - .ant-input-search-icon, | ||
86 | - .ant-input-clear-icon { | ||
87 | - color: rgba(255, 255, 255, 0.4) !important; | ||
88 | - } | ||
89 | - } | ||
90 | - | ||
91 | - &__search--light { | ||
92 | - .ant-input-affix-wrapper, | ||
93 | - .ant-input { | ||
94 | - color: @text-color-base; | ||
95 | - background: #fff; | ||
96 | - outline: none; | ||
97 | - } | ||
98 | - | ||
99 | - .ant-input-search-icon { | ||
100 | - color: @icon-color; | ||
101 | - } | ||
102 | - } | ||
103 | - } | ||
104 | - | ||
105 | - .set-bg() { | ||
106 | - color: #fff; | ||
107 | - background: @sider-dark-lighten-1-bg-color; | ||
108 | - border: 0; | ||
109 | - outline: none; | ||
110 | - } | ||
111 | - .hide-outline() { | ||
112 | - border: none; | ||
113 | - outline: none; | ||
114 | - box-shadow: none; | ||
115 | - } | ||
116 | -</style> |
src/components/Menu/src/hooks/useSearchInput.ts deleted
100644 → 0
1 | -import type { Menu as MenuType } from '/@/router/types'; | ||
2 | -import type { MenuState } from '../types'; | ||
3 | -import type { Ref } from 'vue'; | ||
4 | - | ||
5 | -import { isString } from '/@/utils/is'; | ||
6 | -import { unref } from 'vue'; | ||
7 | -import { es6Unique } from '/@/utils'; | ||
8 | -import { getAllParentPath } from '/@/router/helper/menuHelper'; | ||
9 | - | ||
10 | -interface UseSearchInputOptions { | ||
11 | - menuState: MenuState; | ||
12 | - flatMenusRef: Ref<MenuType[]>; | ||
13 | - emit: EmitType; | ||
14 | - handleMenuChange: Fn; | ||
15 | -} | ||
16 | -export function useSearchInput({ | ||
17 | - menuState, | ||
18 | - flatMenusRef, | ||
19 | - handleMenuChange, | ||
20 | - emit, | ||
21 | -}: UseSearchInputOptions) { | ||
22 | - /** | ||
23 | - * @description: 输入框搜索 | ||
24 | - */ | ||
25 | - function handleInputChange(value?: string): void { | ||
26 | - if (!isString(value)) { | ||
27 | - value = (value as any).target.value; | ||
28 | - } | ||
29 | - if (!value) { | ||
30 | - handleMenuChange && handleMenuChange(); | ||
31 | - } | ||
32 | - | ||
33 | - menuState.searchValue = value || ''; | ||
34 | - if (!value) { | ||
35 | - menuState.openKeys = []; | ||
36 | - return; | ||
37 | - } | ||
38 | - | ||
39 | - const flatMenus = unref(flatMenusRef); | ||
40 | - let openKeys: string[] = []; | ||
41 | - for (const menu of flatMenus) { | ||
42 | - const { name, path } = menu; | ||
43 | - if (!name.includes(value)) { | ||
44 | - continue; | ||
45 | - } | ||
46 | - openKeys = openKeys.concat(getAllParentPath(flatMenus, path)); | ||
47 | - } | ||
48 | - openKeys = es6Unique(openKeys); | ||
49 | - menuState.openKeys = openKeys; | ||
50 | - } | ||
51 | - | ||
52 | - // 搜索框点击 | ||
53 | - function handleInputClick(e: any): void { | ||
54 | - emit('clickSearchInput', e); | ||
55 | - } | ||
56 | - | ||
57 | - return { handleInputChange, handleInputClick }; | ||
58 | -} |
src/components/Menu/src/props.ts
@@ -20,11 +20,7 @@ export const basicProps = { | @@ -20,11 +20,7 @@ export const basicProps = { | ||
20 | type: Boolean as PropType<boolean>, | 20 | type: Boolean as PropType<boolean>, |
21 | default: false, | 21 | default: false, |
22 | }, | 22 | }, |
23 | - // 是否显示搜索框 | ||
24 | - search: { | ||
25 | - type: Boolean as PropType<boolean>, | ||
26 | - default: true, | ||
27 | - }, | 23 | + |
28 | // 最好是4 倍数 | 24 | // 最好是4 倍数 |
29 | inlineIndent: { | 25 | inlineIndent: { |
30 | type: Number as PropType<number>, | 26 | type: Number as PropType<number>, |
@@ -51,10 +47,7 @@ export const basicProps = { | @@ -51,10 +47,7 @@ export const basicProps = { | ||
51 | type: Boolean as PropType<boolean>, | 47 | type: Boolean as PropType<boolean>, |
52 | default: false, | 48 | default: false, |
53 | }, | 49 | }, |
54 | - isAppMenu: { | ||
55 | - type: Boolean as PropType<boolean>, | ||
56 | - default: true, | ||
57 | - }, | 50 | + |
58 | isHorizontal: { | 51 | isHorizontal: { |
59 | type: Boolean as PropType<boolean>, | 52 | type: Boolean as PropType<boolean>, |
60 | default: false, | 53 | default: false, |
src/components/Menu/src/types.ts
@@ -17,9 +17,6 @@ export interface MenuState { | @@ -17,9 +17,6 @@ export interface MenuState { | ||
17 | // 展开数组 | 17 | // 展开数组 |
18 | openKeys: string[]; | 18 | openKeys: string[]; |
19 | 19 | ||
20 | - // 搜索值 | ||
21 | - searchValue: string; | ||
22 | - | ||
23 | // 当前选中的菜单项 key 数组 | 20 | // 当前选中的菜单项 key 数组 |
24 | selectedKeys: string[]; | 21 | selectedKeys: string[]; |
25 | 22 |
src/components/Menu/src/hooks/useOpenKeys.ts renamed to src/components/Menu/src/useOpenKeys.ts
1 | import { MenuModeEnum } from '/@/enums/menuEnum'; | 1 | import { MenuModeEnum } from '/@/enums/menuEnum'; |
2 | import type { Menu as MenuType } from '/@/router/types'; | 2 | import type { Menu as MenuType } from '/@/router/types'; |
3 | -import type { MenuState } from '../types'; | 3 | +import type { MenuState } from './types'; |
4 | import type { Ref } from 'vue'; | 4 | import type { Ref } from 'vue'; |
5 | 5 | ||
6 | import { unref } from 'vue'; | 6 | import { unref } from 'vue'; |
@@ -12,14 +12,11 @@ export function useOpenKeys( | @@ -12,14 +12,11 @@ export function useOpenKeys( | ||
12 | menuState: MenuState, | 12 | menuState: MenuState, |
13 | menus: Ref<MenuType[]>, | 13 | menus: Ref<MenuType[]>, |
14 | flatMenusRef: Ref<MenuType[]>, | 14 | flatMenusRef: Ref<MenuType[]>, |
15 | - isAppMenu: Ref<boolean>, | ||
16 | mode: Ref<MenuModeEnum>, | 15 | mode: Ref<MenuModeEnum>, |
17 | accordion: Ref<boolean> | 16 | accordion: Ref<boolean> |
18 | ) { | 17 | ) { |
19 | const { getCollapsed } = useMenuSetting(); | 18 | const { getCollapsed } = useMenuSetting(); |
20 | - /** | ||
21 | - * @description:设置展开 | ||
22 | - */ | 19 | + |
23 | function setOpenKeys(menu: MenuType) { | 20 | function setOpenKeys(menu: MenuType) { |
24 | const flatMenus = unref(flatMenusRef); | 21 | const flatMenus = unref(flatMenusRef); |
25 | if (!unref(accordion)) { | 22 | if (!unref(accordion)) { |
@@ -50,7 +47,7 @@ export function useOpenKeys( | @@ -50,7 +47,7 @@ export function useOpenKeys( | ||
50 | rootSubMenuKeys.push(path); | 47 | rootSubMenuKeys.push(path); |
51 | } | 48 | } |
52 | } | 49 | } |
53 | - if (!unref(getCollapsed) || !unref(isAppMenu)) { | 50 | + if (!unref(getCollapsed)) { |
54 | const latestOpenKey = openKeys.find((key) => menuState.openKeys.indexOf(key) === -1); | 51 | const latestOpenKey = openKeys.find((key) => menuState.openKeys.indexOf(key) === -1); |
55 | if (rootSubMenuKeys.indexOf(latestOpenKey as string) === -1) { | 52 | if (rootSubMenuKeys.indexOf(latestOpenKey as string) === -1) { |
56 | menuState.openKeys = openKeys; | 53 | menuState.openKeys = openKeys; |
src/components/Modal/index.ts
1 | import './src/index.less'; | 1 | import './src/index.less'; |
2 | -import BasicModalLib from './src/BasicModal'; | 2 | +import BasicModal from './src/BasicModal'; |
3 | import { withInstall } from '../util'; | 3 | import { withInstall } from '../util'; |
4 | 4 | ||
5 | +withInstall(BasicModal); | ||
6 | + | ||
5 | export { useModalContext } from './src/useModalContext'; | 7 | export { useModalContext } from './src/useModalContext'; |
6 | export { useModal, useModalInner } from './src/useModal'; | 8 | export { useModal, useModalInner } from './src/useModal'; |
7 | export * from './src/types'; | 9 | export * from './src/types'; |
8 | -export const BasicModal = withInstall(BasicModalLib); | 10 | +export { BasicModal }; |
src/components/Page/index.ts
src/components/StrengthMeter/index.tsx
src/components/Tinymce/index.ts
src/components/Upload/index.ts
1 | -import type { App } from 'vue'; | ||
2 | import BasicUpload from './src/BasicUpload.vue'; | 1 | import BasicUpload from './src/BasicUpload.vue'; |
2 | +import { withInstall } from '../util'; | ||
3 | 3 | ||
4 | -export default (app: App): void => { | ||
5 | - app.component(BasicUpload.name, BasicUpload); | ||
6 | -}; | ||
7 | - | 4 | +withInstall(BasicUpload); |
8 | export { BasicUpload }; | 5 | export { BasicUpload }; |
src/components/Verify/index.ts
1 | -import BasicDragVerifyLib from './src/DragVerify'; | ||
2 | -import RotateDragVerifyLib from './src/ImgRotate'; | 1 | +import BasicDragVerify from './src/DragVerify'; |
2 | +import RotateDragVerify from './src/ImgRotate'; | ||
3 | import { withInstall } from '../util'; | 3 | import { withInstall } from '../util'; |
4 | 4 | ||
5 | +withInstall(BasicDragVerify, RotateDragVerify); | ||
6 | + | ||
5 | export * from './src/types'; | 7 | export * from './src/types'; |
6 | 8 | ||
7 | -export const RotateDragVerify = withInstall(RotateDragVerifyLib); | ||
8 | -export const BasicDragVerify = withInstall(BasicDragVerifyLib); | 9 | +export { BasicDragVerify, RotateDragVerify }; |
src/components/VirtualScroll/index.ts
src/components/util.ts
1 | -import type { VNodeChild, Plugin } from 'vue'; | 1 | +import type { VNodeChild } from 'vue'; |
2 | import type { App } from 'vue'; | 2 | import type { App } from 'vue'; |
3 | 3 | ||
4 | -export function withInstall<T>(component: T) { | ||
5 | - const comp = component as any; | ||
6 | - comp.install = (app: App) => { | ||
7 | - app.component(comp.displayName || comp.name, comp); | ||
8 | - }; | ||
9 | - return comp as T & Plugin; | 4 | +export function withInstall(...components: any[]) { |
5 | + components.forEach((comp) => { | ||
6 | + comp.install = (app: App) => { | ||
7 | + app.component(comp.displayName || comp.name, comp); | ||
8 | + }; | ||
9 | + }); | ||
10 | } | 10 | } |
11 | 11 | ||
12 | export function convertToUnit( | 12 | export function convertToUnit( |
src/design/var/index.less
src/hooks/core/useContext.ts
1 | -import { InjectionKey, provide, inject, reactive, readonly } from 'vue'; | 1 | +import { |
2 | + InjectionKey, | ||
3 | + provide, | ||
4 | + inject, | ||
5 | + reactive, | ||
6 | + readonly as defineReadonly, | ||
7 | + defineComponent, | ||
8 | + UnwrapRef, | ||
9 | +} from 'vue'; | ||
2 | 10 | ||
3 | -export const createContext = <T>( | ||
4 | - context: any, | ||
5 | - contextInjectKey: InjectionKey<T> = Symbol(), | ||
6 | - _readonly = true | ||
7 | -) => { | ||
8 | - const state = reactive({ ...context }); | 11 | +export interface CreateContextOptions { |
12 | + readonly?: boolean; | ||
13 | + createProvider?: boolean; | ||
14 | +} | ||
9 | 15 | ||
10 | - const provideData = _readonly ? readonly(state) : state; | ||
11 | - provide(contextInjectKey, provideData); | 16 | +type ShallowUnwrap<T> = { |
17 | + [P in keyof T]: UnwrapRef<T[P]>; | ||
12 | }; | 18 | }; |
13 | 19 | ||
20 | +export function createContext<T>( | ||
21 | + context: any, | ||
22 | + key: InjectionKey<T> = Symbol(), | ||
23 | + options: CreateContextOptions = {} | ||
24 | +) { | ||
25 | + const { readonly = true, createProvider = false } = options; | ||
26 | + | ||
27 | + const state = reactive(context); | ||
28 | + | ||
29 | + const provideData = readonly ? defineReadonly(state) : state; | ||
30 | + !createProvider && provide(key, provideData); | ||
31 | + | ||
32 | + const Provider = createProvider | ||
33 | + ? defineComponent({ | ||
34 | + name: 'Provider', | ||
35 | + inheritAttrs: false, | ||
36 | + setup(_, { slots }) { | ||
37 | + provide(key, provideData); | ||
38 | + return () => slots.default?.(); | ||
39 | + }, | ||
40 | + }) | ||
41 | + : null; | ||
42 | + | ||
43 | + return { Provider, state }; | ||
44 | +} | ||
45 | + | ||
14 | export const useContext = <T>( | 46 | export const useContext = <T>( |
15 | - contextInjectKey: InjectionKey<T> = Symbol(), | 47 | + key: InjectionKey<T> = Symbol(), |
16 | defaultValue?: any, | 48 | defaultValue?: any, |
17 | - _readonly = true | ||
18 | -): T => { | ||
19 | - const state = inject(contextInjectKey, defaultValue || {}); | ||
20 | - return _readonly ? readonly(state) : state; | 49 | + readonly = false |
50 | +): ShallowUnwrap<T> => { | ||
51 | + const state = inject(key, defaultValue || {}); | ||
52 | + | ||
53 | + return readonly ? defineReadonly(state) : state; | ||
21 | }; | 54 | }; |
src/hooks/setting/useMenuSetting.ts
@@ -39,8 +39,6 @@ export function useMenuSetting() { | @@ -39,8 +39,6 @@ export function useMenuSetting() { | ||
39 | 39 | ||
40 | const getCollapsedShowTitle = computed(() => unref(getMenuSetting).collapsedShowTitle); | 40 | const getCollapsedShowTitle = computed(() => unref(getMenuSetting).collapsedShowTitle); |
41 | 41 | ||
42 | - const getCollapsedShowSearch = computed(() => unref(getMenuSetting).collapsedShowSearch); | ||
43 | - | ||
44 | const getTopMenuAlign = computed(() => unref(getMenuSetting).topMenuAlign); | 42 | const getTopMenuAlign = computed(() => unref(getMenuSetting).topMenuAlign); |
45 | 43 | ||
46 | const getIsSidebarType = computed(() => unref(getMenuType) === MenuTypeEnum.SIDEBAR); | 44 | const getIsSidebarType = computed(() => unref(getMenuType) === MenuTypeEnum.SIDEBAR); |
@@ -63,13 +61,6 @@ export function useMenuSetting() { | @@ -63,13 +61,6 @@ export function useMenuSetting() { | ||
63 | return unref(getTrigger) === TriggerEnum.HEADER; | 61 | return unref(getTrigger) === TriggerEnum.HEADER; |
64 | }); | 62 | }); |
65 | 63 | ||
66 | - const getShowSearch = computed(() => { | ||
67 | - return ( | ||
68 | - unref(getMenuSetting).showSearch && | ||
69 | - !(unref(getMenuType) === MenuTypeEnum.MIX && unref(getMenuMode) === MenuModeEnum.HORIZONTAL) | ||
70 | - ); | ||
71 | - }); | ||
72 | - | ||
73 | const getIsHorizontal = computed(() => { | 64 | const getIsHorizontal = computed(() => { |
74 | return unref(getMenuMode) === MenuModeEnum.HORIZONTAL; | 65 | return unref(getMenuMode) === MenuModeEnum.HORIZONTAL; |
75 | }); | 66 | }); |
@@ -119,9 +110,7 @@ export function useMenuSetting() { | @@ -119,9 +110,7 @@ export function useMenuSetting() { | ||
119 | getMenuTheme, | 110 | getMenuTheme, |
120 | getCanDrag, | 111 | getCanDrag, |
121 | getIsHorizontal, | 112 | getIsHorizontal, |
122 | - getShowSearch, | ||
123 | getCollapsedShowTitle, | 113 | getCollapsedShowTitle, |
124 | - getCollapsedShowSearch, | ||
125 | getIsSidebarType, | 114 | getIsSidebarType, |
126 | getAccordion, | 115 | getAccordion, |
127 | getShowTopMenu, | 116 | getShowTopMenu, |
src/hooks/web/useDesign.ts
0 → 100644
1 | +import { useAppProviderContext } from '/@/components/Application'; | ||
2 | +import { computed } from 'vue'; | ||
3 | +// import { useCssModule, reactive } from 'vue'; | ||
4 | +export function useDesign(scope: string) { | ||
5 | + const values = useAppProviderContext(); | ||
6 | + // const style = cssModule ? useCssModule() : {}; | ||
7 | + | ||
8 | + // if (cssModule) { | ||
9 | + // Object.keys(style).forEach((key) => { | ||
10 | + // const moduleCls = style[key]; | ||
11 | + // style[key] = `${cls}-${moduleCls}`; | ||
12 | + // }); | ||
13 | + // } | ||
14 | + return { | ||
15 | + prefixCls: computed(() => `${values.prefixCls}-${scope}`), | ||
16 | + prefixVar: values.prefixCls, | ||
17 | + // style, | ||
18 | + }; | ||
19 | +} |
src/hooks/web/useLocale.ts
@@ -27,7 +27,6 @@ export function useLocale() { | @@ -27,7 +27,6 @@ export function useLocale() { | ||
27 | setLocalSetting({ lang }); | 27 | setLocalSetting({ lang }); |
28 | // i18n.global.setLocaleMessage(locale, messages); | 28 | // i18n.global.setLocaleMessage(locale, messages); |
29 | 29 | ||
30 | - antConfigLocaleRef.value = { a: 1 }; | ||
31 | switch (lang) { | 30 | switch (lang) { |
32 | // Simplified Chinese | 31 | // Simplified Chinese |
33 | case 'zh_CN': | 32 | case 'zh_CN': |
src/layouts/default/header/LayoutHeader.tsx
@@ -188,7 +188,6 @@ export default defineComponent({ | @@ -188,7 +188,6 @@ export default defineComponent({ | ||
188 | theme={unref(getHeaderTheme)} | 188 | theme={unref(getHeaderTheme)} |
189 | splitType={unref(getSplitType)} | 189 | splitType={unref(getSplitType)} |
190 | menuMode={unref(getMenuMode)} | 190 | menuMode={unref(getMenuMode)} |
191 | - showSearch={false} | ||
192 | /> | 191 | /> |
193 | </div> | 192 | </div> |
194 | )} | 193 | )} |
src/layouts/default/menu/index.tsx
@@ -27,9 +27,6 @@ export default defineComponent({ | @@ -27,9 +27,6 @@ export default defineComponent({ | ||
27 | default: MenuSplitTyeEnum.NONE, | 27 | default: MenuSplitTyeEnum.NONE, |
28 | }, | 28 | }, |
29 | 29 | ||
30 | - // Whether to show search box | ||
31 | - showSearch: propTypes.bool.def(true), | ||
32 | - | ||
33 | isHorizontal: propTypes.bool, | 30 | isHorizontal: propTypes.bool, |
34 | // menu Mode | 31 | // menu Mode |
35 | menuMode: { | 32 | menuMode: { |
@@ -42,11 +39,9 @@ export default defineComponent({ | @@ -42,11 +39,9 @@ export default defineComponent({ | ||
42 | 39 | ||
43 | const { | 40 | const { |
44 | setMenuSetting, | 41 | setMenuSetting, |
45 | - getShowSearch, | ||
46 | getMenuMode, | 42 | getMenuMode, |
47 | getMenuType, | 43 | getMenuType, |
48 | getCollapsedShowTitle, | 44 | getCollapsedShowTitle, |
49 | - getCollapsedShowSearch, | ||
50 | getIsSidebarType, | 45 | getIsSidebarType, |
51 | getMenuTheme, | 46 | getMenuTheme, |
52 | getCollapsed, | 47 | getCollapsed, |
@@ -65,14 +60,6 @@ export default defineComponent({ | @@ -65,14 +60,6 @@ export default defineComponent({ | ||
65 | 60 | ||
66 | const appendClass = computed(() => props.splitType === MenuSplitTyeEnum.TOP); | 61 | const appendClass = computed(() => props.splitType === MenuSplitTyeEnum.TOP); |
67 | 62 | ||
68 | - const showSearch = computed(() => { | ||
69 | - return ( | ||
70 | - unref(getShowSearch) && | ||
71 | - props.showSearch && | ||
72 | - (unref(getCollapsedShowSearch) ? true : !unref(getCollapsed)) | ||
73 | - ); | ||
74 | - }); | ||
75 | - | ||
76 | /** | 63 | /** |
77 | * click menu | 64 | * click menu |
78 | * @param menu | 65 | * @param menu |
@@ -122,7 +109,6 @@ export default defineComponent({ | @@ -122,7 +109,6 @@ export default defineComponent({ | ||
122 | collapsedShowTitle={unref(getCollapsedShowTitle)} | 109 | collapsedShowTitle={unref(getCollapsedShowTitle)} |
123 | theme={unref(getComputedMenuTheme)} | 110 | theme={unref(getComputedMenuTheme)} |
124 | showLogo={unref(showLogo)} | 111 | showLogo={unref(showLogo)} |
125 | - search={unref(showSearch)} | ||
126 | items={unref(menusRef)} | 112 | items={unref(menusRef)} |
127 | flatItems={unref(flatMenusRef)} | 113 | flatItems={unref(flatMenusRef)} |
128 | accordion={unref(getAccordion)} | 114 | accordion={unref(getAccordion)} |
src/layouts/default/setting/enum.ts
src/layouts/default/setting/handler.ts
@@ -63,9 +63,6 @@ export function handler(event: HandlerEnum, value: any): DeepPartial<ProjectConf | @@ -63,9 +63,6 @@ export function handler(event: HandlerEnum, value: any): DeepPartial<ProjectConf | ||
63 | case HandlerEnum.MENU_FIXED: | 63 | case HandlerEnum.MENU_FIXED: |
64 | return { menuSetting: { fixed: value } }; | 64 | return { menuSetting: { fixed: value } }; |
65 | 65 | ||
66 | - case HandlerEnum.MENU_SHOW_SEARCH: | ||
67 | - return { menuSetting: { showSearch: value } }; | ||
68 | - | ||
69 | // ============transition================== | 66 | // ============transition================== |
70 | case HandlerEnum.OPEN_PAGE_LOADING: | 67 | case HandlerEnum.OPEN_PAGE_LOADING: |
71 | appStore.commitPageLoadingState(false); | 68 | appStore.commitPageLoadingState(false); |
src/layouts/default/sider/index.less
src/router/constant.ts
@@ -25,7 +25,6 @@ export const getParentLayout = (name: string) => { | @@ -25,7 +25,6 @@ export const getParentLayout = (name: string) => { | ||
25 | export const PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = { | 25 | export const PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = { |
26 | path: '/:path(.*)*', | 26 | path: '/:path(.*)*', |
27 | name: 'ErrorPage', | 27 | name: 'ErrorPage', |
28 | - redirect: '/error/404', | ||
29 | component: LAYOUT, | 28 | component: LAYOUT, |
30 | meta: { | 29 | meta: { |
31 | title: 'ErrorPage', | 30 | title: 'ErrorPage', |
@@ -33,7 +32,7 @@ export const PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = { | @@ -33,7 +32,7 @@ export const PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = { | ||
33 | }, | 32 | }, |
34 | children: [ | 33 | children: [ |
35 | { | 34 | { |
36 | - path: '/error/404', | 35 | + path: '/:path(.*)*', |
37 | name: 'ErrorPage', | 36 | name: 'ErrorPage', |
38 | component: EXCEPTION_COMPONENT, | 37 | component: EXCEPTION_COMPONENT, |
39 | meta: { | 38 | meta: { |
src/router/menus/index.ts
@@ -21,6 +21,9 @@ Object.keys(modules).forEach((key) => { | @@ -21,6 +21,9 @@ Object.keys(modules).forEach((key) => { | ||
21 | // =========================== | 21 | // =========================== |
22 | // ==========Helper=========== | 22 | // ==========Helper=========== |
23 | // =========================== | 23 | // =========================== |
24 | +const isBackMode = () => { | ||
25 | + return appStore.getProjectConfig.permissionMode === PermissionModeEnum.BACK; | ||
26 | +}; | ||
24 | 27 | ||
25 | const staticMenus: Menu[] = []; | 28 | const staticMenus: Menu[] = []; |
26 | (() => { | 29 | (() => { |
@@ -33,10 +36,6 @@ const staticMenus: Menu[] = []; | @@ -33,10 +36,6 @@ const staticMenus: Menu[] = []; | ||
33 | } | 36 | } |
34 | })(); | 37 | })(); |
35 | 38 | ||
36 | -const isBackMode = () => { | ||
37 | - return appStore.getProjectConfig.permissionMode === PermissionModeEnum.BACK; | ||
38 | -}; | ||
39 | - | ||
40 | async function getAsyncMenus() { | 39 | async function getAsyncMenus() { |
41 | // 前端角色控制菜单 直接取菜单文件 | 40 | // 前端角色控制菜单 直接取菜单文件 |
42 | if (!isBackMode()) { | 41 | if (!isBackMode()) { |
src/settings/colorSetting.ts
@@ -17,9 +17,11 @@ export const HEADER_PRESET_BG_COLOR_LIST: string[] = [ | @@ -17,9 +17,11 @@ export const HEADER_PRESET_BG_COLOR_LIST: string[] = [ | ||
17 | export const SIDE_BAR_BG_COLOR_LIST: string[] = [ | 17 | export const SIDE_BAR_BG_COLOR_LIST: string[] = [ |
18 | '#273352', | 18 | '#273352', |
19 | '#ffffff', | 19 | '#ffffff', |
20 | + '#191b24', | ||
20 | '#191a23', | 21 | '#191a23', |
21 | '#001529', | 22 | '#001529', |
22 | '#304156', | 23 | '#304156', |
24 | + '#001628', | ||
23 | '#28333E', | 25 | '#28333E', |
24 | '#344058', | 26 | '#344058', |
25 | ]; | 27 | ]; |
src/settings/projectSetting.ts
@@ -89,8 +89,6 @@ const setting: ProjectConfig = { | @@ -89,8 +89,6 @@ const setting: ProjectConfig = { | ||
89 | show: true, | 89 | show: true, |
90 | // Whether to show dom | 90 | // Whether to show dom |
91 | hidden: true, | 91 | hidden: true, |
92 | - // Whether to show search box | ||
93 | - showSearch: true, | ||
94 | // Menu width | 92 | // Menu width |
95 | menuWidth: 210, | 93 | menuWidth: 210, |
96 | // Menu mode | 94 | // Menu mode |
src/types/config.d.ts
@@ -9,7 +9,6 @@ export interface MenuSetting { | @@ -9,7 +9,6 @@ export interface MenuSetting { | ||
9 | collapsed: boolean; | 9 | collapsed: boolean; |
10 | collapsedShowTitle: boolean; | 10 | collapsedShowTitle: boolean; |
11 | canDrag: boolean; | 11 | canDrag: boolean; |
12 | - showSearch: boolean; | ||
13 | show: boolean; | 12 | show: boolean; |
14 | hidden: boolean; | 13 | hidden: boolean; |
15 | split: boolean; | 14 | split: boolean; |