Skip to content

Commit f7983d9

Browse files
committed
feat: rename ctree to vtree
1 parent 0ac3cd7 commit f7983d9

34 files changed

+243
-216
lines changed

examples/Mobile.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,22 @@ function onResetBtnClick() {
102102

103103
<style lang="less" scoped>
104104
105-
:deep(.ctree-tree-node_selected) {
105+
:deep(.vtree-tree-node_selected) {
106106
background-color: #eef5ff;
107107
border-radius: 4px;
108-
.ctree-tree-node__title {
108+
.vtree-tree-node__title {
109109
background: none;
110110
}
111111
}
112-
:deep(.ctree-tree-node__wrapper.ctree-tree-node__wrapper_is-leaf.ctree-tree-node_checked) {
112+
:deep(.vtree-tree-node__wrapper.vtree-tree-node__wrapper_is-leaf.vtree-tree-node_checked) {
113113
background-color: #eef5ff;
114114
border-radius: 4px;
115115
}
116-
:deep(.ctree-tree-node__checkbox_wrapper) {
116+
:deep(.vtree-tree-node__checkbox_wrapper) {
117117
display: none;
118118
}
119-
:deep(.ctree-tree-node__wrapper_is-leaf) {
120-
.ctree-tree-node__checkbox_wrapper {
119+
:deep(.vtree-tree-node__wrapper_is-leaf) {
120+
.vtree-tree-node__checkbox_wrapper {
121121
display: flex;
122122
}
123123
}

src/components/LoadingIcon.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<svg viewBox="0 0 50 50">
33
<circle
4-
class="ctree-loading-icon__circle"
4+
class="vtree-loading-icon__circle"
55
cx="25"
66
cy="25"
77
r="20"

src/components/Tree.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<!-- 可见节点区域,包括上下两片空白加渲染的节点 -->
1010
<div :class="blockAreaCls">
1111
<div :style="{ height: `${topSpaceHeight}px` }"></div>
12-
<CTreeNode
12+
<VTreeNode
1313
v-for="node in renderNodes"
1414
v-bind="treeNodeProps"
1515
:key="node[keyField]"
@@ -211,7 +211,7 @@ import {
211211
toRefs,
212212
} from 'vue'
213213
import TreeStore, { TreeNode } from '../store'
214-
import CTreeNode from './TreeNode.vue'
214+
import VTreeNode from './TreeNode.vue'
215215
import LoadingIcon from './LoadingIcon.vue'
216216
import {
217217
ignoreEnum,
@@ -638,7 +638,7 @@ defineExpose({
638638
})
639639
640640
defineOptions({
641-
name: 'CTree',
641+
name: 'VTree',
642642
inheritAttrs: false,
643643
})
644644
</script>

src/components/TreeDrop.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</div>
2121

2222
<!-- 下拉框 -->
23-
<transition name="ctree-dropdown">
23+
<transition name="vtree-dropdown">
2424
<div
2525
ref="dropdownRef"
2626
v-show="dropdownVisible"
@@ -29,7 +29,7 @@
2929
height: `${dropHeight}px`
3030
}"
3131
>
32-
<CTreeSearch
32+
<VTreeSearch
3333
ref="treeSearchRef"
3434
v-bind="props"
3535
v-model="treeSearchValue"
@@ -41,7 +41,7 @@
4141
<template v-for="(_, slot) in $slots" v-slot:[slot]="scope">
4242
<slot :name="slot" v-bind="scope"></slot>
4343
</template>
44-
</CTreeSearch>
44+
</VTreeSearch>
4545
</div>
4646
</transition>
4747
</div>
@@ -97,12 +97,12 @@ import {
9797
watch,
9898
nextTick,
9999
} from 'vue'
100-
import CTreeSearch, { DEFAULT_TREE_SEARCH_PROPS, TreeSearchProps } from './TreeSearch.vue'
100+
import VTreeSearch, { DEFAULT_TREE_SEARCH_PROPS, TreeSearchProps } from './TreeSearch.vue'
101101
import { TreeNode } from '../store'
102102
import { TREE_SEARCH_API_METHODS, placementEnum } from '../constants'
103103
import { TREE_DROP_EVENTS, TREE_SEARCH_EVENTS } from '../constants/events'
104104
import { TreeNodeKeyType, TreeDropSlotProps, PlacementType } from '../types'
105-
import { getCtreeMethods } from '../utils'
105+
import { getVTreeMethods } from '../utils'
106106
import { useTreeDropCls } from '../hooks/useTreeDropCls'
107107
108108
const props = withDefaults(defineProps<TreeDropProps>(), DEFAULT_TREE_DROP_PROPS)
@@ -143,7 +143,7 @@ const {
143143
144144
const referenceRef = ref()
145145
const dropdownRef = ref()
146-
const treeSearchRef = ref<InstanceType<typeof CTreeSearch> | null>(null)
146+
const treeSearchRef = ref<InstanceType<typeof VTreeSearch> | null>(null)
147147
const slotProps = reactive<TreeDropSlotProps>({
148148
/** 多选选中的节点 */
149149
checkedNodes: [] as TreeNode[],
@@ -391,11 +391,11 @@ watch(
391391
//#endregion
392392
393393
defineExpose({
394-
...getCtreeMethods(TREE_SEARCH_API_METHODS, treeSearchRef),
394+
...getVTreeMethods(TREE_SEARCH_API_METHODS, treeSearchRef),
395395
})
396396
397397
defineOptions({
398-
name: 'CTreeDrop',
398+
name: 'VTreeDrop',
399399
inheritAttrs: false,
400400
})
401401
</script>

src/components/TreeNode.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,6 @@ function handleDrop(e: DragEvent): void {
302302
}
303303
304304
defineOptions({
305-
name: 'CTreeNode',
305+
name: 'VTreeNode',
306306
})
307307
</script>

src/components/TreeSearch.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
<!-- 树区域 -->
3333
<div :class="treeWrapperCls">
34-
<CTree
34+
<VTree
3535
ref="treeRef"
3636
v-bind="props"
3737
v-model="treeModelValue"
@@ -42,7 +42,7 @@
4242
<template v-for="(_, slot) in $slots" :name="slot" v-slot="scope">
4343
<slot :name="slot" v-bind="scope"></slot>
4444
</template>
45-
</CTree>
45+
</VTree>
4646
</div>
4747

4848
<!-- 底部信息 -->
@@ -108,10 +108,10 @@ import {
108108
computed,
109109
onMounted,
110110
} from 'vue'
111-
import CTree, { DEFAULT_TREE_PROPS, TreeProps } from './Tree.vue'
111+
import VTree, { DEFAULT_TREE_PROPS, TreeProps } from './Tree.vue'
112112
import { useTreeSearchCls } from '../hooks/useTreeSearchCls'
113113
import { TreeNode } from '..'
114-
import { getCtreeMethods } from '../utils'
114+
import { getVTreeMethods } from '../utils'
115115
import { TREE_API_METHODS } from '../constants'
116116
import { TREE_EVENTS, TREE_SEARCH_EVENTS } from '../constants/events'
117117
@@ -141,7 +141,7 @@ const isShowingChecked = ref(false)
141141
const keyword = ref('')
142142
const debounceTimer = ref<number | undefined>(undefined)
143143
const checkedCount = ref(0)
144-
const treeRef = ref<InstanceType<typeof CTree> | null>(null)
144+
const treeRef = ref<InstanceType<typeof VTree> | null>(null)
145145
146146
const {
147147
wrapperCls,
@@ -325,14 +325,14 @@ onMounted(() => {
325325
})
326326
327327
defineExpose({
328-
...getCtreeMethods(TREE_API_METHODS, treeRef),
328+
...getVTreeMethods(TREE_API_METHODS, treeRef),
329329
clearKeyword,
330330
getKeyword,
331331
search,
332332
})
333333
334334
defineOptions({
335-
name: 'CTreeSearch',
335+
name: 'VTreeSearch',
336336
inheritAttrs: false,
337337
})
338338
</script>

src/hooks/useTreeCls.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { computed } from "vue"
22

3-
const prefixCls = 'ctree-tree'
3+
const prefixCls = 'vtree-tree'
44

55
export { prefixCls as TREE_PREFIX_CLS }
66

src/hooks/useTreeDropCls.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Ref, computed } from 'vue'
22
import { TREE_SEARCH_PREFIX_CLS as treeSearchPrefixCls } from './useTreeSearchCls'
33
import { TreeDropProps } from '../components/TreeDrop.vue'
44

5-
const prefixCls = 'ctree-tree-drop'
5+
const prefixCls = 'vtree-tree-drop'
66

77
export { prefixCls as TREE_DROP_PREFIX_CLS }
88

src/hooks/useTreeNodeCls.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Ref, computed } from "vue"
22
import { TreeNodeProps } from "../components/TreeNode.vue"
33

4-
const prefixCls = 'ctree-tree-node'
4+
const prefixCls = 'vtree-tree-node'
55

66
export { prefixCls as TREE_NODE_PREFIX_CLS }
77

src/hooks/useTreeSearchCls.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Ref, computed } from 'vue'
22
import { TREE_NODE_PREFIX_CLS as treeNodePrefixCls } from './useTreeNodeCls'
33
import { TreeSearchProps } from '../components/TreeSearch.vue'
44

5-
const prefixCls = 'ctree-tree-search'
5+
const prefixCls = 'vtree-tree-search'
66

77
export { prefixCls as TREE_SEARCH_PREFIX_CLS }
88

0 commit comments

Comments
 (0)