vc-unicloud-admin-ui 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1445 -0
- package/package.json +6 -9
- package/theme/index.css +6 -0
- package/components/data-icon/index.ts +0 -1
- package/components/data-icon/src/composables/data-icon-custom.ts +0 -26
- package/components/data-icon/src/composables/index.ts +0 -2
- package/components/data-icon/src/composables/use-data-icon.ts +0 -46
- package/components/data-icon/src/data-icon.ts +0 -48
- package/components/data-icon/src/data-icon.vue +0 -39
- package/components/index.ts +0 -1
- package/global.d.ts +0 -34
- package/index.scss +0 -0
- package/index.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/data-icon'
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { computed } from 'vue';
|
|
2
|
-
import type { DataIconProps } from '../data-icon';
|
|
3
|
-
|
|
4
|
-
export const useDataIconCustomStyle = (props : DataIconProps) => {
|
|
5
|
-
const iconStyle = computed(() => {
|
|
6
|
-
const { color, size, bold, pointer } = props;
|
|
7
|
-
const style : Record<string, any> = {
|
|
8
|
-
color: color || '',
|
|
9
|
-
fontSize: typeof size === 'number'? `${size}px`: size
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
if (bold) {
|
|
13
|
-
style.fontWeight = 'bold'
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (pointer) {
|
|
17
|
-
style.cursor = 'pointer'
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return style
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
iconStyle
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { computed } from 'vue';
|
|
2
|
-
import type { DataIconProps } from '../data-icon';
|
|
3
|
-
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
|
4
|
-
|
|
5
|
-
export const useDataIcon = (props: DataIconProps) => {
|
|
6
|
-
// 获取 Element Plus 图标组件名
|
|
7
|
-
const iconName = computed(() => {
|
|
8
|
-
if (!props.name) return ''
|
|
9
|
-
// el-icon-xxx -> xxx (首字母大写)
|
|
10
|
-
if (props.name.startsWith('el-icon-')) {
|
|
11
|
-
const iconName = props.name.replace('el-icon-', '')
|
|
12
|
-
// 将 kebab-case 转换为 PascalCase
|
|
13
|
-
return kebabToPascal(iconName)
|
|
14
|
-
}
|
|
15
|
-
return ''
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
// 判断是否为 Element Plus 图标
|
|
19
|
-
const isElIcon = computed(() => props.name?.startsWith('el-icon-') || false)
|
|
20
|
-
|
|
21
|
-
// 获取图标的类名(用于非 el-icon 的图标)
|
|
22
|
-
const iconClass = computed(() => {
|
|
23
|
-
if (!props.name) return ''
|
|
24
|
-
return props.name
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
// 获取 Element Plus 图标组件
|
|
28
|
-
function getElIconComponent(name : string) {
|
|
29
|
-
if (!name) return null
|
|
30
|
-
// 查找对应的图标组件
|
|
31
|
-
const iconComponent = (ElementPlusIconsVue as Record<string, unknown>)[name]
|
|
32
|
-
return iconComponent || null
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// kebab-case 转 PascalCase
|
|
36
|
-
function kebabToPascal(str : string) : string {
|
|
37
|
-
return str.replace(/-([a-z])/g, (_, char) => char.toUpperCase()).replace(/^([a-z])/, (_, char) => char.toUpperCase())
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
iconName,
|
|
42
|
-
isElIcon,
|
|
43
|
-
iconClass,
|
|
44
|
-
getElIconComponent
|
|
45
|
-
}
|
|
46
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { ExtractPropTypes } from 'vue';
|
|
2
|
-
|
|
3
|
-
export const dataIconProps = {
|
|
4
|
-
/**
|
|
5
|
-
* @description 图标名称
|
|
6
|
-
*/
|
|
7
|
-
name: {
|
|
8
|
-
type: String,
|
|
9
|
-
default: ''
|
|
10
|
-
},
|
|
11
|
-
/**
|
|
12
|
-
* 图标颜色
|
|
13
|
-
* @example '#409EFF' | 'rgb(64, 158, 255)' | 'red'
|
|
14
|
-
*/
|
|
15
|
-
color: {
|
|
16
|
-
type: String,
|
|
17
|
-
default: ''
|
|
18
|
-
},
|
|
19
|
-
/**
|
|
20
|
-
* 图标大小
|
|
21
|
-
* - Number: 使用 px 单位
|
|
22
|
-
* - String: 使用指定单位 (如 '16px', '1.5em', '12pt')
|
|
23
|
-
* @default 16
|
|
24
|
-
* @example 16 | '16' | '16px' | '1.5em'
|
|
25
|
-
*/
|
|
26
|
-
size: {
|
|
27
|
-
type: [String, Number],
|
|
28
|
-
default: 16
|
|
29
|
-
},
|
|
30
|
-
/**
|
|
31
|
-
* 是否加粗
|
|
32
|
-
* @default false
|
|
33
|
-
*/
|
|
34
|
-
bold: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
default: false
|
|
37
|
-
},
|
|
38
|
-
/**
|
|
39
|
-
* 是否显示鼠标手势
|
|
40
|
-
* @default false
|
|
41
|
-
*/
|
|
42
|
-
pointer: {
|
|
43
|
-
type: Boolean,
|
|
44
|
-
default: false
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export type DataIconProps = ExtractPropTypes<typeof dataIconProps>;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component
|
|
3
|
-
:is="isElIcon ? 'el-icon' : 'i'"
|
|
4
|
-
:class="iconClass"
|
|
5
|
-
:style="iconStyle">
|
|
6
|
-
<!-- Element Plus 图标使用具名插槽 -->
|
|
7
|
-
<template v-if="isElIcon">
|
|
8
|
-
<component :is="getElIconComponent(iconName)" />
|
|
9
|
-
</template>
|
|
10
|
-
</component>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script lang="ts" setup>
|
|
14
|
-
import { computed } from 'vue'
|
|
15
|
-
import { dataIconProps } from './data-icon'
|
|
16
|
-
import { useDataIcon, useDataIconCustomStyle } from './composables'
|
|
17
|
-
|
|
18
|
-
const props = defineProps(dataIconProps);
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
iconName,
|
|
22
|
-
isElIcon,
|
|
23
|
-
iconClass,
|
|
24
|
-
getElIconComponent
|
|
25
|
-
} = useDataIcon(props);
|
|
26
|
-
|
|
27
|
-
const {
|
|
28
|
-
iconStyle
|
|
29
|
-
} = useDataIconCustomStyle(props);
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
<style lang="scss" scoped>
|
|
33
|
-
/* 图标默认样式 */
|
|
34
|
-
.el-icon, i[class*='-icon-'] {
|
|
35
|
-
display: inline-flex;
|
|
36
|
-
align-items: center;
|
|
37
|
-
justify-content: center;
|
|
38
|
-
}
|
|
39
|
-
</style>
|
package/components/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './data-icon'
|
package/global.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { App } from 'vue';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* vc 工具类型声明
|
|
5
|
-
* @description 封装了常用的方法函数,可直接通过`uni.vc`形式调用
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// interface Utils extends '' {
|
|
9
|
-
// config: Config;
|
|
10
|
-
// [key: string]: any;
|
|
11
|
-
// }
|
|
12
|
-
|
|
13
|
-
// declare global {
|
|
14
|
-
// interface Uni {
|
|
15
|
-
// vc: Utils;
|
|
16
|
-
// }
|
|
17
|
-
// }
|
|
18
|
-
|
|
19
|
-
// 声明全局组件类型
|
|
20
|
-
declare module 'vue' {
|
|
21
|
-
interface ComponentCustomProperties {
|
|
22
|
-
// vc: Utils;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface GlobalComponents {
|
|
26
|
-
FuDataIcon: typeof import('./components/data-icon/src/data-icon.vue')['default'];
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
declare const vc: {
|
|
31
|
-
install: (app: App) => void;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default vc;
|
package/index.scss
DELETED
|
File without changes
|
package/index.ts
DELETED
|
File without changes
|