feat(projects): 🎨 sync release v1.3.8 (#12)

This commit is contained in:
一寸灰
2024-12-06 11:01:10 +08:00
committed by GitHub
parent bed44e39a0
commit c409867009
13 changed files with 1090 additions and 997 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "@sa/elp",
"type": "module",
"version": "1.0.0",
"version": "1.3.8",
"description": "A fresh and elegant admin template, based on Vue3、Vite3、TypeScript、NaiveUI and UnoCSS. 一个基于Vue3、Vite3、TypeScript、NaiveUI and UnoCSS的清新优雅的中后台模版。",
"author": {
"name": "Soybean",
@@ -50,8 +50,8 @@
},
"dependencies": {
"@antv/data-set": "0.11.8",
"@antv/g2": "5.2.5",
"@antv/g6": "^5.0.26",
"@antv/g2": "5.2.7",
"@antv/g6": "5.0.30",
"@better-scroll/core": "2.5.1",
"@iconify/vue": "4.1.2",
"@sa/alova": "workspace:*",
@@ -60,28 +60,28 @@
"@sa/hooks": "workspace:*",
"@sa/materials": "workspace:*",
"@sa/utils": "workspace:*",
"@vueuse/components": "^11.1.0",
"@vueuse/core": "11.1.0",
"@vueuse/components": "11.2.0",
"@vueuse/core": "11.2.0",
"clipboard": "2.0.11",
"dayjs": "1.11.13",
"dhtmlx-gantt": "8.0.10",
"dompurify": "3.1.6",
"dhtmlx-gantt": "9.0.2",
"dompurify": "3.2.0",
"echarts": "5.5.1",
"element-plus": "^2.8.7",
"jsbarcode": "3.11.6",
"json5": "2.2.3",
"nprogress": "0.2.0",
"pinia": "2.2.4",
"pinyin-pro": "3.24.2",
"pinia": "2.2.6",
"pinyin-pro": "3.26.0",
"print-js": "1.6.0",
"swiper": "11.1.12",
"tailwind-merge": "2.5.3",
"typeit": "8.8.4",
"vditor": "3.10.5",
"vue": "3.5.11",
"vue-draggable-plus": "0.5.3",
"swiper": "11.1.14",
"tailwind-merge": "2.5.4",
"typeit": "8.8.7",
"vditor": "3.10.7",
"vue": "3.5.13",
"vue-draggable-plus": "0.6.0",
"vue-i18n": "10.0.4",
"vue-pdf-embed": "2.1.0",
"vue-pdf-embed": "2.1.1",
"vue-router": "4.4.5",
"wangeditor": "4.7.15",
"xgplayer": "3.0.20",
@@ -90,37 +90,37 @@
"devDependencies": {
"@amap/amap-jsapi-types": "0.0.15",
"@elegant-router/vue": "0.3.8",
"@iconify/json": "2.2.258",
"@iconify/json": "2.2.273",
"@sa/scripts": "workspace:*",
"@sa/uno-preset": "workspace:*",
"@soybeanjs/eslint-config": "1.4.1",
"@soybeanjs/eslint-config": "1.4.2",
"@types/bmapgl": "0.0.7",
"@types/dompurify": "3.0.5",
"@types/node": "22.7.5",
"@types/node": "22.9.0",
"@types/nprogress": "0.2.3",
"@unocss/eslint-config": "0.63.4",
"@unocss/preset-icons": "0.63.4",
"@unocss/preset-uno": "0.63.4",
"@unocss/transformer-directives": "0.63.4",
"@unocss/transformer-variant-group": "0.63.4",
"@unocss/vite": "0.63.4",
"@vitejs/plugin-vue": "5.1.4",
"@vitejs/plugin-vue-jsx": "4.0.1",
"eslint": "9.12.0",
"eslint-plugin-vue": "9.28.0",
"@unocss/eslint-config": "0.64.1",
"@unocss/preset-icons": "0.64.1",
"@unocss/preset-uno": "0.64.1",
"@unocss/transformer-directives": "0.64.1",
"@unocss/transformer-variant-group": "0.64.1",
"@unocss/vite": "0.64.1",
"@vitejs/plugin-vue": "5.2.0",
"@vitejs/plugin-vue-jsx": "4.1.0",
"eslint": "9.14.0",
"eslint-plugin-vue": "9.31.0",
"lint-staged": "15.2.10",
"sass": "1.79.4",
"simple-git-hooks": "2.11.1",
"tsx": "4.19.1",
"tsx": "4.19.2",
"typescript": "5.6.3",
"unplugin-icons": "0.19.3",
"unplugin-icons": "0.20.1",
"unplugin-vue-components": "0.27.4",
"vite": "5.4.8",
"vite": "5.4.11",
"vite-plugin-progress": "0.0.7",
"vite-plugin-svg-icons": "2.0.1",
"vite-plugin-vue-devtools": "7.4.6",
"vite-plugin-vue-devtools": "7.6.4",
"vue-eslint-parser": "9.4.3",
"vue-tsc": "2.1.6"
"vue-tsc": "2.1.10"
},
"simple-git-hooks": {
"commit-msg": "pnpm sa git-commit-verify",

View File

@@ -1,6 +1,6 @@
{
"name": "@sa/alova",
"version": "1.3.9",
"version": "1.3.8",
"exports": {
".": "./src/index.ts",
"./fetch": "./src/fetch.ts",

View File

@@ -1,6 +1,6 @@
{
"name": "@sa/axios",
"version": "1.3.7",
"version": "1.3.8",
"exports": {
".": "./src/index.ts"
},

View File

@@ -1,6 +1,6 @@
{
"name": "@sa/scripts",
"version": "1.3.7",
"version": "1.3.8",
"bin": {
"sa": "./bin.ts"
},
@@ -14,14 +14,14 @@
},
"devDependencies": {
"@soybeanjs/changelog": "0.3.24",
"bumpp": "9.7.1",
"bumpp": "9.8.1",
"c12": "2.0.1",
"cac": "6.7.14",
"consola": "3.2.3",
"enquirer": "2.4.1",
"execa": "9.4.0",
"execa": "9.5.1",
"kolorist": "1.8.0",
"npm-check-updates": "17.1.3",
"npm-check-updates": "17.1.11",
"rimraf": "6.0.1"
}
}

1860
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -54,3 +54,9 @@ export const themePageAnimationModeRecord: Record<UnionKey.ThemePageAnimateMode,
};
export const themePageAnimationModeOptions = transformRecordToOption(themePageAnimationModeRecord);
export const resetCacheStrategyRecord: Record<UnionKey.ResetCacheStrategy, App.I18n.I18nKey> = {
close: 'theme.resetCacheStrategy.close',
refresh: 'theme.resetCacheStrategy.refresh'
};
export const resetCacheStrategyOptions = transformRecordToOption(resetCacheStrategyRecord);

View File

@@ -6,9 +6,7 @@ import { useThemeStore } from '@/store/modules/theme';
import { useRouteStore } from '@/store/modules/route';
import { useTabStore } from '@/store/modules/tab';
defineOptions({
name: 'GlobalContent'
});
defineOptions({ name: 'GlobalContent' });
interface Props {
/** Show padding for content */
@@ -42,7 +40,7 @@ function resetScroll() {
@after-leave="resetScroll"
@after-enter="appStore.setContentXScrollable(false)"
>
<KeepAlive :include="routeStore.cacheRoutes">
<KeepAlive :include="routeStore.cacheRoutes" :exclude="routeStore.excludeCacheRoutes">
<component
:is="Component"
v-if="appStore.reloadFlag"

View File

@@ -11,9 +11,7 @@ import { useTabStore } from '@/store/modules/tab';
import { isPC } from '@/utils/agent';
import ContextMenu from './context-menu.vue';
defineOptions({
name: 'GlobalTab'
});
defineOptions({ name: 'GlobalTab' });
const route = useRoute();
const appStore = useAppStore();
@@ -84,7 +82,10 @@ function getContextMenuDisabledKeys(tabId: string) {
async function handleCloseTab(tab: App.Global.Tab) {
await tabStore.removeTab(tab.id);
await routeStore.reCacheRoutesByKey(tab.routeKey);
if (themeStore.resetCacheStrategy === 'close') {
routeStore.resetRouteCache(tab.routeKey);
}
}
async function refresh() {

View File

@@ -2,7 +2,12 @@
import { computed } from 'vue';
import { $t } from '@/locales';
import { useThemeStore } from '@/store/modules/theme';
import { themePageAnimationModeOptions, themeScrollModeOptions, themeTabModeOptions } from '@/constants/app';
import {
resetCacheStrategyOptions,
themePageAnimationModeOptions,
themeScrollModeOptions,
themeTabModeOptions
} from '@/constants/app';
import { translateOptions } from '@/utils/common';
import SettingItem from '../components/setting-item.vue';
@@ -20,6 +25,16 @@ const isWrapperScrollMode = computed(() => themeStore.layout.scrollMode === 'wra
<template>
<ElDivider>{{ $t('theme.pageFunTitle') }}</ElDivider>
<TransitionGroup tag="div" name="setting-list" class="flex-col-stretch gap-12px">
<SettingItem key="1" :label="$t('theme.resetCacheStrategy.title')">
<ElSelect v-model="themeStore.resetCacheStrategy" size="small" class="w-120px">
<ElOption
v-for="{ label, value } in translateOptions(resetCacheStrategyOptions)"
:key="value"
:label="label"
:value="value"
/>
</ElSelect>
</SettingItem>
<SettingItem key="1" :label="$t('theme.scrollMode.title')">
<ElSelect v-model="themeStore.layout.scrollMode" size="small" class="w-120px">
<ElOption

View File

@@ -411,7 +411,8 @@ export const generatedRoutes: GeneratedRoute[] = [
component: 'view.plugin_charts_antv',
meta: {
title: 'plugin_charts_antv',
i18nKey: 'route.plugin_charts_antv'
i18nKey: 'route.plugin_charts_antv',
icon: 'hugeicons:flow-square'
}
},
{

View File

@@ -46,19 +46,17 @@ export const useAppStore = defineStore(SetupStoreId.App, () => {
});
setReloadFlag(true);
if (themeStore.resetCacheStrategy === 'refresh') {
routeStore.resetRouteCache();
}
}
const locale = ref<App.I18n.LangType>(localStg.get('lang') || 'zh-CN');
const localeOptions: App.I18n.LangOption[] = [
{
label: '中文',
key: 'zh-CN'
},
{
label: 'English',
key: 'en-US'
}
{ label: '中文', key: 'zh-CN' },
{ label: 'English', key: 'en-US' }
];
function changeLocale(lang: App.I18n.LangType) {

View File

@@ -1,4 +1,4 @@
import { computed, ref, shallowRef } from 'vue';
import { computed, nextTick, ref, shallowRef } from 'vue';
import type { RouteRecordRaw } from 'vue-router';
import { defineStore } from 'pinia';
import { useBoolean } from '@sa/hooks';
@@ -9,7 +9,6 @@ import { createStaticRoutes, getAuthVueRoutes } from '@/router/routes';
import { ROOT_ROUTE } from '@/router/routes/builtin';
import { getRouteName, getRoutePath } from '@/router/elegant/transform';
import { fetchGetConstantRoutes, fetchGetUserRoutes, fetchIsRouteExist } from '@/service/api';
import { useAppStore } from '../app';
import { useAuthStore } from '../auth';
import { useTabStore } from '../tab';
import {
@@ -25,7 +24,6 @@ import {
} from './shared';
export const useRouteStore = defineStore(SetupStoreId.Route, () => {
const appStore = useAppStore();
const authStore = useAuthStore();
const tabStore = useTabStore();
const { bool: isInitConstantRoute, setBool: setIsInitConstantRoute } = useBoolean();
@@ -97,8 +95,12 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
/** Cache routes */
const cacheRoutes = ref<RouteKey[]>([]);
/** All cache routes */
const allCacheRoutes = shallowRef<RouteKey[]>([]);
/**
* Exclude cache routes
*
* for reset route cache
*/
const excludeCacheRoutes = ref<RouteKey[]>([]);
/**
* Get cache routes
@@ -106,69 +108,23 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
* @param routes Vue routes
*/
function getCacheRoutes(routes: RouteRecordRaw[]) {
const alls = getCacheRouteNames(routes);
cacheRoutes.value = alls;
allCacheRoutes.value = [...alls];
cacheRoutes.value = getCacheRouteNames(routes);
}
/**
* Add cache routes
* Reset route cache
*
* @default router.currentRoute.value.name current route name
* @param routeKey
*/
function addCacheRoutes(routeKey: RouteKey) {
if (cacheRoutes.value.includes(routeKey)) return;
async function resetRouteCache(routeKey?: RouteKey) {
const routeName = routeKey || (router.currentRoute.value.name as RouteKey);
cacheRoutes.value.push(routeKey);
}
excludeCacheRoutes.value.push(routeName);
/**
* Remove cache routes
*
* @param routeKey
*/
function removeCacheRoutes(routeKey: RouteKey) {
const index = cacheRoutes.value.findIndex(item => item === routeKey);
await nextTick();
if (index === -1) return;
cacheRoutes.value.splice(index, 1);
}
/**
* Is cached route
*
* @param routeKey
*/
function isCachedRoute(routeKey: RouteKey) {
return allCacheRoutes.value.includes(routeKey);
}
/**
* Re cache routes by route key
*
* @param routeKey
*/
async function reCacheRoutesByKey(routeKey: RouteKey) {
if (!isCachedRoute(routeKey)) return;
removeCacheRoutes(routeKey);
await appStore.reloadPage();
addCacheRoutes(routeKey);
}
/**
* Re cache routes by route keys
*
* @param routeKeys
*/
async function reCacheRoutesByKeys(routeKeys: RouteKey[]) {
for await (const key of routeKeys) {
await reCacheRoutesByKey(key);
}
excludeCacheRoutes.value = [];
}
/** Global breadcrumbs */
@@ -354,6 +310,14 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
return getSelectedMenuKeyPathByKey(selectedKey, menus.value);
}
async function onRouteSwitchWhenLoggedIn() {
authStore.initUserInfo();
}
async function onRouteSwitchWhenNotLoggedIn() {
// some global init logic if it does not need to be logged in
}
return {
resetStore,
routeHome,
@@ -361,8 +325,8 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
searchMenus,
updateGlobalMenusByLocale,
cacheRoutes,
reCacheRoutesByKey,
reCacheRoutesByKeys,
excludeCacheRoutes,
resetRouteCache,
breadcrumbs,
initConstantRoute,
isInitConstantRoute,
@@ -370,6 +334,8 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
isInitAuthRoute,
setIsInitAuthRoute,
getIsAuthRouteExist,
getSelectedMenuKeyPath
getSelectedMenuKeyPath,
onRouteSwitchWhenLoggedIn,
onRouteSwitchWhenNotLoggedIn
};
});

View File

@@ -12,6 +12,7 @@ export const themeSettings: App.Theme.ThemeSetting = {
error: '#f5222d'
},
isInfoFollowPrimary: true,
resetCacheStrategy: 'close',
layout: {
mode: 'vertical',
scrollMode: 'content',
@@ -83,6 +84,7 @@ export const themeSettings: App.Theme.ThemeSetting = {
* If publish new version, use `overrideThemeSettings` to override certain theme settings
*/
export const overrideThemeSettings: Partial<App.Theme.ThemeSetting> = {
resetCacheStrategy: 'close',
watermark: {
visible: false,
text: 'SoybeanAdmin'