File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import { clipboard } from './src/clipboard'
1717import { permission } from './src/permission'
1818import { log } from './src/log'
1919import { globalMixins } from './src/mixins'
20+ import XEUtils from 'xe-utils'
2021
2122import { VxeGlobalComponents , VxeUIPluginObject } from '../types'
2223
@@ -41,6 +42,7 @@ export function getComponent (name: keyof VxeGlobalComponents) {
4142export function component ( comp : any ) {
4243 if ( comp && comp . name ) {
4344 components [ comp . name ] = comp
45+ components [ XEUtils . kebabCase ( comp . name ) ] = comp
4446 }
4547}
4648
Original file line number Diff line number Diff 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+ }
You can’t perform that action at this time.
0 commit comments