version: 5.0.0

This commit is contained in:
XiaoDaiGua-Ray 2024-10-20 01:15:12 +08:00
parent 73792144a8
commit 2f42571b3b
156 changed files with 611 additions and 1714 deletions

View File

@ -1,5 +1,24 @@
# CHANGE LOG # CHANGE LOG
## 5.0.0
## Feats
- `RTable` 组件现在默认 `attrs` 透传不会再透传至 `Table` 而是透传至容器 `Card`
- `AppAvatar` 组件获取用户信息由 `localStorage` 缓存获取变更为 `getSigningCallback` 响应式获取
- 移除 `SUPER_ADMIN` 默认值
- 移除 `APP_KEEP_ALIVE` 配置项,迁移至 `settingStore`
- 移除 `SIDE_BAR_LOGO_DEFAULT` 配置项,迁移至 `settingStore`
- 移除 `APP_MENU_CONFIG` 配置项,迁移至 `settingStore`
- 移除所有的 `ray-template` 相关注释信息
- `SettingDrawer` 新增更多配置项,允许通过配置入口配置更多的配置项
- 新增 `DatePicker`, `InputNumber` 样式,默认设置 `width``100%`
- 新增 `updateObjectValue` 方法,并且全局替换重复类似方法
- `useTheme` 新增 `syncSystemTheme` 方法,允许同步系统主题
- 新增 `ThemeSegment` 主题切换组件
- 移除 `watchOnce` 方法引入,使用原生 `watch` 方法替代
- 取消 `SettingDrawer` 自动聚焦可选中元素
## 4.9.7 ## 4.9.7
从该版本开始,默认关闭了 `cdn` 构建生产环境;因为国内厂商真心不给力。 从该版本开始,默认关闭了 `cdn` 构建生产环境;因为国内厂商真心不给力。

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-08-11
*
* @workspace ray-template
*
* @remark
*/
import Mock from 'mockjs' import Mock from 'mockjs'
/** /**

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-08-11
*
* @workspace ray-template
*
* @remark
*/
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
export function array(length: number) { export function array(length: number) {

View File

@ -1,7 +1,7 @@
{ {
"name": "ray-template", "name": "ray-template",
"private": false, "private": false,
"version": "4.9.7", "version": "5.0.0",
"type": "module", "type": "module",
"engines": { "engines": {
"node": "^18.0.0 || >=20.0.0", "node": "^18.0.0 || >=20.0.0",

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-03-31
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* *

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-05-31
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* *
@ -17,17 +6,13 @@
* session catch * session catch
*/ */
import './index.scss'
import { NAvatar, NButton, NFlex } from 'naive-ui' import { NAvatar, NButton, NFlex } from 'naive-ui'
import { avatarProps } from 'naive-ui' import { avatarProps } from 'naive-ui'
import { APP_CATCH_KEY } from '@/app-config' import { useSigningGetters } from '@/store'
import { getStorage } from '@/utils'
import type { PropType } from 'vue' import type { PropType } from 'vue'
import type { AvatarProps, FlexProps } from 'naive-ui' import type { AvatarProps, FlexProps } from 'naive-ui'
import type { SigningCallback } from '@/store/modules/signing/types'
const AppAvatar = defineComponent({ const AppAvatar = defineComponent({
name: 'AppAvatar', name: 'AppAvatar',
@ -50,30 +35,27 @@ const AppAvatar = defineComponent({
default: false, default: false,
}, },
}, },
setup(props) { setup() {
const signing = getStorage<SigningCallback>( const { getSigningCallback } = useSigningGetters()
APP_CATCH_KEY.signing,
'localStorage',
)
return { return {
signing, getSigningCallback,
} }
}, },
render() { render() {
const { signing, avatarSize, spaceSize, $props, vertical } = this const { getSigningCallback, avatarSize, spaceSize, $props, vertical } = this
return ( return (
<NButton quaternary strong> <NButton quaternary strong>
<NFlex align="center" size={spaceSize} vertical={vertical}> <NFlex align="center" size={spaceSize} vertical={vertical}>
<NAvatar <NAvatar
{...($props as AvatarProps)} {...($props as AvatarProps)}
src={signing?.avatar} src={getSigningCallback?.avatar}
objectFit="cover" objectFit="cover"
round round
size={avatarSize} size={avatarSize}
/> />
{signing?.name} {getSigningCallback?.name}
</NFlex> </NFlex>
</NButton> </NButton>
) )

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-01-18
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* *

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-20
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* *

View File

@ -1,16 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-20
*
* @workspace ray-template
*
* @remark
*/
/** 锁屏界面 */
import { NInput, NForm, NFormItem, NButton } from 'naive-ui' import { NInput, NForm, NFormItem, NButton } from 'naive-ui'
import useAppLockScreen from '@/app-components/app/AppLockScreen/appLockVar' import useAppLockScreen from '@/app-components/app/AppLockScreen/appLockVar'

View File

@ -1,16 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-20
*
* @workspace ray-template
*
* @remark
*/
/** 解锁界面 */
import { NInput, NForm, NFormItem, NButton, NFlex } from 'naive-ui' import { NInput, NForm, NFormItem, NButton, NFlex } from 'naive-ui'
import AppAvatar from '@/app-components/app/AppAvatar' import AppAvatar from '@/app-components/app/AppAvatar'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-05-13
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* , * ,

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-20
*
* @workspace ray-template
*
* @remark
*/
import type { InputInst } from 'naive-ui' import type { InputInst } from 'naive-ui'
import type { Ref } from 'vue' import type { Ref } from 'vue'

View File

@ -1,8 +1,3 @@
/**
*
*
*/
import { NAvatar, NTooltip, NFlex } from 'naive-ui' import { NAvatar, NTooltip, NFlex } from 'naive-ui'
interface AvatarOptions { interface AvatarOptions {

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-14
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* naive ui * naive ui

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-07-21
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* *

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-07-08
*
* @workspace ray-template
*
* @remark
*/
import { get } from 'lodash-es' import { get } from 'lodash-es'
import { import {
setClass, setClass,

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2024-01-01
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* *

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-21
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* *

View File

@ -1,18 +1,4 @@
/** import type { AppMenuConfig, PreloadingConfig } from '@/types'
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-05-23
*
* @workspace ray-template
*
* @remark
*/
/** 系统配置 */
import type { LayoutSideBarLogo, PreloadingConfig } from '@/types'
import type { AppMenuConfig, AppKeepAlive } from '@/types'
import type { MessageProviderProps } from 'naive-ui' import type { MessageProviderProps } from 'naive-ui'
/** /**
@ -30,8 +16,9 @@ export const MESSAGE_PROVIDER: MessageProviderProps = {
/** /**
* *
* @description
* spin * spin
* *
* *
* v4.7.5 * v4.7.5
*/ */
@ -39,25 +26,11 @@ export const LAYOUT_CONTENT_SPIN_WHEN_ROUTE_CHANGE = false
/** /**
* *
* Spin * @description
* Spin
*/ */
export const APP_GLOBAL_LOADING = 'loading' export const APP_GLOBAL_LOADING = 'loading'
/**
*
*
*
* :
* - setupKeepAlive: 是否启用系统页面缓存, false
* - keepAliveExclude: 排除哪些页面不缓存
* - maxKeepAliveLength: 最大缓存页面数量
*/
export const APP_KEEP_ALIVE: Readonly<AppKeepAlive> = {
setupKeepAlive: true,
keepAliveExclude: [],
maxKeepAliveLength: 5,
}
/** /**
* *
* *
@ -71,61 +44,26 @@ export const PRE_LOADING_CONFIG: PreloadingConfig = {
/** /**
* *
* icon: LOGO `RIcon` ()4.8.2 VNode * @description
* title: LOGO * key
* url: 点击跳转地址 * key 使 getStorage setStorage key
* jumpType: 跳转类型(station: 项目内跳转 outsideStation: 新页面打开) * APP_CATCH_KEY 使
* *
* LOGO * cache.ts
*/
export const SIDE_BAR_LOGO_DEFAULT: LayoutSideBarLogo | undefined = {
icon: 'ray',
title: 'Ray Template',
url: '/dashboard',
jumpType: 'station',
}
/**
* *
* *
*
* menuCollapsedWidth menuCollapsedMode width
*
* menuCollapsedMode:
* - transform: 边栏将只会移动它的位置而不会改变宽度
* - width: Sider
* menuCollapsedIconSize
* menuCollapsedIndent
* menuAccordion
*/
export const APP_MENU_CONFIG: Readonly<AppMenuConfig> = {
menuCollapsedWidth: 64,
menuCollapsedMode: 'width',
menuCollapsedIconSize: 22,
menuCollapsedIndent: 24,
menuAccordion: false,
}
/**
*
* key
* key 使 getStorage setStorage key
* APP_CATCH_KEY 使
*
* cache.ts
*
*
* *
* @example * @example
* export const APP_CATCH_KEY_PREFIX = 'ray-template:' * export const APP_CATCH_KEY_PREFIX = 'ray-template:'
* *
* 'ray-template:signing' // 会自动拼接为 * key: ray-template:signing
*/ */
export const APP_CATCH_KEY_PREFIX = '' export const APP_CATCH_KEY_PREFIX = ''
/** /**
* *
* key * @description
* key
* *
* : * :
* - signing: 登陆信息缓存 key * - signing: 登陆信息缓存 key
@ -154,9 +92,10 @@ export const APP_CATCH_KEY = {
/** /**
* *
* * @description
* `transform` *
* : `transform-fade-bottom` * transform
* 例如: transform-fade-bottom
*/ */
export const CONTENT_TRANSITION_OPTIONS = [ export const CONTENT_TRANSITION_OPTIONS = [
{ {

View File

@ -1,16 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-05-19
*
* @workspace ray-template
*
* @remark
*/
/** 系统颜色风格配置入口 */
import type { AppTheme } from '@/types' import type { AppTheme } from '@/types'
export const APP_THEME: AppTheme = { export const APP_THEME: AppTheme = {

View File

@ -1,16 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-05-19
*
* @workspace ray-template
*
* @remark
*/
/** 国际化相关配置 */
import type { TemplateLocale, LocalOptions, DayjsLocalMap } from '@/types' import type { TemplateLocale, LocalOptions, DayjsLocalMap } from '@/types'
import type { ValueOf } from '@/types' import type { ValueOf } from '@/types'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-12
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* *

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-02
*
* @workspace ray-template
*
* @remark
*/
import type { AxiosConfig } from '@/types' import type { AxiosConfig } from '@/types'
/** axios 相关配置 */ /** axios 相关配置 */

View File

@ -1,16 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-05-19
*
* @workspace ray-template
*
* @remark
*/
/** vue-router 相关配置入口 */
import type { LayoutInst } from 'naive-ui' import type { LayoutInst } from 'naive-ui'
import type { Ref } from 'vue' import type { Ref } from 'vue'
@ -71,4 +58,4 @@ export const WHITE_ROUTES: string[] = ['RLogin', 'ErrorPage', 'RayTemplateDoc']
* *
* , * ,
*/ */
export const SUPER_ADMIN: (string | number)[] = ['admin'] export const SUPER_ADMIN: (string | number)[] = []

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-23
*
* @workspace ray-template
*
* @remark
*/
import { useAxiosInterceptor } from '@/axios/utils/interceptor' import { useAxiosInterceptor } from '@/axios/utils/interceptor'
import implement from './provider' import implement from './provider'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-06
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* *

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-23
*
* @workspace ray-template
*
* @remark
*/
import { useAxiosInterceptor } from '@/axios/utils/interceptor' import { useAxiosInterceptor } from '@/axios/utils/interceptor'
import implement from './provider' import implement from './provider'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-06
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* *

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-07-11
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* vue-hook-plus axios * vue-hook-plus axios

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2022-11-18
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* *

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-02-27
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* *

View File

@ -1,16 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-02
*
* @workspace ray-template
*
* @remark
*/
/** axios 拦截器工具 */
import type { RawAxiosRequestHeaders, AxiosRequestConfig } from 'axios' import type { RawAxiosRequestHeaders, AxiosRequestConfig } from 'axios'
import type { RequestHeaderOptions } from '../types' import type { RequestHeaderOptions } from '../types'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-05
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* axios * axios

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2024-05-16
*
* @workspace ray-template
*
* @remark
*/
import { RCollapseGrid, RForm } from '@/components' import { RCollapseGrid, RForm } from '@/components'
import { collapseGridProps, formProps } from '@/components' import { collapseGridProps, formProps } from '@/components'
@ -23,21 +12,21 @@ import type { FormProps, GridProps } from 'naive-ui'
*/ */
export default defineComponent({ export default defineComponent({
name: 'RCollapse', name: 'RCollapse',
props: Object.assign( props: Object.assign({}, formProps, {
{}, ...collapseGridProps,
{ open: {
...collapseGridProps, type: Boolean,
open: { default: true,
type: Boolean,
default: true,
},
cols: {
type: Number,
default: 4,
},
}, },
formProps, cols: {
), type: Number,
default: 4,
},
bordered: {
type: Boolean,
default: true,
},
}),
render() { render() {
const { $slots, $props } = this const { $slots, $props } = this
const { labelPlacement, showFeedback, ...rest } = $props as FormProps & const { labelPlacement, showFeedback, ...rest } = $props as FormProps &

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2024-05-10
*
* @workspace ray-template
*
* @remark
*/
import { RTable } from '@/components' import { RTable } from '@/components'
import props from './props' import props from './props'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2024-04-14
*
* @workspace ray-template
*
* @remark
*/
import './index.scss' import './index.scss'
import { NSpin } from 'naive-ui' import { NSpin } from 'naive-ui'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2022-12-27
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* <https://www.naiveui.com/zh-CN/dark/components/grid> * <https://www.naiveui.com/zh-CN/dark/components/grid>
@ -92,10 +81,11 @@ export default defineComponent({
yGap, yGap,
collapsedRows, collapsedRows,
cssVars, cssVars,
bordered,
} = this } = this
return ( return (
<NCard bordered={this.bordered} style={[cssVars]}> <NCard bordered={bordered} style={[cssVars]}>
{{ {{
default: () => ( default: () => (
<NGrid <NGrid

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2024-03-27
*
* @workspace ray-template
*
* @remark
*/
import { NForm } from 'naive-ui' import { NForm } from 'naive-ui'
import props from './props' import props from './props'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-01-04
*
* @workspace ray-template
*
* @remark
*/
import './index.scss' import './index.scss'
import { completeSize, call } from '@/utils' import { completeSize, call } from '@/utils'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-27
*
* @workspace ray-template
*
* @remark
*/
import type { PropType } from 'vue' import type { PropType } from 'vue'
import type { MaybeArray } from '@/types' import type { MaybeArray } from '@/types'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-09
*
* @workspace ray-template
*
* @remark
*/
import './index.scss' import './index.scss'
import { NSpin } from 'naive-ui' import { NSpin } from 'naive-ui'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-03
*
* @workspace ray-template
*
* @remark
*/
import type { PropType } from 'vue' import type { PropType } from 'vue'
import type { MaybeArray } from '@/types' import type { MaybeArray } from '@/types'
import type { SpinProps } from 'naive-ui' import type { SpinProps } from 'naive-ui'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-03
*
* @workspace ray-template
*
* @remark
*/
export interface RIframeInst { export interface RIframeInst {
iframe: Ref<HTMLIFrameElement> iframe: Ref<HTMLIFrameElement>
} }

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-11-22
*
* @workspace ray-template
*
* @remark
*/
import './index.scss' import './index.scss'
import { NModal } from 'naive-ui' import { NModal } from 'naive-ui'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-11-22
*
* @workspace ray-template
*
* @remark
*/
import { modalProps } from 'naive-ui' import { modalProps } from 'naive-ui'
import type { PropType } from 'vue' import type { PropType } from 'vue'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-21
*
* @workspace ray-template
*
* @remark
*/
import { NDropdown } from 'naive-ui' import { NDropdown } from 'naive-ui'
import { RIcon } from '@/components' import { RIcon } from '@/components'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-21
*
* @workspace ray-template
*
* @remark
*/
import { dropdownProps } from 'naive-ui' import { dropdownProps } from 'naive-ui'
const props = { const props = {

View File

@ -1,21 +1,10 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2024-04-10
*
* @workspace ray-template
*
* @remark
*/
import './index.scss' import './index.scss'
import { NTabs, NTab, NPopover, NFlex } from 'naive-ui' import { NTabs, NTab, NPopover, NFlex } from 'naive-ui'
import props from './props' import props from './props'
import { themeOverrides } from './constant' import { themeOverrides } from './constant'
import { completeSize, isValueType } from '@/utils' import { completeSize, isValueType, renderNode } from '@/utils'
import type { TabsProps } from 'naive-ui' import type { TabsProps } from 'naive-ui'
import type { RSegmentOptions } from './types' import type { RSegmentOptions } from './types'
@ -26,7 +15,7 @@ const iconSegmentTab = (option: RSegmentOptions) => {
if (icon) { if (icon) {
return ( return (
<NFlex align="center" wrap={false} size="small"> <NFlex align="center" wrap={false} size="small">
<icon /> {renderNode(icon)?.()}
<div>{label}</div> <div>{label}</div>
</NFlex> </NFlex>
) )

View File

@ -54,7 +54,7 @@ export interface RSegmentOptions {
* @description * @description
* *
*/ */
icon?: VNode icon?: VNode | (() => VNode)
} }
export type RSegmentWidth = number | 'block' | 'fitContent' export type RSegmentWidth = number | 'block' | 'fitContent'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-04
*
* @workspace ray-template
*
* @remark
*/
import './index.scss' import './index.scss'
import { NCard, NDataTable, NDropdown, NFlex } from 'naive-ui' import { NCard, NDataTable, NDropdown, NFlex } from 'naive-ui'
@ -258,7 +247,7 @@ export default defineComponent({
propsPopselectValue, propsPopselectValue,
renderWrapperHeader, renderWrapperHeader,
} = this } = this
const { class: className } = $attrs const { class: className, ...restAttrs } = $attrs
const { tool, combineRowProps, contextMenuSelect } = this const { tool, combineRowProps, contextMenuSelect } = this
return ( return (
@ -267,6 +256,7 @@ export default defineComponent({
{...{ {...{
id: uuidWrapper, id: uuidWrapper,
}} }}
{...restAttrs}
ref="wrapperRef" ref="wrapperRef"
bordered={wrapperBordered} bordered={wrapperBordered}
class={className} class={className}
@ -278,7 +268,6 @@ export default defineComponent({
{...{ {...{
id: uuidTable, id: uuidTable,
}} }}
{...$attrs}
{...($props as DataTableProps)} {...($props as DataTableProps)}
{...propsPopselectValue} {...propsPopselectValue}
rowProps={combineRowProps.bind(this)} rowProps={combineRowProps.bind(this)}

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-04
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* *

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-04
*
* @workspace ray-template
*
* @remark
*/
import { RIcon } from '@/components' import { RIcon } from '@/components'
import { config } from '../shared' import { config } from '../shared'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-05
*
* @workspace ray-template
*
* @remark
*/
import { RIcon } from '@/components' import { RIcon } from '@/components'
import { config } from '../shared' import { config } from '../shared'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-04
*
* @workspace ray-template
*
* @remark
*/
import { NPopselect } from 'naive-ui' import { NPopselect } from 'naive-ui'
import { RIcon } from '@/components' import { RIcon } from '@/components'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-04
*
* @workspace ray-template
*
* @remark
*/
import { NPopselect } from 'naive-ui' import { NPopselect } from 'naive-ui'
import { RIcon } from '@/components' import { RIcon } from '@/components'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-04
*
* @workspace ray-template
*
* @remark
*/
import { dataTableProps } from 'naive-ui' import { dataTableProps } from 'naive-ui'
import type { PropType, VNode } from 'vue' import type { PropType, VNode } from 'vue'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-04
*
* @workspace ray-template
*
* @remark
*/
export const config = { export const config = {
tableIconSize: '18', tableIconSize: '18',
tableKey: Symbol('r-table'), tableKey: Symbol('r-table'),

View File

@ -9,10 +9,10 @@
> >
<Suspense> <Suspense>
<KeepAlive <KeepAlive
v-if="setupKeepAlive" v-if="getKeepAliveConfig.setupKeepAlive"
:max="maxKeepAliveLength" :max="getKeepAliveConfig.maxKeepAliveLength"
:include="getKeepAliveInclude" :include="getKeepAliveInclude"
:exclude="keepAliveExclude" :exclude="getKeepAliveConfig.keepAliveExclude"
> >
<Component :is="Component" :key="route.fullPath" /> <Component :is="Component" :key="route.fullPath" />
</KeepAlive> </KeepAlive>
@ -24,8 +24,7 @@
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { useKeepAliveGetters } from '@/store' import { useSettingGetters, useKeepAliveGetters } from '@/store'
import { APP_KEEP_ALIVE } from '@/app-config'
import props from './props' import props from './props'
import type { TransitionProps } from './types' import type { TransitionProps } from './types'
@ -41,5 +40,5 @@ defineOptions({
withDefaults(defineProps<TransitionProps>(), props) withDefaults(defineProps<TransitionProps>(), props)
const { getKeepAliveInclude } = useKeepAliveGetters() const { getKeepAliveInclude } = useKeepAliveGetters()
const { setupKeepAlive, maxKeepAliveLength, keepAliveExclude } = APP_KEEP_ALIVE const { getKeepAliveConfig } = useSettingGetters()
</script> </script>

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-02
*
* @workspace ray-template
*
* @remark
*/
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { DEFAULT_DAYJS_LOCAL } from '@/app-config' import { DEFAULT_DAYJS_LOCAL } from '@/app-config'
import 'dayjs/locale/zh-cn' import 'dayjs/locale/zh-cn'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-24
*
* @workspace ray-template
*
* @remark
*/
import { combineDirective } from './utils/combine' import { combineDirective } from './utils/combine'
import { forIn } from 'lodash-es' import { forIn } from 'lodash-es'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-24
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* directive name: copy * directive name: copy

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-24
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* directive name: debounce * directive name: debounce

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-26
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* directive name: disabled * directive name: disabled

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-24
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* directive name: throttle * directive name: throttle

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-24
*
* @workspace ray-template
*
* @remark
*/
import type { DirectiveModules, CustomDirectiveFC } from '@/directives/types' import type { DirectiveModules, CustomDirectiveFC } from '@/directives/types'
export const combineDirective = < export const combineDirective = <

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-09-11
*
* @workspace ray-template
*
* @remark
*/
export * from './variable' export * from './variable'
export type * from './variable' export type * from './variable'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-09-11
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* @description * @description

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-12-01
*
* @workspace ray-template
*
* @remark
*/
import { useEventListener, onClickOutside } from '@vueuse/core' import { useEventListener, onClickOutside } from '@vueuse/core'
import type { BasicTarget } from '@/types' import type { BasicTarget } from '@/types'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-11-03
*
* @workspace ray-template
*
* @remark
*/
import { useMenuGetters } from '@/store' import { useMenuGetters } from '@/store'
import { useVueRouter } from '@/hooks' import { useVueRouter } from '@/hooks'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-11-17
*
* @workspace ray-template
*
* @remark
*/
import { useSettingGetters, useSettingActions } from '@/store' import { useSettingGetters, useSettingActions } from '@/store'
import type { AppRootRoute } from '@/store/modules/setting/types' import type { AppRootRoute } from '@/store/modules/setting/types'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-11-30
*
* @workspace ray-template
*
* @remark
*/
import { setVariable, getVariableToRefs } from '@/global-variable' import { setVariable, getVariableToRefs } from '@/global-variable'
import { LAYOUT_CONTENT_REF } from '@/app-config' import { LAYOUT_CONTENT_REF } from '@/app-config'
import { unrefElement } from '@/utils' import { unrefElement } from '@/utils'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-11-03
*
* @workspace ray-template
*
* @remark
*/
import { useMenuGetters, useMenuActions } from '@/store' import { useMenuGetters, useMenuActions } from '@/store'
import { useVueRouter, useAppRoot } from '@/hooks' import { useVueRouter, useAppRoot } from '@/hooks'
import { pick } from 'lodash-es' import { pick } from 'lodash-es'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-11-30
*
* @workspace ray-template
*
* @remark
*/
import { setVariable } from '@/global-variable' import { setVariable } from '@/global-variable'
export const useSpinning = () => { export const useSpinning = () => {

View File

@ -1,17 +1,7 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-11-30
*
* @workspace ray-template
*
* @remark
*/
import { useSettingActions, useSettingGetters } from '@/store' import { useSettingActions, useSettingGetters } from '@/store'
import { useI18n } from '@/hooks' import { useI18n } from '@/hooks'
import { APP_THEME } from '@/app-config' import { APP_THEME } from '@/app-config'
import { useColorMode } from '@vueuse/core'
export type ThemeLabel = 'Dark' | 'Light' export type ThemeLabel = 'Dark' | 'Light'
@ -93,7 +83,8 @@ export const useTheme = () => {
const darkTheme = () => { const darkTheme = () => {
const { updateSettingState } = useSettingActions() const { updateSettingState } = useSettingActions()
updateSettingState('appTheme', true) updateSettingState('_appTheme', true)
updateSettingState('appTheme', 'dark')
setThemeOverrides(true) setThemeOverrides(true)
} }
@ -108,10 +99,29 @@ export const useTheme = () => {
const lightTheme = () => { const lightTheme = () => {
const { updateSettingState } = useSettingActions() const { updateSettingState } = useSettingActions()
updateSettingState('appTheme', false) updateSettingState('_appTheme', false)
updateSettingState('appTheme', 'light')
setThemeOverrides(false) setThemeOverrides(false)
} }
/**
*
* @description
*
*
* @example
* syncSystemTheme()
*/
const syncSystemTheme = () => {
const { getAppTheme } = useSettingGetters()
const { updateSettingState } = useSettingActions()
const { system } = useColorMode()
updateSettingState('_appTheme', system.value === 'dark')
updateSettingState('appTheme', 'auto')
setThemeOverrides(getAppTheme.value)
}
/** /**
* *
* @param theme * @param theme
@ -129,7 +139,8 @@ export const useTheme = () => {
const { theme } = getAppTheme() const { theme } = getAppTheme()
const { updateSettingState } = useSettingActions() const { updateSettingState } = useSettingActions()
updateSettingState('appTheme', !theme) updateSettingState('_appTheme', !theme)
updateSettingState('appTheme', !theme ? 'dark' : 'light')
setThemeOverrides(!theme) setThemeOverrides(!theme)
} }
@ -138,6 +149,7 @@ export const useTheme = () => {
lightTheme, lightTheme,
toggleTheme, toggleTheme,
getAppTheme, getAppTheme,
syncSystemTheme,
} }
} }

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-11-30
*
* @workspace ray-template
*
* @remark
*/
import { useSettingActions, useSettingGetters } from '@/store' import { useSettingActions, useSettingGetters } from '@/store'
export const useWatermark = () => { export const useWatermark = () => {

View File

@ -1,15 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-09-11
*
* @workspace ray-template
*
* @description
*
*/
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { DEFAULT_DAYJS_LOCAL, DAYJS_LOCAL_MAP } from '@/app-config' import { DEFAULT_DAYJS_LOCAL, DAYJS_LOCAL_MAP } from '@/app-config'

View File

@ -1,19 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-10-24
*
* @workspace ray-template
*
* @remark
*/
/**
*
*
*/
import { useWindowSize } from '@vueuse/core' import { useWindowSize } from '@vueuse/core'
import { watchEffectWithTarget } from '@/utils' import { watchEffectWithTarget } from '@/utils'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-09-11
*
* @workspace ray-template
*
* @remark
*/
import { i18n } from '@/locales' import { i18n } from '@/locales'
import type { I18n } from 'vue-i18n' import type { I18n } from 'vue-i18n'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-06-02
*
* @workspace ray-template
*
* @remark
*/
import { router } from '@/router' import { router } from '@/router'
import type { Router } from 'vue-router' import type { Router } from 'vue-router'

View File

@ -1,3 +1,6 @@
<svg t="1669094703884" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="24094" width="200" height="200"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="#fff">
<path d="M335.22 240.91c0-57.08 10.68-111.66 30.15-161.87-167.51 64.86-286.3 227.51-286.3 417.92 0 247.42 200.58 448 448 448 190.34 0 352.95-118.71 417.85-286.13-50.16 19.42-104.69 30.08-161.71 30.08-247.41 0-447.99-200.57-447.99-448z" fill="#ffd93d" p-id="24095"></path> <path fill="none" d="M0 0h24v24H0z"></path>
<path
fill="currentColor"
d="M11.38 2.019a7.5 7.5 0 1 0 10.6 10.6C21.662 17.854 17.316 22 12.001 22 6.477 22 2 17.523 2 12c0-5.315 4.146-9.661 9.38-9.981"></path>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 428 B

After

Width:  |  Height:  |  Size: 321 B

View File

@ -1,6 +1,6 @@
<svg t="1669092652781" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="22947" width="200" height="200"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="#fff">
<path d="M512 511.4m-212 0a212 212 0 1 0 424 0 212 212 0 1 0-424 0Z" fill="#ffd93d" p-id="22948"></path> <path fill="none" d="M0 0h24v24H0z"></path>
<path d="M512 511.4m-198.3 0a198.3 198.3 0 1 0 396.6 0 198.3 198.3 0 1 0-396.6 0Z" fill="#ffd93d" p-id="22949"></path> <path
<path d="M511.7 130.2c12.9-0.2 24.2 11.3 24.5 24.3l0.4 79.6c0.2 12.9-11.3 24.2-24.3 24.5-12.9 0.2-24.2-11.3-24.5-24.3l-0.4-79.6c0.9-14.9 11.4-24.3 24.3-24.5zM901.5 510c-0.2 12.9-9.6 23.4-24.5 24.3l-79.6-0.4c-12.9-0.2-24.5-11.5-24.3-24.5 0.2-12.9 11.5-24.5 24.5-24.3l79.6 0.4c12.9 0.3 24.5 11.6 24.3 24.5zM250.9 510c-0.2 12.9-9.6 23.4-24.5 24.3l-79.6-0.4c-12.9-0.2-24.5-11.5-24.3-24.5 0.2-12.9 11.5-24.5 24.5-24.3l79.6 0.4c12.9 0.3 24.5 11.6 24.3 24.5zM512.3 893.8c-12.9 0.2-24.2-11.3-24.5-24.3l-0.4-79.6c-0.2-12.9 11.3-24.2 24.3-24.5 12.9-0.2 24.2 11.3 24.5 24.3l0.4 79.6c-0.9 14.9-11.4 24.3-24.3 24.5z" fill="#ffd93d" p-id="22950"></path> fill="currentColor"
<path d="M781.2 242.3c9.3 9 9.1 25.1 0.1 34.5l-56 56.5c-9 9.3-25.1 9.1-34.5 0.1-9.3-9-9.1-25.1-0.1-34.5l56-56.5c11.1-9.9 25.1-9.1 34.5-0.1zM788.2 786.5c-9.3 9-23.3 9.8-34.5-0.1l-56-56.5c-9-9.3-9.2-25.5 0.1-34.5 9.3-9 25.5-9.2 34.5 0.1l56 56.5c9 9.3 9.2 25.5-0.1 34.5zM328.1 326.4c-9.3 9-23.3 9.8-34.5-0.1l-56-56.5c-9-9.3-9.2-25.5 0.1-34.5 9.3-9 25.5-9.2 34.5 0.1l56 56.5c9 9.4 9.3 25.5-0.1 34.5zM241.6 782.6c-9.3-9-9.1-25.1-0.1-34.5l56-56.5c9-9.3 25.1-9.1 34.5-0.1 9.3 9 9.1 25.1 0.1 34.5l-56 56.5c-11.1 9.9-25.2 9.1-34.5 0.1z" fill="#ffd93d" p-id="22951"></path> d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12M11 1h2v3h-2zm0 19h2v3h-2zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414zm2.121-14.85 1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414zM23 11v2h-3v-2zM4 11v2H1v-2z"></path>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 494 B

View File

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" class="icon" viewBox="0 0 1024 1024"
>
<path
fill="currentColor"
d="M554 849.574c0 23.365-18.635 42.307-42 42.307s-42-18.941-42-42.307V662.719c0-23.365 18.635-42.307 42-42.307v-7.051c23.365 0 42 25.993 42 49.358z"></path>
<path
fill="currentColor"
d="M893 888.5c0 17.397-14.103 31.5-31.5 31.5h-700c-17.397 0-31.5-14.103-31.5-31.5s14.103-31.5 31.5-31.5h700c17.397 0 31.5 14.103 31.5 31.5m33-714.074C926 135.484 894.686 105 855.744 105H168.256C129.314 105 98 135.484 98 174.426V533h828zM98 630.988C98 669.931 129.314 702 168.256 702h687.488C894.686 702 926 669.931 926 630.988V596H98z"></path>
</svg>

After

Width:  |  Height:  |  Size: 681 B

View File

@ -0,0 +1,12 @@
<svg t="1729254196667" class="icon" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg" p-id="5087" width="200" height="200">
<path
fill="currentColor"
d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64z m0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"
p-id="5088"></path>
<path
fill="currentColor"
d="M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7c0-19.7 12.4-37.7 30.9-44.8 59-22.7 97.1-74.7 97.1-132.5 0.1-39.3-17.1-76-48.3-103.3z"
p-id="5089"></path>
<path d="M512 732m-40 0a40 40 0 1 0 80 0 40 40 0 1 0-80 0Z" p-id="5090"></path>
</svg>

After

Width:  |  Height:  |  Size: 921 B

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-08-08
*
* @workspace ray-template
*
* @remark 今天也是元气满满撸代码的一天
*/
.ray-menu__logo { .ray-menu__logo {
height: $layoutHeaderHeight; height: $layoutHeaderHeight;
padding: 0 18px 0 24px; padding: 0 18px 0 24px;

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-08-08
*
* @workspace ray-template
*
* @remark
*/
import './index.scss' import './index.scss'
import { NEllipsis, NTooltip } from 'naive-ui' import { NEllipsis, NTooltip } from 'naive-ui'

View File

@ -1,23 +1,12 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2022-10-11
*
* @workspace ray-template
*
* @remark
*/
import './index.scss' import './index.scss'
import { NMenu, NLayoutSider, NDrawer } from 'naive-ui' import { NMenu, NLayoutSider, NDrawer } from 'naive-ui'
import SiderBarLogo from './components/SiderBarLogo' import SiderBarLogo from './components/SiderBarLogo'
import { APP_MENU_CONFIG, LAYOUT_SIDER_REF } from '@/app-config' import { LAYOUT_SIDER_REF } from '@/app-config'
import { useDevice } from '@/hooks' import { useDevice } from '@/hooks'
import { getVariableToRefs, setVariable } from '@/global-variable' import { getVariableToRefs, setVariable } from '@/global-variable'
import { useMenuGetters, useMenuActions } from '@/store' import { useMenuGetters, useMenuActions, useSettingGetters } from '@/store'
import type { MenuInst } from 'naive-ui' import type { MenuInst } from 'naive-ui'
import type { NaiveMenuOptions } from '@/types' import type { NaiveMenuOptions } from '@/types'
@ -30,6 +19,7 @@ export default defineComponent({
const { changeMenuModelValue, collapsedMenu, updateMenuState } = const { changeMenuModelValue, collapsedMenu, updateMenuState } =
useMenuActions() useMenuActions()
const { getMenuConfig } = useSettingGetters()
const { getMenuOptions, getCollapsed, getMenuKey } = useMenuGetters() const { getMenuOptions, getCollapsed, getMenuKey } = useMenuGetters()
const modelMenuKey = computed({ const modelMenuKey = computed({
@ -87,8 +77,8 @@ export default defineComponent({
<NLayoutSider <NLayoutSider
class="app-menu__sider" class="app-menu__sider"
showTrigger={!isTabletOrSmaller.value} showTrigger={!isTabletOrSmaller.value}
collapseMode={APP_MENU_CONFIG.menuCollapsedMode} collapseMode={getMenuConfig.value.collapsedMode}
collapsedWidth={APP_MENU_CONFIG.menuCollapsedWidth} collapsedWidth={getMenuConfig.value.collapsedWidth}
onUpdateCollapsed={collapsedMenu.bind(this)} onUpdateCollapsed={collapsedMenu.bind(this)}
nativeScrollbar={false} nativeScrollbar={false}
ref={LAYOUT_SIDER_REF} ref={LAYOUT_SIDER_REF}
@ -107,14 +97,14 @@ export default defineComponent({
keyField="fullPath" keyField="fullPath"
v-model:value={modelMenuKey.value} v-model:value={modelMenuKey.value}
options={getMenuOptions.value as NaiveMenuOptions[]} options={getMenuOptions.value as NaiveMenuOptions[]}
indent={APP_MENU_CONFIG.menuCollapsedIndent} indent={getMenuConfig.value.collapsedIndent}
collapsed={getCollapsed.value} collapsed={getCollapsed.value}
collapsedIconSize={APP_MENU_CONFIG.menuCollapsedIconSize} collapsedIconSize={getMenuConfig.value.collapsedIconSize}
collapsedWidth={APP_MENU_CONFIG.menuCollapsedWidth} collapsedWidth={getMenuConfig.value.collapsedWidth}
onUpdateValue={(key, op) => { onUpdateValue={(key, op) => {
changeMenuModelValue(key, op as unknown as AppMenuOption) changeMenuModelValue(key, op as unknown as AppMenuOption)
}} }}
accordion={APP_MENU_CONFIG.menuAccordion} accordion={getMenuConfig.value.accordion}
/> />
</NLayoutSider> </NLayoutSider>
) )

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2022-12-08
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* @description * @description

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-04-16
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* app search * app search

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2024-01-23
*
* @workspace ray-template
*
* @remark
*/
import './index.scss' import './index.scss'
import { NButton, NFlex } from 'naive-ui' import { NButton, NFlex } from 'naive-ui'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-03-03
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* *

View File

@ -0,0 +1,80 @@
import { RSegment, RIcon } from '@/components'
import { useSettingGetters, useSettingActions } from '@/store'
import { useColorMode } from '@vueuse/core'
import type { SettingState } from '@/store/modules/setting/types'
export default defineComponent({
name: 'ThemeSegment',
setup() {
const { system } = useColorMode()
const { getAppThemeStr, getAppTheme } = useSettingGetters()
const { updateSettingState } = useSettingActions()
const options = [
{
label: '深色',
key: 'dark',
icon: () => <RIcon name="dark" size="16" />,
},
{
label: '浅色',
key: 'light',
icon: () => <RIcon name="light" size="16" />,
},
{
label: '自动',
key: 'auto',
icon: () => <RIcon name="system_os" size="16" />,
},
]
const modelAppTheme = computed({
get: () => {
if (getAppThemeStr.value === 'auto') {
return 'auto'
}
return getAppTheme.value ? 'dark' : 'light'
},
set: (val) => {
updateThemeFn(val, system.value)
},
})
const updateThemeFn = (
themeModel: SettingState['appTheme'],
systemTheme: 'dark' | 'light',
) => {
if (themeModel === 'auto') {
updateSettingState('_appTheme', systemTheme === 'dark')
updateSettingState('appTheme', 'auto')
return
}
updateSettingState('_appTheme', themeModel === 'dark')
updateSettingState('appTheme', themeModel)
}
watchEffect(() => {
updateThemeFn(modelAppTheme.value, system.value)
})
return {
options,
modelAppTheme,
}
},
render() {
const { options } = this
return (
<RSegment
options={options}
size="small"
width="block"
v-model:value={this.modelAppTheme}
/>
)
},
})

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-04-02
*
* @workspace ray-template
*
* @remark
*/
import { NFlex, NSwitch, NTooltip } from 'naive-ui' import { NFlex, NSwitch, NTooltip } from 'naive-ui'
import { RIcon } from '@/components' import { RIcon } from '@/components'

View File

@ -0,0 +1,21 @@
import type { SettingState } from '@/store/modules/setting/types'
export const defaultSettingConfig: Partial<SettingState> = {
contentTransition: 'scale',
watermarkSwitch: false,
keepAliveConfig: {
maxKeepAliveLength: 10,
setupKeepAlive: true,
},
menuConfig: {
collapsedWidth: 64,
collapsedMode: 'width',
collapsedIconSize: 22,
collapsedIndent: 24,
accordion: false,
},
menuTagSwitch: true,
breadcrumbSwitch: true,
copyrightSwitch: true,
drawerPlacement: 'right',
}

View File

@ -1,13 +1,3 @@
/**
*
* app setting
*
*
*
*
* 西 `app-config`
*/
import './index.scss' import './index.scss'
import { import {
@ -20,14 +10,24 @@ import {
NDescriptions, NDescriptions,
NDescriptionsItem, NDescriptionsItem,
NSelect, NSelect,
NInputNumber,
NFormItem,
NForm,
NButton,
NText,
NTooltip,
} from 'naive-ui' } from 'naive-ui'
import ThemeSwitch from '@/layout/components/SiderBar/components/SettingDrawer/components/ThemeSwitch' import ThemeSegment from './components/ThemeSegment'
import { RIcon } from '@/components'
import { APP_THEME, CONTENT_TRANSITION_OPTIONS } from '@/app-config' import { APP_THEME, CONTENT_TRANSITION_OPTIONS } from '@/app-config'
import { useSettingGetters, useSettingActions } from '@/store' import { useSettingGetters, useSettingActions } from '@/store'
import { defaultSettingConfig } from './constant'
import { forIn } from 'lodash-es'
import type { PropType } from 'vue' import type { PropType } from 'vue'
import type { Placement } from '@/types' import type { Placement } from '@/types'
import type { SettingState } from '@/store/modules/setting/types'
export default defineComponent({ export default defineComponent({
name: 'SettingDrawer', name: 'SettingDrawer',
@ -56,6 +56,9 @@ export default defineComponent({
getCopyrightSwitch, getCopyrightSwitch,
getContentTransition, getContentTransition,
getWatermarkSwitch, getWatermarkSwitch,
getKeepAliveConfig,
getMenuConfig,
getDrawerPlacement,
} = useSettingGetters() } = useSettingGetters()
const modelShow = computed({ const modelShow = computed({
@ -65,7 +68,7 @@ export default defineComponent({
}, },
}) })
// 为了方便管理多个 computed因为 computed 不能被逆向修改 // 为了方便管理多个 computed因为 computed 不能被逆向修改
const modelSwitchReactive = computed({ const modelReactive = computed({
get: () => { get: () => {
return { return {
getMenuTagSwitch: getMenuTagSwitch.value, getMenuTagSwitch: getMenuTagSwitch.value,
@ -73,35 +76,52 @@ export default defineComponent({
getCopyrightSwitch: getCopyrightSwitch.value, getCopyrightSwitch: getCopyrightSwitch.value,
getContentTransition: getContentTransition.value, getContentTransition: getContentTransition.value,
getWatermarkSwitch: getWatermarkSwitch.value, getWatermarkSwitch: getWatermarkSwitch.value,
getKeepAliveConfig: getKeepAliveConfig.value,
getMenuConfig: getMenuConfig.value,
getDrawerPlacement: getDrawerPlacement.value,
} }
}, },
set: (value) => {}, set: (value) => {},
}) })
const defaultSettingBtnClick = () => {
forIn(defaultSettingConfig, (value, key) => {
updateSettingState(key as keyof SettingState, value)
})
}
return { return {
modelShow, modelShow,
changePrimaryColor, changePrimaryColor,
getAppTheme, getAppTheme,
getPrimaryColorOverride, getPrimaryColorOverride,
updateSettingState, updateSettingState,
modelSwitchReactive, modelReactive,
defaultSettingBtnClick,
} }
}, },
render() { render() {
const { $t, changePrimaryColor, updateSettingState } = this const {
$t,
changePrimaryColor,
updateSettingState,
defaultSettingBtnClick,
} = this
return ( return (
<NDrawer <NDrawer
v-model:show={this.modelShow} v-model:show={this.modelShow}
placement={this.placement} placement={this.placement}
width={this.width} width={this.width}
trapFocus={false}
autoFocus={false}
> >
<NDrawerContent title={$t('headerSettingOptions.Title')}> <NDrawerContent title="系统配置">
<NFlex class="setting-drawer__space" vertical> <NFlex class="setting-drawer__space" vertical>
<NDivider titlePlacement="center"> <NDivider titlePlacement="center">
{$t('headerSettingOptions.ThemeOptions.Title')} {$t('headerSettingOptions.ThemeOptions.Title')}
</NDivider> </NDivider>
<ThemeSwitch /> <ThemeSegment />
<NDivider titlePlacement="center"> <NDivider titlePlacement="center">
{$t('headerSettingOptions.ThemeOptions.PrimaryColorConfig')} {$t('headerSettingOptions.ThemeOptions.PrimaryColorConfig')}
</NDivider> </NDivider>
@ -114,19 +134,56 @@ export default defineComponent({
{$t('headerSettingOptions.ContentTransition')} {$t('headerSettingOptions.ContentTransition')}
</NDivider> </NDivider>
<NSelect <NSelect
v-model:value={this.modelSwitchReactive.getContentTransition} v-model:value={this.modelReactive.getContentTransition}
options={CONTENT_TRANSITION_OPTIONS} options={CONTENT_TRANSITION_OPTIONS}
onUpdateValue={(value) => { onUpdateValue={(value) => {
updateSettingState('contentTransition', value) updateSettingState('contentTransition', value)
}} }}
/> />
<NDivider titlePlacement="center"> <NDivider titlePlacement="center"></NDivider>
{$t('headerSettingOptions.InterfaceDisplay')} <NSelect
</NDivider> v-model:value={this.modelReactive.getDrawerPlacement}
options={[
{
label: '右边',
value: 'right',
},
{
label: '左边',
value: 'left',
},
]}
onUpdateValue={(value) => {
updateSettingState('drawerPlacement', value)
}}
/>
<NDivider titlePlacement="center"></NDivider>
<NDescriptions labelPlacement="left" column={1}> <NDescriptions labelPlacement="left" column={1}>
<NDescriptionsItem label="菜单手风琴">
<NSwitch
v-model:value={this.modelReactive.getMenuConfig.accordion}
onUpdateValue={(bool: boolean) =>
updateSettingState('menuConfig', {
accordion: bool,
})
}
/>
</NDescriptionsItem>
<NDescriptionsItem label="页面缓存">
<NSwitch
v-model:value={
this.modelReactive.getKeepAliveConfig.setupKeepAlive
}
onUpdateValue={(bool: boolean) =>
updateSettingState('keepAliveConfig', {
setupKeepAlive: bool,
})
}
/>
</NDescriptionsItem>
<NDescriptionsItem label="多标签"> <NDescriptionsItem label="多标签">
<NSwitch <NSwitch
v-model:value={this.modelSwitchReactive.getMenuTagSwitch} v-model:value={this.modelReactive.getMenuTagSwitch}
onUpdateValue={(bool: boolean) => onUpdateValue={(bool: boolean) =>
updateSettingState('menuTagSwitch', bool) updateSettingState('menuTagSwitch', bool)
} }
@ -134,7 +191,7 @@ export default defineComponent({
</NDescriptionsItem> </NDescriptionsItem>
<NDescriptionsItem label="面包屑"> <NDescriptionsItem label="面包屑">
<NSwitch <NSwitch
v-model:value={this.modelSwitchReactive.getBreadcrumbSwitch} v-model:value={this.modelReactive.getBreadcrumbSwitch}
onUpdateValue={(bool: boolean) => onUpdateValue={(bool: boolean) =>
updateSettingState('breadcrumbSwitch', bool) updateSettingState('breadcrumbSwitch', bool)
} }
@ -142,7 +199,7 @@ export default defineComponent({
</NDescriptionsItem> </NDescriptionsItem>
<NDescriptionsItem label="水印"> <NDescriptionsItem label="水印">
<NSwitch <NSwitch
v-model:value={this.modelSwitchReactive.getWatermarkSwitch} v-model:value={this.modelReactive.getWatermarkSwitch}
onUpdateValue={(bool: boolean) => onUpdateValue={(bool: boolean) =>
updateSettingState('watermarkSwitch', bool) updateSettingState('watermarkSwitch', bool)
} }
@ -150,13 +207,91 @@ export default defineComponent({
</NDescriptionsItem> </NDescriptionsItem>
<NDescriptionsItem label="版权信息"> <NDescriptionsItem label="版权信息">
<NSwitch <NSwitch
v-model:value={this.modelSwitchReactive.getCopyrightSwitch} v-model:value={this.modelReactive.getCopyrightSwitch}
onUpdateValue={(bool: boolean) => onUpdateValue={(bool: boolean) =>
updateSettingState('copyrightSwitch', bool) updateSettingState('copyrightSwitch', bool)
} }
/> />
</NDescriptionsItem> </NDescriptionsItem>
</NDescriptions> </NDescriptions>
<NDivider titlePlacement="center"></NDivider>
<NForm showFeedback={true} showRequireMark={false}>
<NFormItem label="每级菜单缩进">
<NInputNumber
v-model:value={
this.modelReactive.getMenuConfig.collapsedIndent
}
min={24}
precision={0}
onUpdateValue={(value) => {
if (value !== null) {
updateSettingState('menuConfig', {
collapsedIndent: value,
})
}
}}
/>
</NFormItem>
<NFormItem label="折叠菜单图标尺寸">
<NInputNumber
v-model:value={
this.modelReactive.getMenuConfig.collapsedIconSize
}
min={22}
precision={0}
onUpdateValue={(value) => {
if (value !== null) {
updateSettingState('menuConfig', {
collapsedIconSize: value,
})
}
}}
/>
</NFormItem>
<NFormItem label="折叠菜单宽度" showFeedback={false}>
<NInputNumber
v-model:value={
this.modelReactive.getMenuConfig.collapsedWidth
}
min={64}
precision={0}
onUpdateValue={(value) => {
if (value !== null) {
updateSettingState('menuConfig', {
collapsedWidth: value,
})
}
}}
/>
</NFormItem>
</NForm>
<NDivider titlePlacement="center">
<NFlex wrap={false} align="center" size={[4, 0]}>
<NTooltip placement="top" showArrow={false}>
{{
trigger: () => <RIcon name="question" size="16" />,
default: () => '当设置为【0】时缓存将会失效',
}}
</NTooltip>
<NText></NText>
</NFlex>
</NDivider>
<NInputNumber
v-model:value={
this.modelReactive.getKeepAliveConfig.maxKeepAliveLength
}
showButton={true}
min={0}
max={100}
precision={0}
disabled={!this.modelReactive.getKeepAliveConfig.setupKeepAlive}
/>
<NDivider titlePlacement="center"></NDivider>
<NFlex>
<NButton type="primary" block onClick={defaultSettingBtnClick}>
</NButton>
</NFlex>
</NFlex> </NFlex>
</NDrawerContent> </NDrawerContent>
</NDrawer> </NDrawer>

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2022-12-29
*
* @workspace ray-template
*
* @remark
*/
import './index.scss' import './index.scss'
import { NTooltip } from 'naive-ui' import { NTooltip } from 'naive-ui'

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-01-04
*
* @workspace ray-template
*
* @remark
*/
/** /**
* *
* , ... * , ...

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-04-21
*
* @workspace ray-template-mine
*
* @remark
*/
/** /**
* *
* 使 NSpin loading * 使 NSpin loading

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-08-09
*
* @workspace ray-template
*
* @remark
*/
import MenuTag from '@/layout/components/MenuTag' import MenuTag from '@/layout/components/MenuTag'
export default defineComponent({ export default defineComponent({

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-04-21
*
* @workspace ray-template-mine
*
* @remark
*/
import './index.scss' import './index.scss'
export default defineComponent({ export default defineComponent({

View File

@ -1,14 +1,3 @@
/**
*
* @author Ray <https://github.com/XiaoDaiGua-Ray>
*
* @date 2023-08-09
*
* @workspace ray-template
*
* @remark
*/
import { NFlex } from 'naive-ui' import { NFlex } from 'naive-ui'
import SiderBar from '@/layout/components/SiderBar' import SiderBar from '@/layout/components/SiderBar'

Some files were not shown because too many files have changed in this diff Show More