vsyswin-ui 0.2.61 → 0.2.62
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/lib/vsyswin-ui.common.js +257 -4
- package/lib/vsyswin-ui.common.js.map +1 -1
- package/lib/vsyswin-ui.umd.js +257 -4
- package/lib/vsyswin-ui.umd.js.map +1 -1
- package/lib/vsyswin-ui.umd.min.js +32 -32
- package/lib/vsyswin-ui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/packages/button-ellipsis/index.js +14 -0
- package/packages/button-ellipsis/src/button-container.vue +68 -0
- package/packages/button-ellipsis/src/button-item.vue +15 -0
- package/packages/button-ellipsis/src/button-list.vue +30 -0
- package/packages/index.js +6 -1
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
import buttonList from './src/button-list.vue'
|
|
3
|
+
import buttonItem from './src/button-item.vue'
|
|
4
|
+
|
|
5
|
+
// 为组件提供 install 安装方法,供按需引入
|
|
6
|
+
buttonList.install = function (Vue) {
|
|
7
|
+
Vue.component(buttonList.name, buttonList)
|
|
8
|
+
}
|
|
9
|
+
buttonItem.install = function (Vue) {
|
|
10
|
+
Vue.component(buttonItem.name, buttonItem)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// 默认导出组件
|
|
14
|
+
export default { buttonList, buttonItem }
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export default {
|
|
3
|
+
name: 'SyButtonContainer',
|
|
4
|
+
props: {
|
|
5
|
+
buttons: {
|
|
6
|
+
type: Array,
|
|
7
|
+
default: () => []
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
computed: {
|
|
11
|
+
trigger() {
|
|
12
|
+
return this.$parent.trigger
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
render(h) {
|
|
16
|
+
let contents = []
|
|
17
|
+
if (this.buttons.length <= 3) {
|
|
18
|
+
contents = this.buttons.map((btn) => {
|
|
19
|
+
return btn.$slots.default
|
|
20
|
+
})
|
|
21
|
+
} else {
|
|
22
|
+
const preBtns = this.buttons.slice(0, 2).map((btn) => btn.$slots.default)
|
|
23
|
+
const moreBtns = this.buttons.slice(2).map((btn) => {
|
|
24
|
+
const slotDefault = btn.$slots.default
|
|
25
|
+
const elBtn = slotDefault[0].componentOptions.children[0]
|
|
26
|
+
const listenersFn = slotDefault[0].componentOptions.listeners.click
|
|
27
|
+
const icon = slotDefault[0].componentOptions.propsData.icon || ''
|
|
28
|
+
const text = elBtn.text
|
|
29
|
+
return h(
|
|
30
|
+
'el-dropdown-item',
|
|
31
|
+
{
|
|
32
|
+
props: { icon },
|
|
33
|
+
nativeOn: {
|
|
34
|
+
click: listenersFn
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
[text]
|
|
38
|
+
)
|
|
39
|
+
})
|
|
40
|
+
const moreDiv = h('div', { class: 'sy-button-dots' }, [h('i', { class: 'el-icon-more' })])
|
|
41
|
+
const dropDown = h(
|
|
42
|
+
'el-dropdown',
|
|
43
|
+
{
|
|
44
|
+
props: { trigger: this.trigger, size: 'medium', placement: 'bottom-end' }
|
|
45
|
+
},
|
|
46
|
+
[moreDiv, h('el-dropdown-menu', { slot: 'dropdown' }, moreBtns)]
|
|
47
|
+
)
|
|
48
|
+
contents = [...preBtns, dropDown]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return h(
|
|
52
|
+
'div',
|
|
53
|
+
{
|
|
54
|
+
class: 'sy-buttons'
|
|
55
|
+
},
|
|
56
|
+
contents
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<style lang="scss" scoped>
|
|
63
|
+
.sy-button-dots {
|
|
64
|
+
width: 18px;
|
|
65
|
+
height: 18px;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
}
|
|
68
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sy-btn-ellipsis">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
<button-container :buttons="buttons"></button-container>
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import buttonContainer from './button-container.vue'
|
|
10
|
+
export default {
|
|
11
|
+
name: 'SyButtonList',
|
|
12
|
+
components: { buttonContainer },
|
|
13
|
+
props: {
|
|
14
|
+
trigger: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'hover',
|
|
17
|
+
validator: (value) => ['hover', 'click'].includes(value)
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
buttons: []
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<style lang="scss" scoped>
|
|
29
|
+
|
|
30
|
+
</style>
|
package/packages/index.js
CHANGED
|
@@ -13,9 +13,12 @@ import paging from './paging'
|
|
|
13
13
|
import newSearchBar from './newSearchBar' // 高级筛选
|
|
14
14
|
import table from './table' // 表格组件
|
|
15
15
|
import dragSet from './drag-set'
|
|
16
|
+
import buttonEllipsis from './button-ellipsis'
|
|
17
|
+
|
|
18
|
+
const { buttonList, buttonItem } = buttonEllipsis
|
|
16
19
|
|
|
17
20
|
// 存储组件列表
|
|
18
|
-
const components = [layout, searchTree, selectProject, selectTree, SearchBar, simpleSearchBar, inputMore, paging, newSearchBar, table, dragSet]
|
|
21
|
+
const components = [layout, searchTree, selectProject, selectTree, buttonItem, buttonList, SearchBar, simpleSearchBar, inputMore, paging, newSearchBar, table, dragSet]
|
|
19
22
|
|
|
20
23
|
// 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
|
|
21
24
|
const install = function (Vue) {
|
|
@@ -38,6 +41,8 @@ export default {
|
|
|
38
41
|
searchTree,
|
|
39
42
|
selectProject,
|
|
40
43
|
selectTree,
|
|
44
|
+
buttonItem,
|
|
45
|
+
buttonList,
|
|
41
46
|
SearchBar,
|
|
42
47
|
simpleSearchBar,
|
|
43
48
|
inputMore,
|