xt-element-ui 1.3.0 → 1.3.2
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/docs/components/base/xt-map.md +331 -0
- package/docs/components/base/xt-step-price.md +103 -217
- package/lib/index.common.js +2118 -40
- package/lib/index.css +1 -1
- package/lib/index.umd.js +2118 -40
- package/lib/index.umd.min.js +5 -5
- package/package.json +4 -3
- package/src/components/ex-button/index.js +8 -2
- package/src/components/ex-chart/index.js +6 -0
- package/src/components/ex-date-picker/index.js +8 -2
- package/src/components/ex-icon/index.js +6 -0
- package/src/components/ex-page/index.js +8 -2
- package/src/components/ex-select-tree/index.js +8 -2
- package/src/components/ex-table/index.js +6 -0
- package/src/components/ex-upload/index.js +6 -0
- package/src/components/xt-button/index.js +8 -2
- package/src/components/xt-button/index.vue +1 -1
- package/src/components/xt-card/index.js +8 -2
- package/src/components/xt-card-item/index.js +8 -2
- package/src/components/xt-config-provider/index.js +6 -0
- package/src/components/xt-flex-box/index.js +8 -2
- package/src/components/xt-flex-box/style/index.scss +0 -9
- package/src/components/xt-grid-box/index.js +8 -2
- package/src/components/xt-grid-item/index.js +7 -1
- package/src/components/xt-input/index.js +8 -2
- package/src/components/xt-map/adapters/amap.js +235 -0
- package/src/components/xt-map/adapters/baidu.js +254 -0
- package/src/components/xt-map/adapters/base.js +267 -0
- package/src/components/xt-map/adapters/index.js +29 -0
- package/src/components/xt-map/adapters/tianditu.js +242 -0
- package/src/components/xt-map/config/xt-map-config.js +197 -0
- package/src/components/xt-map/index.js +30 -0
- package/src/components/xt-map/index.vue +351 -0
- package/src/components/xt-map/loaders/script-loader.js +114 -0
- package/src/components/xt-map/provider.vue +200 -0
- package/src/components/xt-map/style/index.scss +77 -0
- package/src/components/xt-step-price/index.js +9 -0
- package/src/components/xt-step-price-item/index.js +6 -0
- package/src/components/xt-step-price-item/index.vue +3 -1
- package/src/components/xt-text/index.js +8 -2
- package/src/components/xt-time/index.js +6 -0
- package/src/index.js +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xt-element-ui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "基于 Vue 2.7 + ElementUI 的企业级组件库,提供丰富的自定义组件和扩展组件",
|
|
5
5
|
"main": "lib/index.common.js",
|
|
6
6
|
"module": "lib/index.esm.js",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"echarts": "^6.1.0",
|
|
37
37
|
"element-ui": "^2.15.14",
|
|
38
38
|
"sass": "^1.32.13",
|
|
39
|
-
"vue-server-renderer": "^2.7.14"
|
|
39
|
+
"vue-server-renderer": "^2.7.14",
|
|
40
|
+
"xt-element-ui": "^1.3.0"
|
|
40
41
|
},
|
|
41
42
|
"keywords": [
|
|
42
43
|
"vue",
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
"url": "https://github.com/JobWebNie/xt-element-ui/issues"
|
|
61
62
|
},
|
|
62
63
|
"homepage": "https://jobwebnie.github.io/xt-element-ui/",
|
|
63
|
-
|
|
64
|
+
"repository": {
|
|
64
65
|
"type": "git",
|
|
65
66
|
"url": "https://github.com/JobWebNie/xt-element-ui.git"
|
|
66
67
|
},
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import ExDatePicker from './index.vue'
|
|
2
|
-
|
|
1
|
+
import ExDatePicker from './index.vue'
|
|
2
|
+
|
|
3
|
+
ExDatePicker.install = function (Vue) {
|
|
4
|
+
Vue.component(ExDatePicker.name, ExDatePicker)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default ExDatePicker
|
|
8
|
+
export { ExDatePicker }
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import ExSelectTree from './index.vue'
|
|
2
|
-
|
|
1
|
+
import ExSelectTree from './index.vue'
|
|
2
|
+
|
|
3
|
+
ExSelectTree.install = function (Vue) {
|
|
4
|
+
Vue.component(ExSelectTree.name, ExSelectTree)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default ExSelectTree
|
|
8
|
+
export { ExSelectTree }
|
|
@@ -33,7 +33,7 @@ export default {
|
|
|
33
33
|
type: {
|
|
34
34
|
type: String,
|
|
35
35
|
default: '',
|
|
36
|
-
validator: (val) => ['', 'primary', 'success', 'warning', 'danger'
|
|
36
|
+
validator: (val) => ['', 'primary', 'success', 'warning', 'danger'].includes(val)
|
|
37
37
|
},
|
|
38
38
|
size: {
|
|
39
39
|
type: String,
|
|
@@ -4,15 +4,6 @@
|
|
|
4
4
|
display: flex;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
.xt-flex-box.flex.direction-row > .flex,
|
|
8
|
-
.xt-flex-box.flex.direction-row-reverse > .flex {
|
|
9
|
-
width: 100%;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.xt-flex-box.flex.direction-column > .flex,
|
|
13
|
-
.xt-flex-box.flex.direction-column-reverse > .flex {
|
|
14
|
-
height: 100%;
|
|
15
|
-
}
|
|
16
7
|
|
|
17
8
|
.xt-flex-box.is-inline {
|
|
18
9
|
display: inline-flex;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 高德地图适配器 (AMap)
|
|
3
|
+
* 以高德为基准,所有 xt-map 枚举直接映射
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { MapAdapterBase } from './base'
|
|
7
|
+
import { hasGlobal } from '../loaders/script-loader'
|
|
8
|
+
|
|
9
|
+
const A_MAP_MAP_TYPES = {
|
|
10
|
+
standard: 'amap', // 标准/矢量
|
|
11
|
+
satellite: 'satellite', // 卫星
|
|
12
|
+
hybrid: 'satellite', // 混合(卫星+路网,用卫星+路网图层组合实现)
|
|
13
|
+
traffic: 'traffic' // 实时路况(叠加在 standard 上)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// 高德地图样式 ID(主题映射)
|
|
17
|
+
const A_MAP_STYLES = {
|
|
18
|
+
light: 'amap://styles/normal',
|
|
19
|
+
dark: 'amap://styles/dark'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class AMapAdapter extends MapAdapterBase {
|
|
23
|
+
constructor(container, options = {}) {
|
|
24
|
+
super(container, options)
|
|
25
|
+
this._mapTypeMap = { ...A_MAP_MAP_TYPES }
|
|
26
|
+
this._trafficLayer = null // 路况图层引用
|
|
27
|
+
this._satelliteLayer = null // 卫星图层
|
|
28
|
+
this._roadnetLayer = null // 路网图层(用于 hybrid)
|
|
29
|
+
this._currentLayers = [] // 当前叠加图层
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getScriptUrl() {
|
|
33
|
+
if (this.apiUrl) return this.apiUrl
|
|
34
|
+
if (!this.apiKey) {
|
|
35
|
+
console.warn('[XtMap] 高德地图需要配置 apiKey')
|
|
36
|
+
return ''
|
|
37
|
+
}
|
|
38
|
+
// 高德 2.0 Web API
|
|
39
|
+
return `https://webapi.amap.com/maps?v=2.0&key=${encodeURIComponent(this.apiKey)}&plugin=AMap.Scale,AMap.ToolBar`
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 脚本加载前设置高德 2.0 安全密钥
|
|
44
|
+
*/
|
|
45
|
+
beforeLoadScript() {
|
|
46
|
+
const securityJsCode = this.options.securityJsCode || (typeof window !== 'undefined' && window._AMapSecurityConfig && window._AMapSecurityConfig.securityJsCode) || ''
|
|
47
|
+
if (securityJsCode && typeof window !== 'undefined') {
|
|
48
|
+
window._AMapSecurityConfig = {
|
|
49
|
+
securityJsCode: securityJsCode
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
isSdkLoaded() {
|
|
55
|
+
return hasGlobal('AMap') && typeof window.AMap === 'function'
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async createMap() {
|
|
59
|
+
const AMap = window.AMap
|
|
60
|
+
if (!AMap) throw new Error('[XtMap] 高德地图 SDK 未加载')
|
|
61
|
+
|
|
62
|
+
const mapOptions = {
|
|
63
|
+
center: this.center,
|
|
64
|
+
zoom: this.zoom,
|
|
65
|
+
mapStyle: A_MAP_STYLES[this.theme] || A_MAP_STYLES.light,
|
|
66
|
+
viewMode: '2D',
|
|
67
|
+
resizeEnable: true
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
this.mapInstance = new AMap.Map(this.container, mapOptions)
|
|
71
|
+
|
|
72
|
+
// 应用地图类型
|
|
73
|
+
this._applyMapType(this.mapType)
|
|
74
|
+
|
|
75
|
+
// 绑定事件(延迟到地图就绪后)
|
|
76
|
+
await new Promise((resolve) => {
|
|
77
|
+
this.mapInstance.on('complete', () => resolve())
|
|
78
|
+
// 兜底:1秒后强制 resolve
|
|
79
|
+
setTimeout(resolve, 1500)
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
// 重新绑定已注册事件
|
|
83
|
+
for (const [eventName, handler] of this.eventHandlers.entries()) {
|
|
84
|
+
this._bindEvent(eventName, handler)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
_applyMapType(type) {
|
|
89
|
+
if (!this.mapInstance) return
|
|
90
|
+
const AMap = window.AMap
|
|
91
|
+
if (!AMap) return
|
|
92
|
+
|
|
93
|
+
// 清除所有叠加图层
|
|
94
|
+
this._clearLayers()
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
// 设置底图样式
|
|
98
|
+
this.mapInstance.setMapStyle(A_MAP_STYLES[this.theme] || A_MAP_STYLES.light)
|
|
99
|
+
|
|
100
|
+
if (type === 'satellite') {
|
|
101
|
+
this._satelliteLayer = new AMap.TileLayer.Satellite()
|
|
102
|
+
this.mapInstance.add(this._satelliteLayer)
|
|
103
|
+
this._currentLayers.push(this._satelliteLayer)
|
|
104
|
+
} else if (type === 'hybrid') {
|
|
105
|
+
// 卫星 + 路网
|
|
106
|
+
this._satelliteLayer = new AMap.TileLayer.Satellite()
|
|
107
|
+
this._roadnetLayer = new AMap.TileLayer.RoadNet()
|
|
108
|
+
this.mapInstance.add([this._satelliteLayer, this._roadnetLayer])
|
|
109
|
+
this._currentLayers.push(this._satelliteLayer, this._roadnetLayer)
|
|
110
|
+
} else if (type === 'traffic') {
|
|
111
|
+
// 路况图层叠加在 standard 上
|
|
112
|
+
this._trafficLayer = new AMap.TileLayer.Traffic({
|
|
113
|
+
autoRefresh: true,
|
|
114
|
+
interval: 180
|
|
115
|
+
})
|
|
116
|
+
this.mapInstance.add(this._trafficLayer)
|
|
117
|
+
this._currentLayers.push(this._trafficLayer)
|
|
118
|
+
}
|
|
119
|
+
} catch (e) {
|
|
120
|
+
console.warn('[XtMap] 设置地图类型失败:', e)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
_clearLayers() {
|
|
125
|
+
if (!this.mapInstance) return
|
|
126
|
+
try {
|
|
127
|
+
if (this._currentLayers.length > 0) {
|
|
128
|
+
this.mapInstance.remove(this._currentLayers)
|
|
129
|
+
}
|
|
130
|
+
} catch (e) {
|
|
131
|
+
// 忽略
|
|
132
|
+
}
|
|
133
|
+
this._currentLayers = []
|
|
134
|
+
this._trafficLayer = null
|
|
135
|
+
this._satelliteLayer = null
|
|
136
|
+
this._roadnetLayer = null
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
_applyTheme(theme) {
|
|
140
|
+
if (!this.mapInstance) return
|
|
141
|
+
try {
|
|
142
|
+
this.mapInstance.setMapStyle(A_MAP_STYLES[theme] || A_MAP_STYLES.light)
|
|
143
|
+
// 主题变更可能影响图层显示,重新应用地图类型
|
|
144
|
+
this._applyMapType(this.mapType)
|
|
145
|
+
} catch (e) {
|
|
146
|
+
console.warn('[XtMap] 设置主题失败:', e)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
_applyCenter(center) {
|
|
151
|
+
if (!this.mapInstance) return
|
|
152
|
+
try {
|
|
153
|
+
this.mapInstance.setCenter(center)
|
|
154
|
+
} catch (e) {
|
|
155
|
+
// 忽略
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
_applyZoom(zoom) {
|
|
160
|
+
if (!this.mapInstance) return
|
|
161
|
+
try {
|
|
162
|
+
this.mapInstance.setZoom(zoom)
|
|
163
|
+
} catch (e) {
|
|
164
|
+
// 忽略
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
getCenter() {
|
|
169
|
+
if (this.mapInstance && this.mapInstance.getCenter) {
|
|
170
|
+
const c = this.mapInstance.getCenter()
|
|
171
|
+
return [c.lng, c.lat]
|
|
172
|
+
}
|
|
173
|
+
return this.center
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
getZoom() {
|
|
177
|
+
if (this.mapInstance && this.mapInstance.getZoom) {
|
|
178
|
+
return this.mapInstance.getZoom()
|
|
179
|
+
}
|
|
180
|
+
return this.zoom
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
_bindEvent(eventName, handler) {
|
|
184
|
+
if (!this.mapInstance) return
|
|
185
|
+
try {
|
|
186
|
+
// 统一事件名映射
|
|
187
|
+
const eventMap = {
|
|
188
|
+
click: 'click',
|
|
189
|
+
moveend: 'moveend',
|
|
190
|
+
zoomend: 'zoomend',
|
|
191
|
+
zoomchange: 'zoomchange',
|
|
192
|
+
mapmove: 'mapmove',
|
|
193
|
+
complete: 'complete',
|
|
194
|
+
resize: 'resize'
|
|
195
|
+
}
|
|
196
|
+
const nativeEvent = eventMap[eventName] || eventName
|
|
197
|
+
this.mapInstance.on(nativeEvent, (e) => {
|
|
198
|
+
// 统一事件参数格式
|
|
199
|
+
const normalized = {
|
|
200
|
+
originalEvent: e,
|
|
201
|
+
lnglat: e && e.lnglat ? [e.lnglat.lng, e.lnglat.lat] : null
|
|
202
|
+
}
|
|
203
|
+
handler(normalized)
|
|
204
|
+
})
|
|
205
|
+
} catch (err) {
|
|
206
|
+
console.warn('[XtMap] 事件绑定失败:', eventName, err)
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
_unbindEvent(eventName, handler) {
|
|
211
|
+
if (!this.mapInstance) return
|
|
212
|
+
try {
|
|
213
|
+
this.mapInstance.off(eventName, handler)
|
|
214
|
+
} catch (e) {
|
|
215
|
+
// 忽略
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
_applyResize() {
|
|
220
|
+
if (this.mapInstance && this.mapInstance.resize) {
|
|
221
|
+
try {
|
|
222
|
+
this.mapInstance.resize()
|
|
223
|
+
} catch (e) {
|
|
224
|
+
// 忽略
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
destroy() {
|
|
230
|
+
this._clearLayers()
|
|
231
|
+
super.destroy()
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export default AMapAdapter
|