vsyswin-ui 0.2.61 → 0.2.64

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vsyswin-ui",
3
- "version": "0.2.61",
3
+ "version": "0.2.64",
4
4
  "main": "lib/vsyswin-ui.umd.min.js",
5
5
  "private": false,
6
6
  "description": "Vue2.x的应用组件库.",
@@ -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,72 @@
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
+ num() {
15
+ return this.$parent.num
16
+ }
17
+ },
18
+ render(h) {
19
+ let contents = []
20
+ if (this.buttons.length <= this.num) {
21
+ contents = this.buttons.map((btn) => {
22
+ return btn.$slots.default
23
+ })
24
+ } else {
25
+ const idx = this.num - 1
26
+ const preBtns = this.buttons.slice(0, idx).map((btn) => btn.$slots.default)
27
+ const moreBtns = this.buttons.slice(idx).map((btn) => {
28
+ const slotDefault = btn.$slots.default
29
+ const elBtn = slotDefault[0].componentOptions.children[0]
30
+ const listenersFn = slotDefault[0].componentOptions.listeners.click
31
+ const icon = slotDefault[0].componentOptions.propsData.icon || ''
32
+ const text = elBtn.text
33
+ return h(
34
+ 'el-dropdown-item',
35
+ {
36
+ props: { icon },
37
+ nativeOn: {
38
+ click: listenersFn
39
+ }
40
+ },
41
+ [text]
42
+ )
43
+ })
44
+ const moreDiv = h('div', { class: 'sy-button-dots' }, [h('i', { class: 'el-icon-more' })])
45
+ const dropDown = h(
46
+ 'el-dropdown',
47
+ {
48
+ props: { trigger: this.trigger, size: 'medium', placement: 'bottom-end' }
49
+ },
50
+ [moreDiv, h('el-dropdown-menu', { slot: 'dropdown' }, moreBtns)]
51
+ )
52
+ contents = [...preBtns, dropDown]
53
+ }
54
+
55
+ return h(
56
+ 'div',
57
+ {
58
+ class: 'sy-buttons'
59
+ },
60
+ contents
61
+ )
62
+ }
63
+ }
64
+ </script>
65
+
66
+ <style lang="scss" scoped>
67
+ .sy-button-dots {
68
+ width: 18px;
69
+ height: 18px;
70
+ cursor: pointer;
71
+ }
72
+ </style>
@@ -0,0 +1,15 @@
1
+ <script>
2
+ export default {
3
+ name: 'SyButtonItem',
4
+ mounted() {
5
+ this.$parent.buttons.push(this)
6
+ },
7
+ render(h) {
8
+ return h('div', { style: { display: 'none' } })
9
+ }
10
+ }
11
+ </script>
12
+
13
+ <style lang="scss" scoped>
14
+
15
+ </style>
@@ -0,0 +1,36 @@
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
+ // 触发下拉框的方式
15
+ trigger: {
16
+ type: String,
17
+ default: 'hover',
18
+ validator: (value) => ['hover', 'click'].includes(value)
19
+ },
20
+ // 最多显示多少数量的按钮,超过此数量是显示下拉菜单
21
+ num: {
22
+ type: Number,
23
+ default: 3
24
+ }
25
+ },
26
+ data() {
27
+ return {
28
+ buttons: []
29
+ }
30
+ }
31
+ }
32
+ </script>
33
+
34
+ <style lang="scss" scoped>
35
+
36
+ </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,
@@ -504,3 +504,14 @@ input:focus {
504
504
  color: #000;
505
505
  }
506
506
  }
507
+
508
+ .sy-btn-ellipsis {
509
+ .el-button {
510
+ outline: none !important;
511
+ }
512
+ .el-button:hover, .el-button:active, .el-button:focus {
513
+ background: none !important;
514
+ color: #66b1ff !important;
515
+ border: 1px solid transparent !important;
516
+ }
517
+ }