@aochuang/common 1.0.0 → 1.0.1
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/common/loading/index.js +7 -0
- package/common/loading/loading.vue +71 -0
- package/common/tips/index.js +7 -0
- package/common/tips/tips.vue +82 -0
- package/common/tooltip/index.js +7 -0
- package/common/tooltip/popper.js +18 -0
- package/common/tooltip/tooltip.vue +55 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-boolean.vue +33 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-date-range.vue +30 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-date.vue +41 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-datetime-range.vue +34 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-datetime.vue +41 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-number-range.vue +67 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-number.vue +35 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-string.vue +41 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-value.vue +73 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item.vue +226 -0
- package/components/advanced-filter/advanced-filter-condition-toggle.vue +112 -0
- package/components/advanced-filter/advanced-filter-condition.vue +352 -0
- package/components/advanced-filter/advanced-filter-permanent-item.vue +10 -0
- package/components/advanced-filter/advanced-filter-permanent.vue +10 -0
- package/components/advanced-filter/advanced-filter-scene-form.vue +95 -0
- package/components/advanced-filter/advanced-filter-scene-item.vue +64 -0
- package/components/advanced-filter/advanced-filter-scene-manage.vue +264 -0
- package/components/advanced-filter/advanced-filter-scene-transfer.vue +283 -0
- package/components/advanced-filter/advanced-filter-scene.vue +199 -0
- package/components/advanced-filter/advanced-filter.vue +114 -0
- package/components/advanced-filter/index.js +36 -0
- package/components/advanced-filter/utils.js +132 -0
- package/components/autocomplete/autocomplete.vue +121 -0
- package/components/autocomplete/index.js +7 -0
- package/components/avatar/avatar.png +0 -0
- package/components/avatar/avatar.vue +212 -0
- package/components/avatar/index.js +7 -0
- package/components/brick-wall/brick-wall-skeleton.vue +125 -0
- package/components/brick-wall/brick-wall.vue +293 -0
- package/components/brick-wall/index.js +7 -0
- package/components/button/button.vue +537 -0
- package/components/button/index.js +7 -0
- package/components/button/utils.js +20 -0
- package/components/cascader/cascader.vue +184 -0
- package/components/cascader/index.js +7 -0
- package/components/cascader/util.js +50 -0
- package/components/checkbox/checkbox.vue +114 -0
- package/components/checkbox/index.js +7 -0
- package/components/checkbox-button/index.js +8 -0
- package/components/checkbox-group/checkbox-group.vue +11 -0
- package/components/checkbox-group/index.js +7 -0
- package/components/date-picker/date-picker.vue +300 -0
- package/components/date-picker/index.js +7 -0
- package/components/dialog/dialog.vue +182 -0
- package/components/dialog/index.js +14 -0
- package/components/dialog/utils.js +20 -0
- package/components/drawer/drawer.vue +186 -0
- package/components/drawer/index.js +14 -0
- package/components/drawer/utils.js +36 -0
- package/components/dropdown/dropdown-item.vue +63 -0
- package/components/dropdown/dropdown.vue +286 -0
- package/components/dropdown/index.js +16 -0
- package/components/empty/empty.vue +62 -0
- package/components/empty/index.js +7 -0
- package/components/filter/filter-group.vue +44 -0
- package/components/filter/filter-item.vue +122 -0
- package/components/filter/filter-more.vue +114 -0
- package/components/filter/filter.vue +407 -0
- package/components/filter/index.js +20 -0
- package/components/filter/refresh-line.svg +1 -0
- package/components/filter/util.js +5 -0
- package/components/form/form-cell.vue +231 -0
- package/components/form/form-group.vue +147 -0
- package/components/form/form-row.vue +51 -0
- package/components/form/form.vue +256 -0
- package/components/form/index.js +13 -0
- package/components/grid/grid-card-view/grid-card-view.vue +157 -0
- package/components/grid/grid-column.vue +136 -0
- package/components/grid/grid-filter/grid-filter-group.vue +41 -0
- package/components/grid/grid-filter/grid-filter-item.vue +68 -0
- package/components/grid/grid-filter/grid-filter.vue +115 -0
- package/components/grid/grid-filter/util.js +7 -0
- package/components/grid/grid-filter-operate/grid-filter-operate-item.vue +55 -0
- package/components/grid/grid-filter-operate/grid-filter-operate.vue +46 -0
- package/components/grid/grid-sort/grid-sort-proxy.js +27 -0
- package/components/grid/grid-sort/grid-sort.vue +205 -0
- package/components/grid/grid-sort/icons/asc.png +0 -0
- package/components/grid/grid-sort/icons/desc.png +0 -0
- package/components/grid/grid-sort/index.js +7 -0
- package/components/grid/grid-table-view/grid-table-view.vue +178 -0
- package/components/grid/grid-table.vue +547 -0
- package/components/grid/grid-toolbar/grid-batch-toolbar-proxy.js +21 -0
- package/components/grid/grid-toolbar/grid-batch-toolbar.vue +129 -0
- package/components/grid/grid-toolbar/grid-global-toolbar-proxy.js +21 -0
- package/components/grid/grid-toolbar/grid-global-toolbar.vue +37 -0
- package/components/grid/grid-toolbar/grid-more-toolbar-proxy.js +21 -0
- package/components/grid/grid-toolbar/grid-more-toolbar.vue +138 -0
- package/components/grid/grid-toolbar/grid-row-toolbar.vue +279 -0
- package/components/grid/grid-view-select.vue +78 -0
- package/components/grid/grid.vue +1102 -0
- package/components/grid/icons/more-line.svg +1 -0
- package/components/grid/icons/refresh.svg +14 -0
- package/components/grid/index.js +61 -0
- package/components/grid/util.js +31 -0
- package/components/icon/demo.css +539 -0
- package/components/icon/demo_index.html +7433 -0
- package/components/icon/icon.vue +96 -0
- package/components/icon/iconfont.css +1275 -0
- package/components/icon/iconfont.eot +0 -0
- package/components/icon/iconfont.js +1 -0
- package/components/icon/iconfont.json +2214 -0
- package/components/icon/iconfont.svg +455 -0
- package/components/icon/iconfont.ttf +0 -0
- package/components/icon/iconfont.woff +0 -0
- package/components/icon/iconfont.woff2 +0 -0
- package/components/icon/index.js +7 -0
- package/components/image/image.vue +299 -0
- package/components/image/index.js +12 -0
- package/components/image/util.js +26 -0
- package/components/index.js +153 -0
- package/components/loading/index.js +7 -0
- package/components/loading/loading.vue +130 -0
- package/components/menu/index.js +14 -0
- package/components/menu/menu-group.vue +240 -0
- package/components/menu/menu-item.vue +215 -0
- package/components/menu/menu.vue +64 -0
- package/components/message/index.js +19 -0
- package/components/message/message.js +28 -0
- package/components/message/message.less +6 -0
- package/components/message-box/index.js +10 -0
- package/components/message-box/message-box.js +140 -0
- package/components/message-box/message-box.less +5 -0
- package/components/pagination/index.js +7 -0
- package/components/pagination/pagination.vue +193 -0
- package/components/panel/index.js +7 -0
- package/components/panel/panel.vue +44 -0
- package/components/popover/index.js +7 -0
- package/components/popover/popover.vue +140 -0
- package/components/popup-select/index.js +7 -0
- package/components/popup-select/popup-select.vue +114 -0
- package/components/radio/index.js +7 -0
- package/components/radio/radio.vue +92 -0
- package/components/radio-button/index.js +7 -0
- package/components/radio-button/radio-button.vue +20 -0
- package/components/radio-group/index.js +7 -0
- package/components/radio-group/radio-group.vue +22 -0
- package/components/searchbox/index.js +7 -0
- package/components/searchbox/searchbox.vue +260 -0
- package/components/select/index.js +9 -0
- package/components/select/select-load-more.vue +53 -0
- package/components/select/select.vue +572 -0
- package/components/skeleton/index.js +14 -0
- package/components/skeleton/skeleton-rows.vue +52 -0
- package/components/skeleton/skeleton.vue +72 -0
- package/components/sortable/index.js +9 -0
- package/components/sortable/sortable-item.vue +77 -0
- package/components/sortable/sortable.vue +62 -0
- package/components/spinner/index.js +7 -0
- package/components/spinner/spinner.vue +121 -0
- package/components/spinner-range/index.js +7 -0
- package/components/spinner-range/spinner-range.vue +97 -0
- package/components/spinner-textarea/index.js +7 -0
- package/components/spinner-textarea/spinner-textarea.vue +65 -0
- package/components/switch/index.js +7 -0
- package/components/switch/switch.vue +105 -0
- package/components/tabs/index.js +10 -0
- package/components/tabs/tabs.vue +115 -0
- package/components/tag/index.js +9 -0
- package/components/tag/tag.less +30 -0
- package/components/text/index.js +7 -0
- package/components/text/text.vue +69 -0
- package/components/textarea/index.js +7 -0
- package/components/textarea/textarea.vue +229 -0
- package/components/textbox/index.js +7 -0
- package/components/textbox/textbox.vue +275 -0
- package/components/time-picker/index.js +7 -0
- package/components/time-picker/time-picker.vue +77 -0
- package/components/toolbar/index.js +14 -0
- package/components/toolbar/toolbar-item.vue +43 -0
- package/components/toolbar/toolbar.vue +81 -0
- package/components/tooltip/index.js +9 -0
- package/components/tooltip/tooltip.vue +86 -0
- package/components/transfer/index.js +7 -0
- package/components/transfer/transfer-load-more.vue +53 -0
- package/components/transfer/transfer.vue +245 -0
- package/components/tree/index.js +7 -0
- package/components/tree/tree.vue +326 -0
- package/components/tree/utils.js +122 -0
- package/components/video/index.js +7 -0
- package/components/video/video.vue +53 -0
- package/package.json +4 -1
- package/utils/date.js +55 -0
- package/utils/emitter.js +3 -0
- package/utils/json.js +19 -0
- package/utils/resize-event.js +35 -0
- package/utils/util.js +12 -0
- package/utils/utils.js +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
name: 'UiGridBatchToolbar',
|
|
3
|
+
inject: ['UiGrid'],
|
|
4
|
+
props: {
|
|
5
|
+
items: {
|
|
6
|
+
type: Array,
|
|
7
|
+
default: () => []
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
watch: {
|
|
11
|
+
items() {
|
|
12
|
+
this.$set(this.UiGrid.batchToolbarProps, 'items', this.items)
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
created() {
|
|
16
|
+
this.$set(this.UiGrid.batchToolbarProps, 'items', this.items)
|
|
17
|
+
},
|
|
18
|
+
render() {
|
|
19
|
+
return null
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ui-grid-toolbar-batch">
|
|
3
|
+
<ui-toolbar :close-dialog="false">
|
|
4
|
+
<ui-toolbar-item>
|
|
5
|
+
<span class="ui-grid-toolbar-batch__count">已选择<b>{{selecteds.length}}</b>项</span>
|
|
6
|
+
</ui-toolbar-item>
|
|
7
|
+
<ui-toolbar-item
|
|
8
|
+
v-for="(item, index) in innerItems"
|
|
9
|
+
:key="index"
|
|
10
|
+
>
|
|
11
|
+
<component
|
|
12
|
+
v-if="item.render"
|
|
13
|
+
:is="{render: item.render}"
|
|
14
|
+
></component>
|
|
15
|
+
<ui-button
|
|
16
|
+
v-else
|
|
17
|
+
v-bind="item"
|
|
18
|
+
:icon="item.icon"
|
|
19
|
+
size="small"
|
|
20
|
+
:click="handleRenderBtnClick(item)"
|
|
21
|
+
>
|
|
22
|
+
{{item.label}}
|
|
23
|
+
</ui-button>
|
|
24
|
+
</ui-toolbar-item>
|
|
25
|
+
</ui-toolbar>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
<script>
|
|
29
|
+
export default {
|
|
30
|
+
name: 'UiGridBatchToolbar',
|
|
31
|
+
props: {
|
|
32
|
+
title: {
|
|
33
|
+
type: String
|
|
34
|
+
},
|
|
35
|
+
data: {
|
|
36
|
+
type: Array,
|
|
37
|
+
default: () => []
|
|
38
|
+
},
|
|
39
|
+
selecteds: {
|
|
40
|
+
type: Array,
|
|
41
|
+
default: () => []
|
|
42
|
+
},
|
|
43
|
+
items: {
|
|
44
|
+
type: Array,
|
|
45
|
+
default: () => []
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
computed: {
|
|
49
|
+
isAllSelected() {
|
|
50
|
+
return this.data.length <= this.selecteds.length
|
|
51
|
+
},
|
|
52
|
+
renderData() {
|
|
53
|
+
return {
|
|
54
|
+
selecteds: this.selecteds
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
innerItems() {
|
|
58
|
+
const me = this
|
|
59
|
+
return (this.items || []).filter(v => {
|
|
60
|
+
if (typeof v.visible === 'boolean') {
|
|
61
|
+
return v.visible
|
|
62
|
+
}
|
|
63
|
+
if (typeof v.visible === 'function') {
|
|
64
|
+
return v.visible()
|
|
65
|
+
}
|
|
66
|
+
return true
|
|
67
|
+
}).map(v => {
|
|
68
|
+
const vv = Object.assign({}, v)
|
|
69
|
+
if (v.render) {
|
|
70
|
+
vv.render = (h) => {
|
|
71
|
+
return v.render(h, me.renderData)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return vv
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
methods: {
|
|
79
|
+
handleToggleCheckbox(evt) {
|
|
80
|
+
evt.stopPropagation()
|
|
81
|
+
this.$emit('clear-selection')
|
|
82
|
+
},
|
|
83
|
+
handleRenderBtnClick(item) {
|
|
84
|
+
if (item && item.click) {
|
|
85
|
+
return () => {
|
|
86
|
+
const result = item.click({
|
|
87
|
+
item,
|
|
88
|
+
selecteds: this.selecteds
|
|
89
|
+
})
|
|
90
|
+
if (result && result.then) {
|
|
91
|
+
item.loading = true
|
|
92
|
+
result.then(() => {
|
|
93
|
+
item.loading = false
|
|
94
|
+
this.$emit('batch-success')
|
|
95
|
+
}, () => {
|
|
96
|
+
item.loading = false
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
return result
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
</script>
|
|
106
|
+
<style lang="less">
|
|
107
|
+
.ui-grid-toolbar-batch{
|
|
108
|
+
width: 100%;
|
|
109
|
+
display: flex;
|
|
110
|
+
flex-direction: row;
|
|
111
|
+
align-items: center;
|
|
112
|
+
height: 32px;
|
|
113
|
+
}
|
|
114
|
+
.ui-grid-toolbar-batch__count{
|
|
115
|
+
display: inline-block;
|
|
116
|
+
color: #888;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.ui-grid-toolbar-batch__count b{
|
|
120
|
+
display: inline-block;
|
|
121
|
+
min-width: 20px;
|
|
122
|
+
text-align: center;
|
|
123
|
+
color: #0052cc;
|
|
124
|
+
}
|
|
125
|
+
.ui-grid-toolbar-batch__checkbox{
|
|
126
|
+
display: inline-block;
|
|
127
|
+
margin-left: 20px;
|
|
128
|
+
}
|
|
129
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
name: 'UiGridGlobalToolbar',
|
|
3
|
+
inject: ['UiGrid'],
|
|
4
|
+
props: {
|
|
5
|
+
items: {
|
|
6
|
+
type: Array,
|
|
7
|
+
default: () => []
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
watch: {
|
|
11
|
+
items() {
|
|
12
|
+
this.UiGrid.globalToolbarProps.items = this.items
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
created() {
|
|
16
|
+
this.UiGrid.globalToolbarProps.items = this.items
|
|
17
|
+
},
|
|
18
|
+
render() {
|
|
19
|
+
return null
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ui-toolbar class="ui-grid-global-toolbar" :close-dialog="false">
|
|
3
|
+
<ui-toolbar-item
|
|
4
|
+
v-for="(item, index) in innerItems"
|
|
5
|
+
:key="index"
|
|
6
|
+
>
|
|
7
|
+
<ui-button
|
|
8
|
+
:type="item.type"
|
|
9
|
+
:click="item.click"
|
|
10
|
+
:icon="item.icon"
|
|
11
|
+
@click.stop
|
|
12
|
+
>{{ item.label }}</ui-button>
|
|
13
|
+
</ui-toolbar-item>
|
|
14
|
+
</ui-toolbar>
|
|
15
|
+
</template>
|
|
16
|
+
<script>
|
|
17
|
+
export default {
|
|
18
|
+
name: 'UiGlobalToolbar',
|
|
19
|
+
props: {
|
|
20
|
+
items: {
|
|
21
|
+
type: Array,
|
|
22
|
+
default: () => []
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
computed: {
|
|
26
|
+
innerItems() {
|
|
27
|
+
return (this.items || []).filter(v => {
|
|
28
|
+
if (typeof v.visible === 'function') {
|
|
29
|
+
return v.visible() !== false
|
|
30
|
+
} else {
|
|
31
|
+
return v.visible !== false
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
name: 'UiGridGlobalToolbar',
|
|
3
|
+
inject: ['UiGrid'],
|
|
4
|
+
props: {
|
|
5
|
+
items: {
|
|
6
|
+
type: Array,
|
|
7
|
+
default: () => []
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
watch: {
|
|
11
|
+
items() {
|
|
12
|
+
this.UiGrid.moreToolbarProps.items = this.items
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
created() {
|
|
16
|
+
this.UiGrid.moreToolbarProps.items = this.items
|
|
17
|
+
},
|
|
18
|
+
render() {
|
|
19
|
+
return null
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ui-popover
|
|
3
|
+
ref="popover"
|
|
4
|
+
class="ui-grid-more-toolbar"
|
|
5
|
+
trigger="hover"
|
|
6
|
+
v-model="popoverVisible"
|
|
7
|
+
:visible-arrow="true"
|
|
8
|
+
v-if="visible"
|
|
9
|
+
>
|
|
10
|
+
<ui-button class="ui-grid-more-toolbar__handle" slot="reference" plain >
|
|
11
|
+
<span class="ui-grid-more-toolbar__handle-icon"></span>
|
|
12
|
+
</ui-button>
|
|
13
|
+
<ul class="ui-grid-more-toolbar__menu">
|
|
14
|
+
<li
|
|
15
|
+
v-for="(item, index) in visibleItems"
|
|
16
|
+
class="ui-grid-more-toolbar__item"
|
|
17
|
+
:class="{'is-loading': loadingMap[index]}"
|
|
18
|
+
:key="index"
|
|
19
|
+
@click="handleItemClick(item, index)"
|
|
20
|
+
>
|
|
21
|
+
<span class="ui-grid-more-toolbar__item-icon">
|
|
22
|
+
<ui-icon v-if="loadingMap[index]" name="loading"></ui-icon>
|
|
23
|
+
<ui-icon v-else-if="item.icon" :name="item.icon"></ui-icon>
|
|
24
|
+
</span>
|
|
25
|
+
<span class="ui-grid-more-toolbar__item-label">
|
|
26
|
+
{{item.label}}
|
|
27
|
+
</span>
|
|
28
|
+
</li>
|
|
29
|
+
</ul>
|
|
30
|
+
</ui-popover>
|
|
31
|
+
</template>
|
|
32
|
+
<script>
|
|
33
|
+
export default {
|
|
34
|
+
name: 'UiGridMoreToolbar',
|
|
35
|
+
props: {
|
|
36
|
+
items: {
|
|
37
|
+
type: Array,
|
|
38
|
+
default: () => []
|
|
39
|
+
},
|
|
40
|
+
extendItems: {
|
|
41
|
+
type: Array,
|
|
42
|
+
default: () => []
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
data() {
|
|
46
|
+
return {
|
|
47
|
+
popoverVisible: false,
|
|
48
|
+
loadingMap: {}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
computed: {
|
|
52
|
+
visible() {
|
|
53
|
+
return !!this.visibleItems.length
|
|
54
|
+
},
|
|
55
|
+
visibleItems() {
|
|
56
|
+
return this.allItems.filter(v => {
|
|
57
|
+
if (typeof v.visible === 'function') {
|
|
58
|
+
return v.visible()
|
|
59
|
+
}
|
|
60
|
+
return v.visible !== false
|
|
61
|
+
})
|
|
62
|
+
},
|
|
63
|
+
allItems() {
|
|
64
|
+
return [].concat(this.items || [], this.extendItems || [])
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
methods: {
|
|
68
|
+
handleItemClick(item, index) {
|
|
69
|
+
if (typeof item.click === 'function') {
|
|
70
|
+
const rs = item.click()
|
|
71
|
+
if (rs && rs.then) {
|
|
72
|
+
this.$set(this.loadingMap, index, true)
|
|
73
|
+
rs.then(() => {
|
|
74
|
+
this.$set(this.loadingMap, index, false)
|
|
75
|
+
this.checkClickVisible()
|
|
76
|
+
}, () => {
|
|
77
|
+
this.$set(this.loadingMap, index, false)
|
|
78
|
+
this.checkClickVisible()
|
|
79
|
+
})
|
|
80
|
+
} else {
|
|
81
|
+
this.popoverVisible = false
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
checkClickVisible() {
|
|
86
|
+
if (!Object.keys(this.loadingMap).some(v => this.loadingMap[v])) {
|
|
87
|
+
this.popoverVisible = false
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
</script>
|
|
93
|
+
<style>
|
|
94
|
+
.ui-grid-more-toolbar{
|
|
95
|
+
line-height: 1;
|
|
96
|
+
}
|
|
97
|
+
.ui-grid-more-toolbar__handle.ui-button{
|
|
98
|
+
padding-left: 9px;
|
|
99
|
+
padding-right: 9px;
|
|
100
|
+
}
|
|
101
|
+
.ui-grid-more-toolbar__handle-icon{
|
|
102
|
+
display: inline-block;
|
|
103
|
+
height: 18px;
|
|
104
|
+
width: 18px;
|
|
105
|
+
background: url('../icons/more-line.svg') no-repeat 50% 50%;
|
|
106
|
+
background-size: cover;
|
|
107
|
+
vertical-align: top;
|
|
108
|
+
opacity: .6;
|
|
109
|
+
}
|
|
110
|
+
.ui-grid-more-toolbar__menu{
|
|
111
|
+
list-style: none;
|
|
112
|
+
margin: 0;
|
|
113
|
+
padding: 6px 0;
|
|
114
|
+
min-width: 120px;
|
|
115
|
+
}
|
|
116
|
+
.ui-grid-more-toolbar__item-icon{
|
|
117
|
+
display: inline-block;
|
|
118
|
+
width: 16px;
|
|
119
|
+
height: 16px;
|
|
120
|
+
line-height: 16px;
|
|
121
|
+
margin-right: 3px;
|
|
122
|
+
vertical-align: top;
|
|
123
|
+
margin-top: 1px;
|
|
124
|
+
}
|
|
125
|
+
.ui-grid-more-toolbar__item{
|
|
126
|
+
padding: 6px 12px;
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
transition: all .3s;
|
|
129
|
+
}
|
|
130
|
+
.ui-grid-more-toolbar__item:hover:not(.is-loading){
|
|
131
|
+
background-color: #f0f8fc;
|
|
132
|
+
color: #00A0EB;
|
|
133
|
+
}
|
|
134
|
+
.ui-grid-more-toolbar__item.is-loading{
|
|
135
|
+
cursor: not-allowed;
|
|
136
|
+
color: #999;
|
|
137
|
+
}
|
|
138
|
+
</style>
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import UiButton from '../../button'
|
|
3
|
+
import BiTooltip from '../../../common/tooltip'
|
|
4
|
+
import UiPopover from '../../popover'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
name: 'UiGridRowToolbar',
|
|
8
|
+
props: {
|
|
9
|
+
items: {
|
|
10
|
+
type: Array,
|
|
11
|
+
default: () => []
|
|
12
|
+
},
|
|
13
|
+
moreIconDir: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: 'vertical',
|
|
16
|
+
validator (value) {
|
|
17
|
+
return ['horizon', 'vertical'].includes(value)
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
moreIconType: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: 'link',
|
|
23
|
+
validator (value) {
|
|
24
|
+
return ['button', 'link'].includes(value)
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
row: {
|
|
28
|
+
type: Object,
|
|
29
|
+
required: true
|
|
30
|
+
},
|
|
31
|
+
rowIndex: {
|
|
32
|
+
type: Number
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
computed: {
|
|
36
|
+
innerItems() {
|
|
37
|
+
return this.items.filter(v => {
|
|
38
|
+
const rs = typeof v === 'function' ? v({ row: this.row }) : v
|
|
39
|
+
if (rs.visible === false) {
|
|
40
|
+
return false
|
|
41
|
+
} else if (typeof rs.visible === 'function') {
|
|
42
|
+
return rs.visible({
|
|
43
|
+
row: this.row,
|
|
44
|
+
index: this.rowIndex
|
|
45
|
+
})
|
|
46
|
+
} else {
|
|
47
|
+
return true
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
},
|
|
51
|
+
rowItems() {
|
|
52
|
+
return this.innerItems.filter(v => v.more !== true)
|
|
53
|
+
},
|
|
54
|
+
moreItems() {
|
|
55
|
+
return this.innerItems.filter(v => v.more === true)
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
data() {
|
|
59
|
+
return {
|
|
60
|
+
showMorePopover: false,
|
|
61
|
+
loadingItems: []
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
methods: {
|
|
65
|
+
handleClick(item) {
|
|
66
|
+
if (typeof item.click === 'function') {
|
|
67
|
+
if (this.loadingItems.some(v => v === item)) {
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
const rs = item.click({
|
|
71
|
+
row: this.row,
|
|
72
|
+
index: this.rowIndex
|
|
73
|
+
})
|
|
74
|
+
if (rs && rs.then) {
|
|
75
|
+
this.loadingItems.push(item)
|
|
76
|
+
rs.then(rs => {
|
|
77
|
+
this.loadingItems = this.loadingItems.filter(v => v !== item)
|
|
78
|
+
}, () => {
|
|
79
|
+
this.loadingItems = this.loadingItems.filter(v => v !== item)
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
render(h) {
|
|
86
|
+
const items = (this.rowItems || []).map((item, index) => {
|
|
87
|
+
const nextItem = typeof item === 'function' ? item({ row: this.row }) : item
|
|
88
|
+
const loading = this.loadingItems.some(v => v === item)
|
|
89
|
+
const button = h(UiButton, {
|
|
90
|
+
class: ['ui-grid-row-toolbar__item-btn', { 'is-only-icon': !!nextItem.icon && !nextItem.text }],
|
|
91
|
+
props: {
|
|
92
|
+
link: true,
|
|
93
|
+
type: nextItem.type || 'primary',
|
|
94
|
+
icon: nextItem.icon,
|
|
95
|
+
tips: nextItem.tips,
|
|
96
|
+
loading: loading
|
|
97
|
+
},
|
|
98
|
+
on: {
|
|
99
|
+
click: (evt) => {
|
|
100
|
+
evt.stopPropagation()
|
|
101
|
+
return this.handleClick(nextItem)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}, [nextItem.label])
|
|
105
|
+
const control = nextItem.render ? h('span', {
|
|
106
|
+
key: index || nextItem.name,
|
|
107
|
+
class: 'ui-grid-row-toolbar__item'
|
|
108
|
+
}, [nextItem.render(h, nextItem, this.row)]) : h('span', {
|
|
109
|
+
key: index || nextItem.name,
|
|
110
|
+
class: 'ui-grid-row-toolbar__item'
|
|
111
|
+
}, [
|
|
112
|
+
nextItem.tips ? h(BiTooltip, {
|
|
113
|
+
props: {
|
|
114
|
+
text: nextItem.tips
|
|
115
|
+
}
|
|
116
|
+
}, [button]) : button
|
|
117
|
+
])
|
|
118
|
+
return control
|
|
119
|
+
})
|
|
120
|
+
if (this.moreItems && this.moreItems.length) {
|
|
121
|
+
const moreMenuItems = this.moreItems.map(v => {
|
|
122
|
+
const nextMoreItem = typeof v === 'function' ? v({ row: this.row }) : v
|
|
123
|
+
return h('div', {
|
|
124
|
+
class: [
|
|
125
|
+
'ui-grid-row-toolbar__more-item',
|
|
126
|
+
nextMoreItem.type ? 'is-' + nextMoreItem.type : 'is-primary',
|
|
127
|
+
nextMoreItem.divided ? 'is-divided' : ''
|
|
128
|
+
],
|
|
129
|
+
on: {
|
|
130
|
+
click: (evt) => {
|
|
131
|
+
evt.stopPropagation()
|
|
132
|
+
this.handleClick(nextMoreItem)
|
|
133
|
+
this.showMorePopover = false
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}, [nextMoreItem.label])
|
|
137
|
+
})
|
|
138
|
+
const moreMenu = h(UiPopover, {
|
|
139
|
+
props: {
|
|
140
|
+
trigger: 'hover',
|
|
141
|
+
value: this.showMorePopover
|
|
142
|
+
},
|
|
143
|
+
on: {
|
|
144
|
+
show: () => {
|
|
145
|
+
this.showMorePopover = true
|
|
146
|
+
},
|
|
147
|
+
hide: () => {
|
|
148
|
+
this.showMorePopover = false
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
scopedSlots: {
|
|
152
|
+
reference: () => {
|
|
153
|
+
return h(UiButton, {
|
|
154
|
+
class: 'ui-grid-row-toolbar__more-handle',
|
|
155
|
+
props: {
|
|
156
|
+
type: this.moreIconType === 'link' ? 'link' : 'default',
|
|
157
|
+
size: 'mini',
|
|
158
|
+
plain: true
|
|
159
|
+
}
|
|
160
|
+
}, [h('span', {
|
|
161
|
+
class: 'ui-grid-row-toolbar__more-handle-icon'
|
|
162
|
+
}, [h('ui-icon', {
|
|
163
|
+
props: {
|
|
164
|
+
name: this.moreIconDir === 'vertical' ? 'more-2-line' : 'more-line'
|
|
165
|
+
}
|
|
166
|
+
})])])
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}, [h('div', {
|
|
170
|
+
class: 'ui-grid-row-toolbar__more-menu'
|
|
171
|
+
}, moreMenuItems)])
|
|
172
|
+
items.push(h('span', {
|
|
173
|
+
class: 'ui-grid-row-toolbar__item',
|
|
174
|
+
key: 'more'
|
|
175
|
+
}, [moreMenu]))
|
|
176
|
+
}
|
|
177
|
+
return h('div', {
|
|
178
|
+
class: 'ui-grid-row-toolbar'
|
|
179
|
+
}, items)
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
</script>
|
|
183
|
+
<style lang="less">
|
|
184
|
+
.ui-grid-row-toolbar{
|
|
185
|
+
display: flex;
|
|
186
|
+
flex-direction: row;
|
|
187
|
+
align-items: center;
|
|
188
|
+
}
|
|
189
|
+
.ui-grid-row-toolbar__item{
|
|
190
|
+
margin-right: 10px;
|
|
191
|
+
}
|
|
192
|
+
.ui-grid-row-toolbar__item:last-child{
|
|
193
|
+
margin-right: 0;
|
|
194
|
+
}
|
|
195
|
+
.ui-grid-row-toolbar__more-handle{
|
|
196
|
+
padding-left: 6px;
|
|
197
|
+
padding-right: 6px;
|
|
198
|
+
vertical-align: top;
|
|
199
|
+
line-height: 1.4em;
|
|
200
|
+
&.ui-button {
|
|
201
|
+
&:hover {
|
|
202
|
+
text-decoration: none;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
.ui-grid-row-toolbar__more-handle-icon{
|
|
207
|
+
position: relative;
|
|
208
|
+
display: inline-block;
|
|
209
|
+
}
|
|
210
|
+
.ui-grid-row-toolbar__more-menu{
|
|
211
|
+
padding-top: 6px;
|
|
212
|
+
padding-bottom: 6px;
|
|
213
|
+
}
|
|
214
|
+
.ui-grid-row-toolbar__more-item{
|
|
215
|
+
padding: 3px 12px;
|
|
216
|
+
height: 28px;
|
|
217
|
+
line-height: 28px;
|
|
218
|
+
transition: all .25s;
|
|
219
|
+
cursor: pointer;
|
|
220
|
+
box-sizing: content-box;
|
|
221
|
+
&:hover {
|
|
222
|
+
background-color: #f8f8f9;
|
|
223
|
+
}
|
|
224
|
+
&.is-divided {
|
|
225
|
+
margin-top: 12px;
|
|
226
|
+
position: relative;
|
|
227
|
+
&:before {
|
|
228
|
+
content: '';
|
|
229
|
+
position: absolute;
|
|
230
|
+
top: -6px;
|
|
231
|
+
left: 0;
|
|
232
|
+
right: 0;
|
|
233
|
+
border-top: 1px solid #eee;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
&.is-success{
|
|
237
|
+
color: #7ebf4a;
|
|
238
|
+
&:hover {
|
|
239
|
+
color: #7ebf4a;
|
|
240
|
+
background-color: lighten(#7ebf4a, 20%);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
&.is-info{
|
|
244
|
+
color: #919399;
|
|
245
|
+
&:hover {
|
|
246
|
+
color: #919399;
|
|
247
|
+
background-color: lighten(#919399, 20%);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
&.is-danger{
|
|
251
|
+
color: #F91B22;
|
|
252
|
+
&:hover {
|
|
253
|
+
color: #F91B22;
|
|
254
|
+
background-color: lighten(#F91B22, 44%);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
&.is-primary{
|
|
258
|
+
color: #5f9efa;
|
|
259
|
+
&:hover {
|
|
260
|
+
color: #5f9efa;
|
|
261
|
+
background-color: lighten(#5f9efa, 30%);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
&.is-warning{
|
|
265
|
+
color: #dba54a;
|
|
266
|
+
&:hover {
|
|
267
|
+
color: #dba54a;
|
|
268
|
+
background-color: lighten(#dba54a, 20%);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
.ui-grid-row-toolbar__item-btn{
|
|
273
|
+
&.is-only-icon {
|
|
274
|
+
.ui-icon {
|
|
275
|
+
font-size: 18px;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
</style>
|