@bsgoal/common 2.14.4 → 2.14.6
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/dist/index.mjs +1197 -1166
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +7 -7
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -1
- package/src/components/bsgoal-base-tree/demo.vue +16 -5
- package/src/components/bsgoal-base-tree/index.vue +41 -17
- package/src/components/bsgoal-base-tree-table/demo.vue +7 -2
- package/src/components/bsgoal-base-tree-table/index.vue +10 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bsgoal/common",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"issue": "npm run build && npm publish"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
+
"@bsgoal/common": "2.14.4",
|
|
29
30
|
"element-plus": "^2.3.3",
|
|
30
31
|
"vue": "^3.3.4",
|
|
31
32
|
"vue-router": "^4.1.6",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-04-21 08:43:39
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-06-
|
|
5
|
+
* @LastEditTime: 2023-06-27 11:49:24
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-tree\demo.vue
|
|
7
7
|
* @Description: 左侧树的演示
|
|
8
8
|
*
|
|
@@ -45,7 +45,7 @@ const createData = (maxDeep, maxChildren, minNodesNumber, deep = 1, key = 'node'
|
|
|
45
45
|
treeData.value = createData(4, 4, 4)
|
|
46
46
|
|
|
47
47
|
const triggerTreeClick = (value, node, treeNode, event) => {
|
|
48
|
-
console.log('triggerTreeClick ================')
|
|
48
|
+
console.log('triggerTreeClick ================')
|
|
49
49
|
// console.log('value', value)
|
|
50
50
|
// console.log('node', node)
|
|
51
51
|
// console.log('treeNode', treeNode)
|
|
@@ -64,6 +64,8 @@ const treeLazyLoad = (node) => {
|
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
label: 'label2-2',
|
|
67
|
+
key: 'label2-2',
|
|
68
|
+
|
|
67
69
|
children: [
|
|
68
70
|
{
|
|
69
71
|
label: 'label2-2-1'
|
|
@@ -86,7 +88,8 @@ const treeInitNode = (node) => {
|
|
|
86
88
|
resolve([
|
|
87
89
|
{
|
|
88
90
|
value: 'value1',
|
|
89
|
-
label: 'label1'
|
|
91
|
+
label: 'label1',
|
|
92
|
+
nodeKey:'label1'
|
|
90
93
|
}
|
|
91
94
|
])
|
|
92
95
|
}, 1000)
|
|
@@ -96,6 +99,7 @@ const treeInitNode = (node) => {
|
|
|
96
99
|
const triggerAddClick = (params = '') => {
|
|
97
100
|
console.log('triggerAddClick', params)
|
|
98
101
|
}
|
|
102
|
+
|
|
99
103
|
</script>
|
|
100
104
|
<template>
|
|
101
105
|
<div class="bsgoal-base-tree-demo">
|
|
@@ -107,16 +111,23 @@ const triggerAddClick = (params = '') => {
|
|
|
107
111
|
label: 'label999',
|
|
108
112
|
children: [
|
|
109
113
|
{
|
|
110
|
-
label: '8888'
|
|
114
|
+
label: '8888',
|
|
115
|
+
key: '8888'
|
|
111
116
|
}
|
|
112
117
|
]
|
|
113
118
|
}
|
|
114
119
|
]"
|
|
120
|
+
node-key="nodeKey"
|
|
115
121
|
:lazy-load="treeLazyLoad"
|
|
116
122
|
:init-node="treeInitNode"
|
|
123
|
+
:expanded-keys="['label1']"
|
|
117
124
|
@on-click="triggerTreeClick"
|
|
118
125
|
@on-click-add="triggerAddClick"
|
|
119
|
-
|
|
126
|
+
>
|
|
127
|
+
<template #prefix="{data}">
|
|
128
|
+
<div>66</div>
|
|
129
|
+
</template>
|
|
130
|
+
</BsgoalBaseTree>
|
|
120
131
|
</div>
|
|
121
132
|
</div>
|
|
122
133
|
</template>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-04-21 08:43:33
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-06-
|
|
5
|
+
* @LastEditTime: 2023-06-27 11:47:51
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-tree\index.vue
|
|
7
7
|
* @Description: 虚拟化树型结构 公共组件
|
|
8
8
|
*
|
|
@@ -66,6 +66,20 @@ const props = defineProps({
|
|
|
66
66
|
initNode: {
|
|
67
67
|
type: [Function],
|
|
68
68
|
default: null
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* 节点的 key
|
|
72
|
+
*/
|
|
73
|
+
nodeKey: {
|
|
74
|
+
type: [String],
|
|
75
|
+
default: 'key'
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* 默认展开的节点
|
|
79
|
+
*/
|
|
80
|
+
expandedKeys: {
|
|
81
|
+
type: [Array],
|
|
82
|
+
default: () => []
|
|
69
83
|
}
|
|
70
84
|
})
|
|
71
85
|
|
|
@@ -132,8 +146,8 @@ const loadNode = async (node, resolve, props) => {
|
|
|
132
146
|
}
|
|
133
147
|
|
|
134
148
|
const lazyGet = computed(() => {
|
|
135
|
-
const { lazyLoad = null
|
|
136
|
-
if(lazyLoad && initNode
|
|
149
|
+
const { lazyLoad = null, initNode = null } = props
|
|
150
|
+
if (lazyLoad && initNode) {
|
|
137
151
|
return true
|
|
138
152
|
}
|
|
139
153
|
return false
|
|
@@ -162,30 +176,40 @@ const handleItemAdd = (node = null, data = {}) => {
|
|
|
162
176
|
<el-tree
|
|
163
177
|
ref="EL_TREE_REF"
|
|
164
178
|
highlight-current
|
|
179
|
+
auto-expand-parent
|
|
165
180
|
empty-text="暂无数据"
|
|
181
|
+
:nodeKey="nodeKey"
|
|
166
182
|
:data="treeData"
|
|
167
183
|
:lazy="lazyGet"
|
|
168
184
|
:load="(node, resolve) => loadNode(node, resolve, props)"
|
|
169
185
|
:expand-on-click-node="false"
|
|
170
186
|
:props="treeProps"
|
|
171
187
|
:filter-node-method="filterNode"
|
|
188
|
+
:default-expanded-keys="expandedKeys"
|
|
172
189
|
@node-click="clickNodeTree"
|
|
173
190
|
>
|
|
174
191
|
<template #default="{ node, data }">
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
<
|
|
184
|
-
|
|
185
|
-
</
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
192
|
+
<slot :data="data">
|
|
193
|
+
<div class="base_tree_node">
|
|
194
|
+
<!-- S 节点前图标 -->
|
|
195
|
+
<div v-if="$slots.prefix">
|
|
196
|
+
<slot name="prefix" :data="data" ></slot>
|
|
197
|
+
</div>
|
|
198
|
+
<!-- E 节点前图标 -->
|
|
199
|
+
<!-- S 节点名称 -->
|
|
200
|
+
<span class="base_tree_node_label">
|
|
201
|
+
{{ node.label }}
|
|
202
|
+
</span>
|
|
203
|
+
<!-- E 节点名称 -->
|
|
204
|
+
<!-- S 操作符号 -->
|
|
205
|
+
<span class="base_tree_node_icon" v-if="data.hasIcon">
|
|
206
|
+
<el-icon color="var(--el-color-primary)" @click.stop="handleItemAdd(node, data)">
|
|
207
|
+
<Plus />
|
|
208
|
+
</el-icon>
|
|
209
|
+
</span>
|
|
210
|
+
<!-- E 操作符号 -->
|
|
211
|
+
</div>
|
|
212
|
+
</slot>
|
|
189
213
|
</template>
|
|
190
214
|
</el-tree>
|
|
191
215
|
<!-- E 树结构 -->
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-06-20 09:20:51
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-06-
|
|
5
|
+
* @LastEditTime: 2023-06-27 11:27:35
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-tree-table\demo.vue
|
|
7
7
|
* @Description: 树 + 列表 + 演示
|
|
8
8
|
*
|
|
@@ -770,7 +770,7 @@ const triggerTreeAddClick = (params = '') => {
|
|
|
770
770
|
}
|
|
771
771
|
|
|
772
772
|
const treeData = ref([])
|
|
773
|
-
|
|
773
|
+
const expandedKeys = ['label2-2']
|
|
774
774
|
setTimeout(() => {
|
|
775
775
|
treeData.value = ref([
|
|
776
776
|
{
|
|
@@ -779,6 +779,7 @@ setTimeout(() => {
|
|
|
779
779
|
hasIcon: true
|
|
780
780
|
},
|
|
781
781
|
{
|
|
782
|
+
key:'label2-2',
|
|
782
783
|
label: 'label2-2',
|
|
783
784
|
children: [
|
|
784
785
|
{
|
|
@@ -807,6 +808,7 @@ const test = () => {
|
|
|
807
808
|
ref="BSGOAL_BASE_TREE_TABLE_REF"
|
|
808
809
|
selection
|
|
809
810
|
operation
|
|
811
|
+
:expandedKeys="expandedKeys"
|
|
810
812
|
:tree-data="treeData"
|
|
811
813
|
:page-size="40"
|
|
812
814
|
:fetch="fetch"
|
|
@@ -815,6 +817,9 @@ const test = () => {
|
|
|
815
817
|
@on-click-tree="triggerTreeClick"
|
|
816
818
|
@on-add-tree="triggerTreeAddClick"
|
|
817
819
|
>
|
|
820
|
+
<!-- <template #tree="{data}">
|
|
821
|
+
<div>{{ data }}</div>
|
|
822
|
+
</template> -->
|
|
818
823
|
<!-- <template #prop1="{row}">
|
|
819
824
|
<div>{{ row }}</div>
|
|
820
825
|
</template> -->
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-06-20 09:20:44
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-06-
|
|
5
|
+
* @LastEditTime: 2023-06-27 11:50:21
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-tree-table\index.vue
|
|
7
7
|
* @Description: 树结构 + 列表
|
|
8
8
|
*
|
|
@@ -233,7 +233,15 @@ const tableStyler = computed(() => {
|
|
|
233
233
|
@on-switch="triggerTreeSwitch"
|
|
234
234
|
@on-add="triggerTreeAdd"
|
|
235
235
|
@on-click="triggerTreeClick"
|
|
236
|
-
|
|
236
|
+
>
|
|
237
|
+
<template #default="{ data }">
|
|
238
|
+
<slot name="tree" :data="data"></slot>
|
|
239
|
+
</template>
|
|
240
|
+
|
|
241
|
+
<template #prefix="{ data }">
|
|
242
|
+
<slot name="tree-prefix" :data="data"></slot>
|
|
243
|
+
</template>
|
|
244
|
+
</BsgoalBaseTree>
|
|
237
245
|
<!-- E 树 -->
|
|
238
246
|
</div>
|
|
239
247
|
<div class="base_tree_table--table" :style="tableStyler">
|