@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,136 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<vxe-column
|
|
3
|
+
:field="prop"
|
|
4
|
+
:title="label"
|
|
5
|
+
:width="width"
|
|
6
|
+
:min-width="minWidth"
|
|
7
|
+
:fixed="innerFixed"
|
|
8
|
+
:align="align"
|
|
9
|
+
:sortable="sortable"
|
|
10
|
+
:tree-node="treeNode"
|
|
11
|
+
:footer-class-name="allowSummary ? 'is-show-summary' : null"
|
|
12
|
+
:header-class-name="headerClassName"
|
|
13
|
+
>
|
|
14
|
+
<template slot="header" slot-scope="scope">
|
|
15
|
+
<slot name="header">
|
|
16
|
+
<div class="ui-grid-column__main">
|
|
17
|
+
<div class="ui-grid-column__main-left">
|
|
18
|
+
<span class="ui-grid-column__title" :title="scope.column.title">
|
|
19
|
+
{{ scope.column.title }}
|
|
20
|
+
</span>
|
|
21
|
+
<span class="ui-grid-column__tips" v-if="$slots.tips">
|
|
22
|
+
<slot name="tips"></slot>
|
|
23
|
+
</span>
|
|
24
|
+
</div>
|
|
25
|
+
<slot name="header-append"></slot>
|
|
26
|
+
</div>
|
|
27
|
+
</slot>
|
|
28
|
+
</template>
|
|
29
|
+
<template slot-scope="scope">
|
|
30
|
+
<slot v-bind="scope" :row-hover-active="hoverRow === scope.row">
|
|
31
|
+
{{ scope.row[scope.column.field] }}
|
|
32
|
+
</slot>
|
|
33
|
+
</template>
|
|
34
|
+
</vxe-column>
|
|
35
|
+
</template>
|
|
36
|
+
<script>
|
|
37
|
+
import { Column } from 'vxe-table'
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
name: 'UiGridColumn',
|
|
41
|
+
components: {
|
|
42
|
+
VxeColumn: Column
|
|
43
|
+
},
|
|
44
|
+
inject: ['UiGrid'],
|
|
45
|
+
props: {
|
|
46
|
+
label: {
|
|
47
|
+
type: String
|
|
48
|
+
},
|
|
49
|
+
prop: {
|
|
50
|
+
type: String
|
|
51
|
+
},
|
|
52
|
+
width: {
|
|
53
|
+
type: [Number, String]
|
|
54
|
+
},
|
|
55
|
+
minWidth: {
|
|
56
|
+
type: String
|
|
57
|
+
},
|
|
58
|
+
align: {
|
|
59
|
+
type: String
|
|
60
|
+
},
|
|
61
|
+
fixed: {
|
|
62
|
+
type: [String, Boolean]
|
|
63
|
+
},
|
|
64
|
+
sortable: {
|
|
65
|
+
type: Boolean
|
|
66
|
+
},
|
|
67
|
+
allowSummary: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false
|
|
70
|
+
},
|
|
71
|
+
formatSummary: {
|
|
72
|
+
type: Function
|
|
73
|
+
},
|
|
74
|
+
treeNode: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: false
|
|
77
|
+
},
|
|
78
|
+
headerClassName: {
|
|
79
|
+
type: String
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
computed: {
|
|
83
|
+
innerFixed () {
|
|
84
|
+
if (typeof this.fixed === 'string') {
|
|
85
|
+
return this.fixed
|
|
86
|
+
}
|
|
87
|
+
return this.fixed ? 'left' : null
|
|
88
|
+
},
|
|
89
|
+
hoverRow () {
|
|
90
|
+
return this.UiGrid.hoverRow
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
created () {
|
|
94
|
+
this.UiGrid.cacheColumns.push(this.$props)
|
|
95
|
+
},
|
|
96
|
+
beforeDestroy () {
|
|
97
|
+
let index = -1
|
|
98
|
+
this.UiGrid.cacheColumns.some((v, i) => {
|
|
99
|
+
if (v === this.$props) {
|
|
100
|
+
index = i
|
|
101
|
+
return true
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
if (index >= 0) {
|
|
105
|
+
this.UiGrid.cacheColumns.splice(index, 1)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
</script>
|
|
110
|
+
<style lang="less">
|
|
111
|
+
.ui-grid-column__tips{
|
|
112
|
+
display: inline-block;
|
|
113
|
+
vertical-align: top;
|
|
114
|
+
height: 20px;
|
|
115
|
+
line-height: 20px;
|
|
116
|
+
margin-left: 3px;
|
|
117
|
+
}
|
|
118
|
+
.ui-grid-column__main{
|
|
119
|
+
width: 100%;
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-direction: row;
|
|
122
|
+
justify-content: space-between;
|
|
123
|
+
}
|
|
124
|
+
.ui-grid-column__main-left{
|
|
125
|
+
flex: 1;
|
|
126
|
+
min-width: 0;
|
|
127
|
+
display: flex;
|
|
128
|
+
flex-direction: row;
|
|
129
|
+
}
|
|
130
|
+
.ui-grid-column__title{
|
|
131
|
+
max-width: 100%;
|
|
132
|
+
overflow: hidden;
|
|
133
|
+
text-overflow: ellipsis;
|
|
134
|
+
white-space: nowrap;
|
|
135
|
+
}
|
|
136
|
+
</style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { unique } from './util'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
name: 'UiGridFilterGroup',
|
|
6
|
+
inject: ['UiGridFilter'],
|
|
7
|
+
provide () {
|
|
8
|
+
return {
|
|
9
|
+
UiGridFilterGroup: this
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
props: {
|
|
13
|
+
label: {
|
|
14
|
+
type: String
|
|
15
|
+
},
|
|
16
|
+
labelWidth: {
|
|
17
|
+
type: String
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
computed: {
|
|
21
|
+
item() {
|
|
22
|
+
return {
|
|
23
|
+
id: this.id,
|
|
24
|
+
props: this.$props
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
created() {
|
|
29
|
+
this.id = unique()
|
|
30
|
+
this.UiGridFilter.addGroup(this.item)
|
|
31
|
+
},
|
|
32
|
+
beforeDestroy() {
|
|
33
|
+
this.UiGridFilter.removeGroup(this.id)
|
|
34
|
+
},
|
|
35
|
+
render(h) {
|
|
36
|
+
return h('div', {
|
|
37
|
+
class: 'ui-grid-filter-group'
|
|
38
|
+
}, [this.$scopedSlots.default ? this.$scopedSlots.default() : null])
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { unique } from './util'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
name: 'UiGridFilterItem',
|
|
6
|
+
inject: {
|
|
7
|
+
UiGridFilter: {
|
|
8
|
+
from: 'UiGridFilter'
|
|
9
|
+
},
|
|
10
|
+
UiGridFilterGroup: {
|
|
11
|
+
from: 'UiGridFilterGroup',
|
|
12
|
+
default: null
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
label: {
|
|
17
|
+
type: String
|
|
18
|
+
},
|
|
19
|
+
prop: {
|
|
20
|
+
type: String
|
|
21
|
+
},
|
|
22
|
+
more: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false
|
|
25
|
+
},
|
|
26
|
+
show: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: true
|
|
29
|
+
},
|
|
30
|
+
operater: {
|
|
31
|
+
type: String
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
data() {
|
|
35
|
+
return {
|
|
36
|
+
data: {
|
|
37
|
+
key: 0
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
computed: {
|
|
42
|
+
item() {
|
|
43
|
+
return {
|
|
44
|
+
id: this.id,
|
|
45
|
+
props: this.$props,
|
|
46
|
+
data: this.data,
|
|
47
|
+
groupId: this.UiGridFilterGroup ? this.UiGridFilterGroup.id : null,
|
|
48
|
+
render: () => {
|
|
49
|
+
return this.$scopedSlots.default()
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
created() {
|
|
55
|
+
this.id = unique()
|
|
56
|
+
this.UiGridFilter.addItem(this.item)
|
|
57
|
+
},
|
|
58
|
+
beforeDestroy() {
|
|
59
|
+
this.UiGridFilter.removeItem(this.id)
|
|
60
|
+
},
|
|
61
|
+
updated() {
|
|
62
|
+
this.data.key++
|
|
63
|
+
},
|
|
64
|
+
render() {
|
|
65
|
+
return null
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ui-grid-filter" style="display: none;">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script>
|
|
7
|
+
export default {
|
|
8
|
+
name: 'UiGridFilter',
|
|
9
|
+
provide() {
|
|
10
|
+
return {
|
|
11
|
+
UiGridFilter: this
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
inject: ['UiGrid'],
|
|
15
|
+
props: {
|
|
16
|
+
value: {
|
|
17
|
+
type: Object
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
items: [],
|
|
23
|
+
groups: []
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
created() {
|
|
27
|
+
this.UiGrid.filterProps.items = this.items
|
|
28
|
+
this.UiGrid.filterProps.groups = this.groups
|
|
29
|
+
this.UiGrid.filterProps.value = this.value
|
|
30
|
+
this.$watch(() => {
|
|
31
|
+
return this.UiGrid.filterProps.value
|
|
32
|
+
}, () => {
|
|
33
|
+
this.$emit('input', this.UiGrid.filterProps.value)
|
|
34
|
+
})
|
|
35
|
+
},
|
|
36
|
+
methods: {
|
|
37
|
+
handleRenderItem (item) {
|
|
38
|
+
return {
|
|
39
|
+
functional: true,
|
|
40
|
+
render: (h, c) => {
|
|
41
|
+
return item.render(h, c)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
addItem (item) {
|
|
46
|
+
if (!item || !item.id) {
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
let index = -1
|
|
50
|
+
this.items.some((v, i) => {
|
|
51
|
+
if (v.id === item.id) {
|
|
52
|
+
index = i
|
|
53
|
+
return true
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
if (index >= 0) {
|
|
57
|
+
this.items.splice(index, 1, item)
|
|
58
|
+
} else {
|
|
59
|
+
this.items.push(item)
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
removeItem (id) {
|
|
63
|
+
let index = -1
|
|
64
|
+
this.items.some((v, i) => {
|
|
65
|
+
if (v.id !== id) {
|
|
66
|
+
index = i
|
|
67
|
+
return true
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
if (index < 0) {
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
this.items.splice(index, 1)
|
|
74
|
+
},
|
|
75
|
+
addGroup (group) {
|
|
76
|
+
if (!group || !group.id) {
|
|
77
|
+
return
|
|
78
|
+
}
|
|
79
|
+
let index = -1
|
|
80
|
+
this.groups.some((v, i) => {
|
|
81
|
+
if (v.id === group.id) {
|
|
82
|
+
index = i
|
|
83
|
+
return true
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
if (index >= 0) {
|
|
87
|
+
this.groups.splice(index, 1, group)
|
|
88
|
+
} else {
|
|
89
|
+
this.groups.push(group)
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
removeGroup (id) {
|
|
93
|
+
let index = -1
|
|
94
|
+
this.groups.some((v, i) => {
|
|
95
|
+
if (v.id !== id) {
|
|
96
|
+
index = i
|
|
97
|
+
return true
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
if (index < 0) {
|
|
101
|
+
return
|
|
102
|
+
}
|
|
103
|
+
this.groups.splice(index, 1)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
</script>
|
|
108
|
+
<style>
|
|
109
|
+
.bi-toolbar{
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-direction: row;
|
|
112
|
+
justify-content: space-between;
|
|
113
|
+
align-items: center;
|
|
114
|
+
}
|
|
115
|
+
</style>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { unique } from '../../../utils/util'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
name: 'UiGridFilterOperateItem',
|
|
6
|
+
inject: ['UiGridFilterOperate'],
|
|
7
|
+
props: {
|
|
8
|
+
label: {
|
|
9
|
+
type: String
|
|
10
|
+
},
|
|
11
|
+
value: {
|
|
12
|
+
type: String
|
|
13
|
+
},
|
|
14
|
+
divided: {
|
|
15
|
+
type: Boolean
|
|
16
|
+
},
|
|
17
|
+
type: {
|
|
18
|
+
type: String
|
|
19
|
+
},
|
|
20
|
+
icon: {
|
|
21
|
+
type: String
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
computed: {
|
|
25
|
+
props () {
|
|
26
|
+
return {
|
|
27
|
+
label: this.label,
|
|
28
|
+
value: this.value,
|
|
29
|
+
type: this.type,
|
|
30
|
+
icon: this.icon,
|
|
31
|
+
divided: this.divided
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
created () {
|
|
36
|
+
this.id = unique()
|
|
37
|
+
this.UiGridFilterOperate.addOption({
|
|
38
|
+
id: this.id,
|
|
39
|
+
props: this.props,
|
|
40
|
+
click: (evt) => {
|
|
41
|
+
this.$emit('click', evt)
|
|
42
|
+
},
|
|
43
|
+
render: () => {
|
|
44
|
+
return this.$slot.default ? this.$slot.default() : null
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
},
|
|
48
|
+
render () {
|
|
49
|
+
return null
|
|
50
|
+
},
|
|
51
|
+
beforeDestroy () {
|
|
52
|
+
this.UiGridFilterOperate.removeOption(this.id)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
</script>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export default {
|
|
3
|
+
name: 'UiGridFilterOperate',
|
|
4
|
+
props: {
|
|
5
|
+
label: {
|
|
6
|
+
type: String
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
inject: ['UiGrid'],
|
|
10
|
+
provide () {
|
|
11
|
+
return {
|
|
12
|
+
UiGridFilterOperate: this
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
created () {
|
|
16
|
+
this.UiGrid.filterOperateProps.items = []
|
|
17
|
+
},
|
|
18
|
+
render (h) {
|
|
19
|
+
return h('div', this.$slots.default)
|
|
20
|
+
},
|
|
21
|
+
methods: {
|
|
22
|
+
addOption (option) {
|
|
23
|
+
if (!option.id) {
|
|
24
|
+
throw new Error('缺少唯一id')
|
|
25
|
+
}
|
|
26
|
+
if (this.UiGrid.filterOperateProps.items.some(v => v.id === option.id)) {
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
this.UiGrid.filterOperateProps.items.push(option)
|
|
30
|
+
},
|
|
31
|
+
removeOption (id) {
|
|
32
|
+
let index = -1
|
|
33
|
+
this.UiGrid.filterOperateProps.items.some((v, i) => {
|
|
34
|
+
if (v.id === id) {
|
|
35
|
+
index = i
|
|
36
|
+
return true
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
if (index < 0) {
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
this.UiGrid.filterOperateProps.items.splice(index, 1)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
name: 'UiGridSortProxy',
|
|
3
|
+
inject: ['UiGrid'],
|
|
4
|
+
props: {
|
|
5
|
+
items: {
|
|
6
|
+
type: Array
|
|
7
|
+
},
|
|
8
|
+
value: {
|
|
9
|
+
type: Object
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
watch: {
|
|
13
|
+
value(val) {
|
|
14
|
+
this.UiGrid.sortProps.value = val
|
|
15
|
+
},
|
|
16
|
+
items(val) {
|
|
17
|
+
this.UiGrid.sortProps.items = val
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
created() {
|
|
21
|
+
this.UiGrid.sortProps.items = this.items
|
|
22
|
+
this.UiGrid.sortProps.value = this.value
|
|
23
|
+
},
|
|
24
|
+
render() {
|
|
25
|
+
return null
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ui-popover
|
|
3
|
+
v-model="showPopover"
|
|
4
|
+
class="bi-sort-select"
|
|
5
|
+
trigger="hover"
|
|
6
|
+
popper-class="bi-sort-select__popover"
|
|
7
|
+
>
|
|
8
|
+
<span slot="reference" class="bi-sort-select__handle" @click="handleHandleClick">
|
|
9
|
+
<span class="bi-sort-select__handle-text">{{ currentItem ? currentItem.label : '排序' }}</span>
|
|
10
|
+
<span class="bi-sort-select__handle-arrow" :class="['is-' + (value && value.order === 'asc' ? 'asc' : 'desc')]" />
|
|
11
|
+
</span>
|
|
12
|
+
<div class="bi-sort-select__menu">
|
|
13
|
+
<div
|
|
14
|
+
class="bi-sort-select__item"
|
|
15
|
+
@click="handleItemClick(item)"
|
|
16
|
+
v-for="(item, index) in items"
|
|
17
|
+
:class="{'is-active': value && (value.prop === item.prop)}"
|
|
18
|
+
:key="index"
|
|
19
|
+
>{{ item.label }}</div>
|
|
20
|
+
<div
|
|
21
|
+
class="bi-sort-select__item is-divided"
|
|
22
|
+
:class="{'is-active': value && (value.order === 'asc')}"
|
|
23
|
+
@click="handleOrderAscClick"
|
|
24
|
+
>升序</div>
|
|
25
|
+
<div
|
|
26
|
+
class="bi-sort-select__item"
|
|
27
|
+
:class="{'is-active': value && (value.order === 'desc')}"
|
|
28
|
+
@click="handleOrderDescClick"
|
|
29
|
+
>降序</div>
|
|
30
|
+
</div>
|
|
31
|
+
</ui-popover>
|
|
32
|
+
</template>
|
|
33
|
+
<script>
|
|
34
|
+
import Popover from '../../popover'
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
name: 'BiGridSort',
|
|
38
|
+
components: {
|
|
39
|
+
UiPopover: Popover
|
|
40
|
+
},
|
|
41
|
+
props: {
|
|
42
|
+
/**
|
|
43
|
+
* {
|
|
44
|
+
* prop: 'aaa',
|
|
45
|
+
* order: 'asc
|
|
46
|
+
* }
|
|
47
|
+
*/
|
|
48
|
+
value: {
|
|
49
|
+
type: Object
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* [{
|
|
53
|
+
* label: 'xxxxx',
|
|
54
|
+
* prop: 'aaa'
|
|
55
|
+
* }]
|
|
56
|
+
*/
|
|
57
|
+
items: {
|
|
58
|
+
type: Array,
|
|
59
|
+
default: () => []
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
data() {
|
|
63
|
+
return {
|
|
64
|
+
showPopover: false
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
computed: {
|
|
68
|
+
currentItem() {
|
|
69
|
+
if (!this.value) {
|
|
70
|
+
return
|
|
71
|
+
}
|
|
72
|
+
return this.items.find(v => v.prop === this.value.prop)
|
|
73
|
+
},
|
|
74
|
+
firstItem () {
|
|
75
|
+
if (!this.items || !this.items.length) {
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
return this.items[0]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
methods: {
|
|
82
|
+
handleHandleClick() {
|
|
83
|
+
if (!this.value) {
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
const orderMap = {
|
|
87
|
+
desc: 'asc',
|
|
88
|
+
asc: 'desc'
|
|
89
|
+
}
|
|
90
|
+
this.$emit('change', {
|
|
91
|
+
value: {
|
|
92
|
+
prop: this.value.prop,
|
|
93
|
+
order: orderMap[this.value.order]
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
},
|
|
97
|
+
handleItemClick(item) {
|
|
98
|
+
this.showPopover = false
|
|
99
|
+
this.$emit('change', {
|
|
100
|
+
value: {
|
|
101
|
+
prop: item.prop,
|
|
102
|
+
order: this.value ? this.value.order : 'desc'
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
},
|
|
106
|
+
handleOrderAscClick() {
|
|
107
|
+
this.showPopover = false
|
|
108
|
+
this.$emit('change', {
|
|
109
|
+
value: {
|
|
110
|
+
prop: this.value && this.value.prop ? this.value.prop : (this.firstItem ? this.firstItem.prop : null),
|
|
111
|
+
order: 'asc'
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
},
|
|
115
|
+
handleOrderDescClick() {
|
|
116
|
+
this.showPopover = false
|
|
117
|
+
this.$emit('change', {
|
|
118
|
+
value: {
|
|
119
|
+
prop: this.value && this.value.prop ? this.value.prop : (this.firstItem ? this.firstItem.prop : null),
|
|
120
|
+
order: 'desc'
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
</script>
|
|
127
|
+
<style lang="less">
|
|
128
|
+
.bi-sort-select__popover{
|
|
129
|
+
padding: 6px 0!important;
|
|
130
|
+
}
|
|
131
|
+
.bi-sort-select__handle-text{
|
|
132
|
+
font-size: 14px;
|
|
133
|
+
}
|
|
134
|
+
.bi-sort-select__handle{
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-direction: row;
|
|
137
|
+
align-items: center;
|
|
138
|
+
height: 28px;
|
|
139
|
+
line-height: 28px;
|
|
140
|
+
cursor: pointer;
|
|
141
|
+
}
|
|
142
|
+
.bi-sort-select__handle-arrow{
|
|
143
|
+
display: inline-block;
|
|
144
|
+
width: 18px;
|
|
145
|
+
height: 18px;
|
|
146
|
+
margin-left: 6px;
|
|
147
|
+
background: url('./icons/desc.png') no-repeat 50% 50%;
|
|
148
|
+
background-size: 90%;
|
|
149
|
+
margin-top: 1px;
|
|
150
|
+
&.is-asc{
|
|
151
|
+
margin-top: 0;
|
|
152
|
+
background-image: url('./icons/asc.png');
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
.bi-sort-select__menu{
|
|
156
|
+
padding-top: 6px;
|
|
157
|
+
padding-bottom: 6px;
|
|
158
|
+
}
|
|
159
|
+
.bi-sort-select__item{
|
|
160
|
+
line-height: 24px;
|
|
161
|
+
padding: 6px 30px 6px 12px;
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
transition: all .25s;
|
|
164
|
+
position: relative;
|
|
165
|
+
white-space: nowrap;
|
|
166
|
+
&:hover {
|
|
167
|
+
background-color: #f8f8f9;
|
|
168
|
+
}
|
|
169
|
+
&.is-active {
|
|
170
|
+
color: #409EFF;
|
|
171
|
+
background-color: rgba(95, 158, 250, .1);
|
|
172
|
+
&:after {
|
|
173
|
+
opacity: 1;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
&.is-divided{
|
|
177
|
+
margin-top: 12px;
|
|
178
|
+
position: relative;
|
|
179
|
+
&:before {
|
|
180
|
+
content: '';
|
|
181
|
+
position: absolute;
|
|
182
|
+
left: 0;
|
|
183
|
+
right: 0;
|
|
184
|
+
top: -6px;
|
|
185
|
+
height: 1px;
|
|
186
|
+
background-color: #eee;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
&:after {
|
|
190
|
+
content: '';
|
|
191
|
+
display: inline-block;
|
|
192
|
+
width: 5px;
|
|
193
|
+
height: 7px;
|
|
194
|
+
border: 1px solid #409EFF;
|
|
195
|
+
position: absolute;
|
|
196
|
+
top: 50%;
|
|
197
|
+
transform: rotate(45deg) translateY(-50%);
|
|
198
|
+
right: 12px;
|
|
199
|
+
border-left: 0;
|
|
200
|
+
border-top: 0;
|
|
201
|
+
margin-top: -3px;
|
|
202
|
+
opacity: 0;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
</style>
|
|
Binary file
|
|
Binary file
|