@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,572 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span class="ui-select" :class="{'is-disabled': disabled, 'is-loading': reloading, 'is-collapse-tags': collapseTags}">
|
|
3
|
+
<template v-if="editable">
|
|
4
|
+
<el-select
|
|
5
|
+
ref="select"
|
|
6
|
+
class="ui-select__control"
|
|
7
|
+
v-model="innerValue"
|
|
8
|
+
size="small"
|
|
9
|
+
:disabled="disabled"
|
|
10
|
+
:popper-class="popperClass"
|
|
11
|
+
:multiple="multiple"
|
|
12
|
+
:collapse-tags="collapseTags"
|
|
13
|
+
:filterable="filterable"
|
|
14
|
+
:remote="filterMode === 'remote'"
|
|
15
|
+
:allow-create="allowCreate"
|
|
16
|
+
:remote-method="handleRemoteMethod"
|
|
17
|
+
:filter-method="handleFilterMethod"
|
|
18
|
+
:placeholder="placeholder"
|
|
19
|
+
:clearable="clearable"
|
|
20
|
+
:no-data-text="emptyText"
|
|
21
|
+
:reserve-keyword="true"
|
|
22
|
+
:loading="!moring && innerLoading"
|
|
23
|
+
:style="{width: width}"
|
|
24
|
+
v-loadmore="lazy ? handleLoadMore : null"
|
|
25
|
+
@visible-change="handleVisibleChange"
|
|
26
|
+
@clear="handleClear"
|
|
27
|
+
@focus="handleInputFocus"
|
|
28
|
+
>
|
|
29
|
+
<template slot="prefix">
|
|
30
|
+
<slot name="prefix"></slot>
|
|
31
|
+
</template>
|
|
32
|
+
<slot></slot>
|
|
33
|
+
<template v-for="(item, index) in showOptions">
|
|
34
|
+
<el-option
|
|
35
|
+
class="ui-select__item"
|
|
36
|
+
:key="`${item[valueField]}_${index}`"
|
|
37
|
+
:value="item[valueField]"
|
|
38
|
+
:label="item[textField]"
|
|
39
|
+
>
|
|
40
|
+
<slot name="item" :item="item">
|
|
41
|
+
{{item[textField]}}
|
|
42
|
+
</slot>
|
|
43
|
+
</el-option>
|
|
44
|
+
</template>
|
|
45
|
+
<template v-if="tempItems && tempItems.length">
|
|
46
|
+
<el-option
|
|
47
|
+
v-for="(item, index) in tempItems"
|
|
48
|
+
:key="`${item[valueField]}_temp_${index}`"
|
|
49
|
+
:value="item[valueField]"
|
|
50
|
+
:label="item[textField]"
|
|
51
|
+
v-show="false"
|
|
52
|
+
></el-option>
|
|
53
|
+
</template>
|
|
54
|
+
<select-load-more
|
|
55
|
+
v-if="lazy"
|
|
56
|
+
:status="loadMoreStatus"
|
|
57
|
+
@loadmore="handleLoadMoreClick"
|
|
58
|
+
></select-load-more>
|
|
59
|
+
</el-select>
|
|
60
|
+
<span class="ui-select__loading" v-if="reloading">
|
|
61
|
+
<ui-icon name="loading"></ui-icon> 数据加载中...
|
|
62
|
+
</span>
|
|
63
|
+
</template>
|
|
64
|
+
<template v-else>
|
|
65
|
+
{{ showText }}
|
|
66
|
+
</template>
|
|
67
|
+
</span>
|
|
68
|
+
</template>
|
|
69
|
+
<script>
|
|
70
|
+
import Select from 'element-ui/lib/select'
|
|
71
|
+
import Option from 'element-ui/lib/option'
|
|
72
|
+
import 'element-ui/lib/theme-chalk/select.css'
|
|
73
|
+
import 'element-ui/lib/theme-chalk/option.css'
|
|
74
|
+
import SelectLoadMore from './select-load-more'
|
|
75
|
+
|
|
76
|
+
export default {
|
|
77
|
+
name: 'UiSelect',
|
|
78
|
+
inject: {
|
|
79
|
+
UiAdvancedFilterConditionItemValue: {
|
|
80
|
+
default: null
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
props: {
|
|
84
|
+
width: {
|
|
85
|
+
type: String,
|
|
86
|
+
default: '100%'
|
|
87
|
+
},
|
|
88
|
+
items: {
|
|
89
|
+
type: Array,
|
|
90
|
+
default: () => []
|
|
91
|
+
},
|
|
92
|
+
clearable: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: true
|
|
95
|
+
},
|
|
96
|
+
allowCreate: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
default: false
|
|
99
|
+
},
|
|
100
|
+
pageSize: {
|
|
101
|
+
type: Number,
|
|
102
|
+
default: 20
|
|
103
|
+
},
|
|
104
|
+
placeholder: {
|
|
105
|
+
type: String,
|
|
106
|
+
default: '请选择'
|
|
107
|
+
},
|
|
108
|
+
loading: {
|
|
109
|
+
type: Boolean,
|
|
110
|
+
default: false
|
|
111
|
+
},
|
|
112
|
+
value: {
|
|
113
|
+
type: [Number, String, Array, Boolean]
|
|
114
|
+
},
|
|
115
|
+
multiple: {
|
|
116
|
+
type: Boolean
|
|
117
|
+
},
|
|
118
|
+
textField: {
|
|
119
|
+
type: String,
|
|
120
|
+
default: 'label'
|
|
121
|
+
},
|
|
122
|
+
valueField: {
|
|
123
|
+
type: String,
|
|
124
|
+
default: 'id'
|
|
125
|
+
},
|
|
126
|
+
lazy: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
default: false
|
|
129
|
+
},
|
|
130
|
+
disabled: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: false
|
|
133
|
+
},
|
|
134
|
+
optionDisabled: {
|
|
135
|
+
type: Boolean,
|
|
136
|
+
default: false
|
|
137
|
+
},
|
|
138
|
+
emptyText: {
|
|
139
|
+
type: String,
|
|
140
|
+
default: '无数据'
|
|
141
|
+
},
|
|
142
|
+
/**
|
|
143
|
+
* 开启远程过滤
|
|
144
|
+
* 启用远程搜索,它会在输入值发生变化时调用,没有输入值时选项是空,参数为当前输入值
|
|
145
|
+
*/
|
|
146
|
+
remoteFilter: {
|
|
147
|
+
type: Boolean,
|
|
148
|
+
default: false
|
|
149
|
+
},
|
|
150
|
+
filterable: {
|
|
151
|
+
type: Boolean,
|
|
152
|
+
default: false
|
|
153
|
+
},
|
|
154
|
+
filterMode: {
|
|
155
|
+
type: String,
|
|
156
|
+
default: 'remote',
|
|
157
|
+
validator (value) {
|
|
158
|
+
return ['remote', 'local'].includes(value)
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
filterMethod: {
|
|
162
|
+
type: Function
|
|
163
|
+
},
|
|
164
|
+
queryMethod: {
|
|
165
|
+
type: Function
|
|
166
|
+
},
|
|
167
|
+
editable: {
|
|
168
|
+
type: Boolean,
|
|
169
|
+
default: true
|
|
170
|
+
},
|
|
171
|
+
collapseTags: {
|
|
172
|
+
type: Boolean,
|
|
173
|
+
default: false
|
|
174
|
+
},
|
|
175
|
+
popperClass: {
|
|
176
|
+
type: String
|
|
177
|
+
},
|
|
178
|
+
tempItems: {
|
|
179
|
+
type: Array
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
components: {
|
|
183
|
+
SelectLoadMore,
|
|
184
|
+
ElSelect: Select,
|
|
185
|
+
ElOption: Option
|
|
186
|
+
},
|
|
187
|
+
data () {
|
|
188
|
+
return {
|
|
189
|
+
pageIndex: 1,
|
|
190
|
+
notMore: false,
|
|
191
|
+
moring: false,
|
|
192
|
+
keyword: null,
|
|
193
|
+
reloading: false,
|
|
194
|
+
innerLoading: this.loading,
|
|
195
|
+
showOptions: this.items,
|
|
196
|
+
options: this.items
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
computed: {
|
|
200
|
+
innerValue: {
|
|
201
|
+
get () {
|
|
202
|
+
return this.value
|
|
203
|
+
},
|
|
204
|
+
set (val) {
|
|
205
|
+
if (val === this.value) {
|
|
206
|
+
return
|
|
207
|
+
}
|
|
208
|
+
if (!this.multiple) {
|
|
209
|
+
if (val) {
|
|
210
|
+
const item = this.options.find(v => v[this.valueField] === val)
|
|
211
|
+
this.$emit('change', {
|
|
212
|
+
value: val,
|
|
213
|
+
item
|
|
214
|
+
})
|
|
215
|
+
} else {
|
|
216
|
+
this.$emit('change', {
|
|
217
|
+
value: null,
|
|
218
|
+
item: null
|
|
219
|
+
})
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
this.$emit('input', val)
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
showText () {
|
|
226
|
+
const texts = []
|
|
227
|
+
if (this.multiple) {
|
|
228
|
+
if (this.innerValue && this.innerValue.length) {
|
|
229
|
+
this.innerValue.forEach(v => {
|
|
230
|
+
const item = (this.options || []).find(vv => vv[this.valueField] === v)
|
|
231
|
+
if (item) {
|
|
232
|
+
texts.push(item[this.textField])
|
|
233
|
+
} else {
|
|
234
|
+
texts.push(v)
|
|
235
|
+
}
|
|
236
|
+
})
|
|
237
|
+
}
|
|
238
|
+
} else {
|
|
239
|
+
const item = (this.options || []).find(v => v[this.valueField] === this.innerValue)
|
|
240
|
+
if (item) {
|
|
241
|
+
texts.push(item[this.textField])
|
|
242
|
+
} else {
|
|
243
|
+
texts.push(this.innerValue)
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return texts.join('、')
|
|
247
|
+
},
|
|
248
|
+
loadMoreStatus () {
|
|
249
|
+
let status = 'loadmore'
|
|
250
|
+
if (this.notMore) {
|
|
251
|
+
status = 'nomore'
|
|
252
|
+
} else if (this.moring || this.innerLoading) {
|
|
253
|
+
status = 'loading'
|
|
254
|
+
}
|
|
255
|
+
return status
|
|
256
|
+
},
|
|
257
|
+
handleRemoteMethod () {
|
|
258
|
+
if (this.filterMode !== 'remote') {
|
|
259
|
+
return
|
|
260
|
+
}
|
|
261
|
+
return (keyword) => {
|
|
262
|
+
this.keyword = (keyword || '').trim()
|
|
263
|
+
if (!this.remoteFilter) {
|
|
264
|
+
if (this.queryMethod) {
|
|
265
|
+
this.reload(false)
|
|
266
|
+
}
|
|
267
|
+
} else {
|
|
268
|
+
if (!this.keyword) {
|
|
269
|
+
this.options = []
|
|
270
|
+
this.showOptions = this.options
|
|
271
|
+
this.$emit('load', {
|
|
272
|
+
data: this.options
|
|
273
|
+
})
|
|
274
|
+
} else {
|
|
275
|
+
if (this.queryMethod) {
|
|
276
|
+
this.reload(false)
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
handleFilterMethod () {
|
|
283
|
+
if (this.filterMode !== 'local') {
|
|
284
|
+
return
|
|
285
|
+
}
|
|
286
|
+
return (keyword) => {
|
|
287
|
+
this.keyword = (keyword || '').trim()
|
|
288
|
+
if (this.filterMethod) {
|
|
289
|
+
this.showOptions = this.options.filter(v => this.filterMethod({
|
|
290
|
+
item: v,
|
|
291
|
+
keyword
|
|
292
|
+
}))
|
|
293
|
+
} else {
|
|
294
|
+
if (this.keyword) {
|
|
295
|
+
this.showOptions = this.options.filter(v => {
|
|
296
|
+
return (v[this.textField] || '').indexOf(this.keyword) >= 0
|
|
297
|
+
})
|
|
298
|
+
} else {
|
|
299
|
+
this.showOptions = this.options
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
watch: {
|
|
306
|
+
items () {
|
|
307
|
+
this.options = this.items
|
|
308
|
+
this.showOptions = this.items
|
|
309
|
+
},
|
|
310
|
+
loading () {
|
|
311
|
+
this.innerLoading = this.loading
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
directives: {
|
|
315
|
+
loadmore: {
|
|
316
|
+
bind(el, binding) {
|
|
317
|
+
// 获取element-ui定义好的scroll盒子
|
|
318
|
+
const $scroll = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap')
|
|
319
|
+
const scrollTop = $scroll.scrollTop
|
|
320
|
+
$scroll.addEventListener('scroll', function(e) {
|
|
321
|
+
const CONDITION = this.scrollHeight - this.scrollTop - 5 <= this.clientHeight
|
|
322
|
+
if (CONDITION && this.scrollTop > scrollTop) {
|
|
323
|
+
binding.value && binding.value()
|
|
324
|
+
}
|
|
325
|
+
})
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
created () {
|
|
330
|
+
// 尝试加载远程被选项
|
|
331
|
+
// 如果没有value的情况,可以显示下拉时在加载
|
|
332
|
+
if (this.queryMethod && !this.remoteFilter) {
|
|
333
|
+
this.reload()
|
|
334
|
+
}
|
|
335
|
+
if (this.UiAdvancedFilterConditionItemValue) {
|
|
336
|
+
this.UiAdvancedFilterConditionItemValue.$on('ui-advanced-filter-condition-item-collect_text', this.handleUiAdvancedFilterConditionItemValueCollectText)
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
methods: {
|
|
340
|
+
/**
|
|
341
|
+
* 加载远程备选项
|
|
342
|
+
*/
|
|
343
|
+
loadOptions (isLoading, pageIndex) {
|
|
344
|
+
if (!this.queryMethod) {
|
|
345
|
+
return
|
|
346
|
+
}
|
|
347
|
+
const params = {}
|
|
348
|
+
if (this.lazy) {
|
|
349
|
+
params.pageIndex = (pageIndex || this.pageIndex) - 1
|
|
350
|
+
params.pageSize = this.pageSize
|
|
351
|
+
}
|
|
352
|
+
if (this.showOptions && this.showOptions.length) {
|
|
353
|
+
params.lastItem = this.showOptions[this.showOptions.length - 1]
|
|
354
|
+
}
|
|
355
|
+
params.keyword = this.keyword
|
|
356
|
+
const rs = this.queryMethod(params)
|
|
357
|
+
if (rs && rs.then) {
|
|
358
|
+
if (isLoading !== false) {
|
|
359
|
+
this.innerLoading = true
|
|
360
|
+
}
|
|
361
|
+
return rs.then((rs) => {
|
|
362
|
+
this.notMore = rs.length < this.pageSize
|
|
363
|
+
return rs
|
|
364
|
+
}).finally(() => {
|
|
365
|
+
this.innerLoading = false
|
|
366
|
+
})
|
|
367
|
+
} else {
|
|
368
|
+
return Promise.resolve(rs || [])
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
reload (isLoading = true) {
|
|
372
|
+
this.options = []
|
|
373
|
+
this.showOptions = []
|
|
374
|
+
const rs = this.loadOptions(true, 1)
|
|
375
|
+
if (rs && rs.then) {
|
|
376
|
+
if (isLoading) {
|
|
377
|
+
this.reloading = true
|
|
378
|
+
}
|
|
379
|
+
rs.then((rs) => {
|
|
380
|
+
this.options = rs || []
|
|
381
|
+
this.showOptions = this.options
|
|
382
|
+
this.$emit('load', {
|
|
383
|
+
data: this.options
|
|
384
|
+
})
|
|
385
|
+
}).finally(() => {
|
|
386
|
+
if (isLoading) {
|
|
387
|
+
this.reloading = false
|
|
388
|
+
}
|
|
389
|
+
})
|
|
390
|
+
}
|
|
391
|
+
return rs
|
|
392
|
+
},
|
|
393
|
+
loadMoreOptions () {
|
|
394
|
+
if (this.innerLoading || this.notMore) {
|
|
395
|
+
return
|
|
396
|
+
}
|
|
397
|
+
const nextPageIndex = this.pageIndex + 1
|
|
398
|
+
const rs = this.loadOptions(true, nextPageIndex)
|
|
399
|
+
if (rs && rs.then) {
|
|
400
|
+
this.moring = true
|
|
401
|
+
rs.then((rs) => {
|
|
402
|
+
this.pageIndex = nextPageIndex
|
|
403
|
+
this.options = [].concat(this.options, rs || [])
|
|
404
|
+
this.showOptions = this.options
|
|
405
|
+
this.$emit('load', {
|
|
406
|
+
data: this.options
|
|
407
|
+
})
|
|
408
|
+
}).finally(() => {
|
|
409
|
+
this.moring = false
|
|
410
|
+
})
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
doLayout () {
|
|
414
|
+
this.$refs.select && this.$refs.select.$refs.popper && this.$refs.select.$refs.popper.updatePopper()
|
|
415
|
+
},
|
|
416
|
+
doHandleLayout () {
|
|
417
|
+
if (!this.$refs.select) {
|
|
418
|
+
return
|
|
419
|
+
}
|
|
420
|
+
if (this.$refs.select.visible) {
|
|
421
|
+
if (this.$refs.select.$refs.popper) {
|
|
422
|
+
this.$refs.select.$refs.popper.$el.style.width = `${this.$refs.select.inputWidth}px`
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
handleVisibleChange () {
|
|
427
|
+
this.$emit('visible-change')
|
|
428
|
+
},
|
|
429
|
+
handleInputFocus () {
|
|
430
|
+
// 修复如果选项里面的文字太长了,第一次的时候popover计算宽度的逻辑滞后,导致定位不正确,下拉框错位,这里只针对第一次打开的时候重新doLayout一下
|
|
431
|
+
clearTimeout(this._timer)
|
|
432
|
+
this._timer = setTimeout(() => {
|
|
433
|
+
this.doHandleLayout()
|
|
434
|
+
this.doLayout()
|
|
435
|
+
}, 60)
|
|
436
|
+
},
|
|
437
|
+
handleLoadMore () {
|
|
438
|
+
this.loadMoreOptions()
|
|
439
|
+
},
|
|
440
|
+
handleLoadMoreClick () {
|
|
441
|
+
this.loadMoreOptions()
|
|
442
|
+
},
|
|
443
|
+
handleClear () {
|
|
444
|
+
if (this.$refs.select) {
|
|
445
|
+
this.$refs.select.query = ''
|
|
446
|
+
this.$refs.select.handleQueryChange('')
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
handleUiAdvancedFilterConditionItemValueCollectText ({ getValue, setTextMap }) {
|
|
450
|
+
const value = getValue()
|
|
451
|
+
if (!value || !value.length) {
|
|
452
|
+
setTextMap({})
|
|
453
|
+
} else {
|
|
454
|
+
if (this.options && this.options.length) {
|
|
455
|
+
const textData = this.options.filter(v => value.includes(v[this.valueField]))
|
|
456
|
+
setTextMap(textData.reduce((rs, v) => {
|
|
457
|
+
rs[v[this.valueField]] = v[this.textField]
|
|
458
|
+
return rs
|
|
459
|
+
}, {}))
|
|
460
|
+
} else {
|
|
461
|
+
setTextMap({})
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
beforeDestroy () {
|
|
467
|
+
if (this.UiAdvancedFilterConditionItemValue) {
|
|
468
|
+
this.UiAdvancedFilterConditionItemValue.$off('ui-advanced-filter-condition-item-collect_text', this.handleUiAdvancedFilterConditionItemValueCollectText)
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
beforeDestroy () {
|
|
472
|
+
clearTimeout(this._timer)
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
</script>
|
|
476
|
+
<style lang="less">
|
|
477
|
+
.ui-select{
|
|
478
|
+
display: inline-block;
|
|
479
|
+
position: relative;
|
|
480
|
+
width: 100%;
|
|
481
|
+
&.is-disabled{
|
|
482
|
+
.ui-select__loading{
|
|
483
|
+
background-color: #f6f7fa;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
.el-select{
|
|
487
|
+
vertical-align: top;
|
|
488
|
+
}
|
|
489
|
+
&.is-loading {
|
|
490
|
+
.el-select__tags{
|
|
491
|
+
display: none;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
.el-select__tags{
|
|
495
|
+
.el-tag{
|
|
496
|
+
max-width: 100%;
|
|
497
|
+
white-space: nowrap;
|
|
498
|
+
overflow: hidden;
|
|
499
|
+
text-overflow: ellipsis;
|
|
500
|
+
.el-icon-close{
|
|
501
|
+
vertical-align: top;
|
|
502
|
+
margin-top: 4px;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
&.is-collapse-tags{
|
|
507
|
+
.el-select__tags{
|
|
508
|
+
.el-tag{
|
|
509
|
+
max-width: calc(~'100% - 68px');
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
.el-input__inner{
|
|
514
|
+
box-sizing: border-box;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
.ui-select__loading{
|
|
518
|
+
position: absolute;
|
|
519
|
+
top: 2px;
|
|
520
|
+
left: 2px;
|
|
521
|
+
right: 2px;
|
|
522
|
+
bottom: 2px;
|
|
523
|
+
padding-left: 10px;
|
|
524
|
+
z-index: 3;
|
|
525
|
+
height: 28px;
|
|
526
|
+
line-height: 28px;
|
|
527
|
+
color: #999;
|
|
528
|
+
background-color: #fff;
|
|
529
|
+
border-radius: 3px;
|
|
530
|
+
}
|
|
531
|
+
.ui-select{
|
|
532
|
+
.el-input{
|
|
533
|
+
&.is-focus{
|
|
534
|
+
.el-input__inner{
|
|
535
|
+
border-color: #1aa2e8;
|
|
536
|
+
box-shadow: 0 0 0 0.2rem rgba(26, 162, 232,.25);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
.el-input__inner{
|
|
541
|
+
transition: all .15s ease-in-out;
|
|
542
|
+
padding-left: 11px;
|
|
543
|
+
padding-right: 11px;
|
|
544
|
+
color: #404040;
|
|
545
|
+
box-sizing: border-box;
|
|
546
|
+
&:focus{
|
|
547
|
+
border-color: #1aa2e8;
|
|
548
|
+
box-shadow: 0 0 0 0.2rem rgba(26, 162, 232,.25);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
.ui-select__item.el-select-dropdown__item.selected{
|
|
553
|
+
color: #28a4e6;
|
|
554
|
+
}
|
|
555
|
+
.el-select-dropdown__empty{
|
|
556
|
+
padding-left: 12px;
|
|
557
|
+
padding-right: 12px;
|
|
558
|
+
font-size: 12px;
|
|
559
|
+
}
|
|
560
|
+
body {
|
|
561
|
+
.el-select-dropdown__item{
|
|
562
|
+
min-height: 34px;
|
|
563
|
+
height: auto;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
</style>
|
|
567
|
+
|
|
568
|
+
<style lang="less" scoped>
|
|
569
|
+
/deep/.el-input--prefix .el-input__inner {
|
|
570
|
+
padding-left: 30px !important;
|
|
571
|
+
}
|
|
572
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import UiSkeleton from './skeleton'
|
|
2
|
+
import UiSkeletonRows from './skeleton-rows'
|
|
3
|
+
|
|
4
|
+
UiSkeleton.install = (Vue) => {
|
|
5
|
+
Vue.component(UiSkeleton.name, UiSkeleton)
|
|
6
|
+
Vue.component(UiSkeletonRows.name, UiSkeletonRows)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
UiSkeleton,
|
|
11
|
+
UiSkeletonRows
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default UiSkeleton
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Skeleton from './skeleton'
|
|
3
|
+
|
|
4
|
+
function renderRow(h, props) {
|
|
5
|
+
const rs = []
|
|
6
|
+
for (let i = 0; i < props.value; i++) {
|
|
7
|
+
rs.push(h(Skeleton, {
|
|
8
|
+
props: {
|
|
9
|
+
height: '18px',
|
|
10
|
+
radius: '9px'
|
|
11
|
+
}
|
|
12
|
+
}))
|
|
13
|
+
}
|
|
14
|
+
return rs
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: 'UiSkeletonRows',
|
|
19
|
+
functional: true,
|
|
20
|
+
props: {
|
|
21
|
+
value: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default: 1
|
|
24
|
+
},
|
|
25
|
+
width: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: '100%'
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
render(h, context) {
|
|
31
|
+
return h('div', {
|
|
32
|
+
class: 'ui-skeleton-rows',
|
|
33
|
+
style: {
|
|
34
|
+
width: context.props.width
|
|
35
|
+
}
|
|
36
|
+
}, renderRow(h, context.props))
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
40
|
+
<style lang="less">
|
|
41
|
+
.ui-skeleton-rows{
|
|
42
|
+
.ui-skeleton{
|
|
43
|
+
margin: 10px 0;
|
|
44
|
+
&:first-child{
|
|
45
|
+
margin-top: 0;
|
|
46
|
+
}
|
|
47
|
+
&:last-child{
|
|
48
|
+
margin-bottom: 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export default {
|
|
3
|
+
name: 'UiSkeleton',
|
|
4
|
+
functional: true,
|
|
5
|
+
props: {
|
|
6
|
+
width: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: '100%'
|
|
9
|
+
},
|
|
10
|
+
height: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: '100%'
|
|
13
|
+
},
|
|
14
|
+
radius: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: '3px'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
render(h, context) {
|
|
20
|
+
const style = {}
|
|
21
|
+
const { props, data } = context
|
|
22
|
+
if (props.width) {
|
|
23
|
+
style.width = props.width
|
|
24
|
+
}
|
|
25
|
+
if (props.height) {
|
|
26
|
+
style.height = props.height
|
|
27
|
+
}
|
|
28
|
+
if (props.radius) {
|
|
29
|
+
style['border-radius'] = props.radius
|
|
30
|
+
}
|
|
31
|
+
const className = data.staticClass || data.class
|
|
32
|
+
return h('div', {
|
|
33
|
+
class: ['ui-skeleton'].concat(className || []),
|
|
34
|
+
style
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
<style lang="less">
|
|
40
|
+
.ui-skeleton{
|
|
41
|
+
position: relative;
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
background-color: #f8f8f9;
|
|
44
|
+
&:before{
|
|
45
|
+
content: '';
|
|
46
|
+
}
|
|
47
|
+
&:after{
|
|
48
|
+
content: "";
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: 0;
|
|
51
|
+
right: 0;
|
|
52
|
+
bottom: 0;
|
|
53
|
+
left: 0;
|
|
54
|
+
z-index: 0;
|
|
55
|
+
background: linear-gradient(90deg,transparent,hsla(0,0%,100%,.4),transparent);
|
|
56
|
+
-webkit-animation: ui-skeleton-animate 1.75s linear infinite;
|
|
57
|
+
animation: ui-skeleton-animate 1.75s linear infinite
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
@keyframes ui-skeleton-animate {
|
|
61
|
+
0% {
|
|
62
|
+
-webkit-transform: translateX(-100%);
|
|
63
|
+
transform: translateX(-100%)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
to {
|
|
67
|
+
-webkit-transform: translateX(100%);
|
|
68
|
+
transform: translateX(100%)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
</style>
|