web-component-gallery 2.2.36 → 2.2.38
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.
|
@@ -27,37 +27,56 @@ const AmapSearch = {
|
|
|
27
27
|
},
|
|
28
28
|
methods: {
|
|
29
29
|
/** 选择地址 */
|
|
30
|
-
async changeHandle() {
|
|
31
|
-
if (!
|
|
32
|
-
|
|
30
|
+
async changeHandle(value) {
|
|
31
|
+
if (!value) {
|
|
32
|
+
this.$emit('searchReset', this.searchMarker)
|
|
33
|
+
this.searchMarker = null
|
|
34
|
+
return
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const { label, location } = this.selectOptions.find(({ id }) => id == value)
|
|
33
38
|
const searchInfo = {
|
|
34
39
|
longitude: location.lng,
|
|
35
40
|
latitude: location.lat,
|
|
36
41
|
address: label
|
|
37
42
|
}
|
|
38
|
-
|
|
43
|
+
|
|
44
|
+
this.searchMarker = await this.amapStore.setMarker(this.drawIcon, {
|
|
45
|
+
position: [location.lng, location.lat]
|
|
46
|
+
})
|
|
39
47
|
this.$emit('searchChoose', this.searchMarker, searchInfo)
|
|
40
48
|
},
|
|
49
|
+
|
|
41
50
|
/** 根据搜索框搜索地址 */
|
|
42
|
-
searchHandle(keyword) {
|
|
43
|
-
this.amapStore.getMapSearch(keyword
|
|
44
|
-
this.selectOptions = addressOptions
|
|
45
|
-
})
|
|
51
|
+
async searchHandle(keyword) {
|
|
52
|
+
this.selectOptions = await this.amapStore.getMapSearch(keyword)
|
|
46
53
|
}
|
|
47
54
|
},
|
|
48
|
-
render(
|
|
49
|
-
const {
|
|
55
|
+
render() {
|
|
56
|
+
const { changeHandle, searchHandle, buttonProps } = this
|
|
50
57
|
|
|
51
|
-
const
|
|
58
|
+
const selectProps = {
|
|
52
59
|
valueKey: 'id',
|
|
53
60
|
labelKey: 'label',
|
|
54
|
-
options: selectOptions,
|
|
61
|
+
options: this.selectOptions,
|
|
55
62
|
placeholder: '请输入目的地进行搜索'
|
|
56
|
-
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const selectAttrs = {
|
|
66
|
+
filterOption: false
|
|
67
|
+
}
|
|
57
68
|
|
|
58
69
|
return (
|
|
59
70
|
<div class="AmapDraw__Search">
|
|
60
|
-
<ASelectCustom
|
|
71
|
+
<ASelectCustom
|
|
72
|
+
v-model={this.addressValue}
|
|
73
|
+
props={selectProps}
|
|
74
|
+
attrs={selectAttrs}
|
|
75
|
+
on={{
|
|
76
|
+
change: changeHandle,
|
|
77
|
+
search: searchHandle
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
61
80
|
{buttonProps && <Button buttonProps={buttonProps} class="AmapDraw__Search__Button" />}
|
|
62
81
|
</div>
|
|
63
82
|
)
|
|
@@ -68,4 +87,4 @@ AmapSearch.install = function (Vue) {
|
|
|
68
87
|
Vue.component('AmapSearch', AmapSearch)
|
|
69
88
|
}
|
|
70
89
|
|
|
71
|
-
export default AmapSearch
|
|
90
|
+
export default AmapSearch
|
|
@@ -9,12 +9,10 @@
|
|
|
9
9
|
class="ASelectCustom"
|
|
10
10
|
>
|
|
11
11
|
<Select
|
|
12
|
-
show-search
|
|
13
12
|
:style="{ width: width || '100%' }"
|
|
14
13
|
:mode="mode"
|
|
15
14
|
:open="isSelectOpen"
|
|
16
15
|
:placeholder="placeholder"
|
|
17
|
-
:filterOption="listPageHandler ? false : filterOption"
|
|
18
16
|
:getPopupContainer="tirggerNode => tirggerNode.parentNode"
|
|
19
17
|
@select="handleSelect"
|
|
20
18
|
@search="handleSearch"
|
|
@@ -151,6 +149,7 @@ export default {
|
|
|
151
149
|
allowClear: true,
|
|
152
150
|
showSearch: true,
|
|
153
151
|
defaultActiveFirstOption: !this.isInput,
|
|
152
|
+
filterOption: this.listPageHandler ? false : this.filterOption,
|
|
154
153
|
...this.$attrs
|
|
155
154
|
}
|
|
156
155
|
},
|
package/lib/table/index.vue
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<!-- 表格容器,根据tableStyle动态设置样式类 -->
|
|
3
3
|
<div :class="[tableStyle, 'WebComponentTable']" ref="Table">
|
|
4
4
|
<!-- 表格头部插槽 -->
|
|
5
|
+
{{ $slots.ATableHead }}
|
|
5
6
|
<div v-if="$slots.ATableHead" class="WebComponentTable__Head" ref="TableHead">
|
|
6
7
|
<slot name="ATableHead" />
|
|
7
8
|
</div>
|
|
@@ -206,12 +207,12 @@ export default {
|
|
|
206
207
|
}
|
|
207
208
|
},
|
|
208
209
|
mounted() {
|
|
210
|
+
this.pagination = { ...this.pagination, ...this.paginationParams }
|
|
211
|
+
// 监听父级高度
|
|
209
212
|
this.initResizeObserver()
|
|
210
|
-
this
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
this.$bus.$onWindow(this, 'resize', this.getTableBodyHeight)
|
|
214
|
-
},
|
|
213
|
+
setTimeout(this.getScrollBodyH, 300)
|
|
214
|
+
this.$bus.$onWindow(this, 'resize', this.getScrollBodyH)
|
|
215
|
+
},
|
|
215
216
|
beforeDestroy() {
|
|
216
217
|
if (this.resizeObserver) {
|
|
217
218
|
this.resizeObserver.disconnect()
|
|
@@ -219,29 +220,39 @@ export default {
|
|
|
219
220
|
}
|
|
220
221
|
},
|
|
221
222
|
methods: {
|
|
223
|
+
// 初始化尺寸观察器
|
|
222
224
|
initResizeObserver() {
|
|
223
|
-
if (typeof ResizeObserver !== 'undefined'
|
|
225
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
224
226
|
this.resizeObserver = new ResizeObserver(() => {
|
|
225
|
-
this.
|
|
227
|
+
this.getScrollBodyH()
|
|
226
228
|
})
|
|
227
229
|
this.resizeObserver.observe(this.$refs.Table)
|
|
228
230
|
}
|
|
229
231
|
},
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
232
|
+
/** 根据内容高度计算滚动长度 */
|
|
233
|
+
getScrollBodyH() {
|
|
234
|
+
if (!this.$refs.Table) return
|
|
235
|
+
|
|
236
|
+
const { Table, TableHead, TableListTitle, TablePagination } = this.$refs
|
|
237
|
+
const tableHeader = Table.querySelector('.ant-table-thead')
|
|
238
|
+
|
|
239
|
+
// 获取各部分高度
|
|
240
|
+
const clientHeight = Table.clientHeight
|
|
241
|
+
const headerHeight = TableHead?.offsetHeight || 0
|
|
242
|
+
const tableHeaderHeight = tableHeader?.offsetHeight || 0
|
|
243
|
+
const tableTitleHeight = TableListTitle?.offsetHeight || 0
|
|
244
|
+
const paginationHeight = TablePagination?.offsetHeight || 0
|
|
245
|
+
|
|
246
|
+
// 计算滚动区域高度
|
|
247
|
+
const baseSpacing = 16
|
|
248
|
+
const bufferSpace = 24
|
|
249
|
+
this.tableScrollBody = clientHeight -
|
|
250
|
+
headerHeight -
|
|
251
|
+
tableHeaderHeight -
|
|
252
|
+
tableTitleHeight -
|
|
253
|
+
paginationHeight -
|
|
254
|
+
baseSpacing -
|
|
255
|
+
bufferSpace
|
|
245
256
|
},
|
|
246
257
|
handleCheckFile(record, props) {
|
|
247
258
|
this.$postM({
|