Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin
This commit is contained in:
commit
20ae9b313b
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@ -21,9 +21,6 @@ jobs:
|
||||
post-update:
|
||||
# if: ${{ github.actor == 'dependabot[bot]' }}
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
@ -2,7 +2,8 @@
|
||||
"page": {
|
||||
"demos": {
|
||||
"title": "Demos",
|
||||
"naive": "Naive UI"
|
||||
"naive": "Naive UI",
|
||||
"table": "Table"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,8 @@
|
||||
"page": {
|
||||
"demos": {
|
||||
"title": "演示",
|
||||
"naive": "Naive UI"
|
||||
"naive": "Naive UI",
|
||||
"table": "Table"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,15 @@ const routes: RouteRecordRaw[] = [
|
||||
path: '/demos/naive',
|
||||
component: () => import('#/views/demos/naive/index.vue'),
|
||||
},
|
||||
{
|
||||
meta: {
|
||||
icon: 'mdi:shield-key-outline',
|
||||
title: $t('page.demos.table'),
|
||||
},
|
||||
name: 'Table',
|
||||
path: '/demos/table',
|
||||
component: () => import('#/views/demos/table/index.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
31
apps/web-naive/src/views/demos/table/index.vue
Normal file
31
apps/web-naive/src/views/demos/table/index.vue
Normal file
@ -0,0 +1,31 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { NDataTable } from 'naive-ui';
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
key: 'no',
|
||||
title: 'No',
|
||||
},
|
||||
{
|
||||
key: 'title',
|
||||
title: 'Title',
|
||||
},
|
||||
{
|
||||
key: 'length',
|
||||
title: 'Length',
|
||||
},
|
||||
]);
|
||||
const data = [
|
||||
{ length: '4:18', no: 3, title: 'Wonderwall' },
|
||||
{ length: '4:48', no: 4, title: "Don't Look Back in Anger" },
|
||||
{ length: '7:27', no: 12, title: 'Champagne Supernova' },
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NDataTable :columns="columns" :data="data" />
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
@ -50,7 +50,7 @@
|
||||
"sass": "^1.77.8",
|
||||
"vite": "^5.3.5",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-dts": "4.0.0-beta.2",
|
||||
"vite-plugin-dts": "4.0.0",
|
||||
"vite-plugin-html": "^3.2.2"
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@
|
||||
"node": ">=20",
|
||||
"pnpm": ">=9"
|
||||
},
|
||||
"packageManager": "pnpm@9.6.0",
|
||||
"packageManager": "pnpm@9.7.0",
|
||||
"pnpm": {
|
||||
"peerDependencyRules": {
|
||||
"allowedVersions": {
|
||||
|
@ -40,5 +40,34 @@ function isValidColor(color?: string) {
|
||||
}
|
||||
return new TinyColor(color).isValid;
|
||||
}
|
||||
/**
|
||||
* 将HLS字符串转换为RGB颜色字符串
|
||||
*
|
||||
* 本函数接收一个表示HLS值的字符串,移除其中的度量单位,
|
||||
* 并将其转换为TinyColor对象,以便进行颜色处理。
|
||||
* 如果转换后的颜色无效,则直接返回原始字符串;
|
||||
* 否则,返回转换后的RGB颜色字符串
|
||||
*
|
||||
* @param str 表示HLS颜色值的字符串,可能包含度量单位如'deg'、'grad'、'rad'或'turn'
|
||||
* @returns 如果颜色值有效,则返回对应的RGB颜色字符串;如果无效,则返回原始字符串
|
||||
*/
|
||||
function hlsStringToRGBString(str: string): string {
|
||||
// 移除HLS字符串中的度量单位,以便正确解析
|
||||
const color = new TinyColor(
|
||||
`hsl(${str.replaceAll(/deg|grad|rad|turn/g, '')})`,
|
||||
);
|
||||
// 检查颜色是否有效,如果无效则直接返回原始字符串
|
||||
if (!color.isValid) {
|
||||
return str;
|
||||
}
|
||||
// 返回转换后的RGB颜色字符串
|
||||
return color.toRgbString();
|
||||
}
|
||||
|
||||
export { convertToHsl, convertToHslCssVar, isValidColor, TinyColor };
|
||||
export {
|
||||
convertToHsl,
|
||||
convertToHslCssVar,
|
||||
hlsStringToRGBString,
|
||||
isValidColor,
|
||||
TinyColor,
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { reactive, watch } from 'vue';
|
||||
|
||||
import { preferences } from '@vben/preferences';
|
||||
import { updateCSSVariables } from '@vben/utils';
|
||||
import { hlsStringToRGBString, updateCSSVariables } from '@vben/utils';
|
||||
|
||||
/**
|
||||
* 用于适配各个框架的设计系统
|
||||
@ -102,7 +102,7 @@ export function useNaiveDesignTokens() {
|
||||
|
||||
const getCssVariableValue = (variable: string, isColor: boolean = true) => {
|
||||
const value = rootStyles.getPropertyValue(variable);
|
||||
return isColor ? `hsl(${value})` : value;
|
||||
return isColor ? hlsStringToRGBString(value) : value;
|
||||
};
|
||||
|
||||
watch(
|
||||
@ -150,7 +150,6 @@ export function useNaiveDesignTokens() {
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
return {
|
||||
commonTokens,
|
||||
};
|
||||
|
@ -652,8 +652,8 @@ importers:
|
||||
specifier: ^0.5.1
|
||||
version: 0.5.1(vite@5.3.5(@types/node@22.1.0)(sass@1.77.8)(terser@5.31.3))
|
||||
vite-plugin-dts:
|
||||
specifier: 4.0.0-beta.2
|
||||
version: 4.0.0-beta.2(@types/node@22.1.0)(rollup@4.20.0)(typescript@5.5.4)(vite@5.3.5(@types/node@22.1.0)(sass@1.77.8)(terser@5.31.3))
|
||||
specifier: 4.0.0
|
||||
version: 4.0.0(@types/node@22.1.0)(rollup@4.20.0)(typescript@5.5.4)(vite@5.3.5(@types/node@22.1.0)(sass@1.77.8)(terser@5.31.3))
|
||||
vite-plugin-html:
|
||||
specifier: ^3.2.2
|
||||
version: 3.2.2(vite@5.3.5(@types/node@22.1.0)(sass@1.77.8)(terser@5.31.3))
|
||||
@ -9224,8 +9224,8 @@ packages:
|
||||
peerDependencies:
|
||||
vite: '>=2.0.0'
|
||||
|
||||
vite-plugin-dts@4.0.0-beta.2:
|
||||
resolution: {integrity: sha512-7PYDxeKvFjRpeqvWTRT8YqX2J1uOrxgvHtXkRYAMfjonIHMSz/ZXjxPiRefBbXOTydqWk7jSZK3vwEt4Gvzbfw==}
|
||||
vite-plugin-dts@4.0.0:
|
||||
resolution: {integrity: sha512-MOGyecSNqXGxExPfDYtsH3cFted5UA04BP3JdI05i2BQRJmgjKeeUn6ymAWnEpZ6UY88Xd1n1NDmkO9q7YB5vA==}
|
||||
engines: {node: ^14.18.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
typescript: '*'
|
||||
@ -18563,7 +18563,7 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
vite-plugin-dts@4.0.0-beta.2(@types/node@22.1.0)(rollup@4.20.0)(typescript@5.5.4)(vite@5.3.5(@types/node@22.1.0)(sass@1.77.8)(terser@5.31.3)):
|
||||
vite-plugin-dts@4.0.0(@types/node@22.1.0)(rollup@4.20.0)(typescript@5.5.4)(vite@5.3.5(@types/node@22.1.0)(sass@1.77.8)(terser@5.31.3)):
|
||||
dependencies:
|
||||
'@microsoft/api-extractor': 7.47.4(@types/node@22.1.0)
|
||||
'@rollup/pluginutils': 5.1.0(rollup@4.20.0)
|
||||
|
Loading…
Reference in New Issue
Block a user