Skip to content

Commit e249dcf

Browse files
committed
releases 3.0.33
1 parent bc8055b commit e249dcf

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vxe-ui/core",
3-
"version": "3.0.32",
3+
"version": "3.0.33",
44
"description": "Vxe UI core library",
55
"scripts": {
66
"update": "npm install --legacy-peer-deps",

packages/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { clipboard } from './src/clipboard'
1717
import { permission } from './src/permission'
1818
import { log } from './src/log'
1919
import { globalMixins } from './src/mixins'
20+
import XEUtils from 'xe-utils'
2021

2122
import { VxeGlobalComponents, VxeUIPluginObject } from '../types'
2223

@@ -41,6 +42,7 @@ export function getComponent (name: keyof VxeGlobalComponents) {
4142
export function component (comp: any) {
4243
if (comp && comp.name) {
4344
components[comp.name] = comp
45+
components[XEUtils.kebabCase(comp.name)] = comp
4446
}
4547
}
4648

types/tool/common.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,13 @@ export interface VxeComponentPermissionInfo {
103103
visible: boolean
104104
disabled: boolean
105105
}
106+
107+
type CamelToKebabRest<S extends string> = S extends `${infer First}${infer Rest}`? `${First extends Lowercase<First> ? '' : '-'}${Lowercase<First>}${CamelToKebabRest<Rest>}`: S
108+
type CamelToKebab<S extends string> = S extends `${infer First}${infer Rest}`? `${Lowercase<First>}${CamelToKebabRest<Rest>}`: S
109+
110+
/**
111+
* 将带驼峰字符串转成字符串,例如: ProjectName 转为 project-name
112+
*/
113+
export type VxeComponentKebabCaseKeys<T> = {
114+
[K in keyof T as K extends string ? CamelToKebab<K> : K]: T[K]
115+
}

0 commit comments

Comments
 (0)