xt-element-ui 1.3.2 → 1.3.4

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.
Files changed (112) hide show
  1. package/CHANGELOG.md +72 -72
  2. package/LICENSE +21 -21
  3. package/README.md +240 -240
  4. package/docs/README.md +100 -100
  5. package/docs/components/base/xt-button.md +114 -114
  6. package/docs/components/base/xt-card-item.md +104 -104
  7. package/docs/components/base/xt-card.md +108 -108
  8. package/docs/components/base/xt-config-provider.md +199 -199
  9. package/docs/components/base/xt-flex-box.md +115 -115
  10. package/docs/components/base/xt-grid-box.md +302 -302
  11. package/docs/components/base/xt-input.md +150 -150
  12. package/docs/components/base/xt-map-provider.md +23 -0
  13. package/docs/components/base/xt-map.md +331 -331
  14. package/docs/components/base/xt-step-price.md +165 -165
  15. package/docs/components/base/xt-text.md +212 -212
  16. package/docs/components/base/xt-time.md +165 -165
  17. package/docs/components/extend/ex-bar.md +67 -67
  18. package/docs/components/extend/ex-button.md +62 -62
  19. package/docs/components/extend/ex-card.md +86 -86
  20. package/docs/components/extend/ex-chart.md +463 -463
  21. package/docs/components/extend/ex-icon.md +189 -189
  22. package/docs/components/extend/ex-line.md +70 -70
  23. package/docs/components/extend/ex-multi.md +155 -155
  24. package/docs/components/extend/ex-pie.md +69 -69
  25. package/docs/components/extend/ex-select-tree.md +210 -210
  26. package/docs/components/extend/ex-table.md +590 -590
  27. package/docs/components/extend/ex-upload.md +134 -134
  28. package/docs/components/utils/size.md +147 -147
  29. package/docs/components/utils/theme.md +182 -182
  30. package/lib/index.common.js +4131 -4162
  31. package/lib/index.css +1 -1
  32. package/lib/index.umd.js +4099 -4129
  33. package/lib/index.umd.min.js +3 -3
  34. package/package.json +80 -81
  35. package/src/components/ex-button/index.js +7 -7
  36. package/src/components/ex-button/index.vue +66 -66
  37. package/src/components/ex-button/style/index.scss +67 -67
  38. package/src/components/ex-card/index.js +7 -7
  39. package/src/components/ex-card/index.vue +68 -68
  40. package/src/components/ex-card/style/index.scss +73 -73
  41. package/src/components/ex-chart/index.js +7 -7
  42. package/src/components/ex-chart/index.vue +136 -136
  43. package/src/components/ex-date-picker/index.js +7 -7
  44. package/src/components/ex-icon/index.js +7 -7
  45. package/src/components/ex-icon/index.vue +168 -168
  46. package/src/components/ex-icon/style/index.scss +7 -7
  47. package/src/components/ex-page/index.js +7 -7
  48. package/src/components/ex-select-tree/index.js +7 -7
  49. package/src/components/ex-table/ExTableCell.vue +22 -22
  50. package/src/components/ex-table/index.js +7 -7
  51. package/src/components/ex-table/virtualScrollData.js +35 -35
  52. package/src/components/ex-upload/index.js +7 -7
  53. package/src/components/index.scss +39 -39
  54. package/src/components/xt-button/index.js +7 -7
  55. package/src/components/xt-button/index.vue +97 -97
  56. package/src/components/xt-card/index.js +7 -7
  57. package/src/components/xt-card/style/index.scss +48 -48
  58. package/src/components/xt-card-item/index.js +7 -7
  59. package/src/components/xt-card-item/style/index copy.scss +71 -71
  60. package/src/components/xt-card-item/style/index.scss +82 -82
  61. package/src/components/xt-config-provider/index.js +7 -7
  62. package/src/components/xt-config-provider/index.vue +362 -362
  63. package/src/components/xt-config-provider/style/index.scss +11 -11
  64. package/src/components/xt-flex-box/index.js +7 -7
  65. package/src/components/xt-flex-box/style/index.scss +81 -81
  66. package/src/components/xt-grid-box/index.js +7 -7
  67. package/src/components/xt-grid-box/style/index.scss +92 -92
  68. package/src/components/xt-grid-item/index.js +7 -7
  69. package/src/components/xt-grid-item/index.vue +106 -106
  70. package/src/components/xt-input/index.js +7 -7
  71. package/src/components/xt-input/index.vue +66 -66
  72. package/src/components/xt-input/style/index.scss +84 -84
  73. package/src/components/xt-map/adapters/amap.js +235 -235
  74. package/src/components/xt-map/adapters/baidu.js +254 -254
  75. package/src/components/xt-map/adapters/base.js +267 -267
  76. package/src/components/xt-map/adapters/index.js +29 -29
  77. package/src/components/xt-map/adapters/tianditu.js +242 -242
  78. package/src/components/xt-map/config/xt-map-config.js +197 -197
  79. package/src/components/xt-map/index.js +8 -30
  80. package/src/components/xt-map/index.vue +351 -351
  81. package/src/components/xt-map/loaders/script-loader.js +114 -114
  82. package/src/components/xt-map/provider.vue +200 -200
  83. package/src/components/xt-map/style/index.scss +77 -77
  84. package/src/components/xt-map-provider/index.js +8 -0
  85. package/src/components/xt-step-price/index.js +10 -10
  86. package/src/components/xt-step-price/index.vue +272 -272
  87. package/src/components/xt-step-price/style/index.scss +123 -123
  88. package/src/components/xt-step-price-item/index.js +7 -7
  89. package/src/components/xt-step-price-item/index.vue +187 -187
  90. package/src/components/xt-text/index.js +7 -7
  91. package/src/components/xt-text/index.vue +1 -1
  92. package/src/components/xt-text/style/index.scss +92 -92
  93. package/src/components/xt-time/index.js +7 -7
  94. package/src/components/xt-time/index.vue +313 -313
  95. package/src/components/xt-time/style/index.scss +23 -23
  96. package/src/config/element-registry.js +135 -135
  97. package/src/index.js +162 -178
  98. package/src/styles/css-variables.scss +257 -257
  99. package/src/styles/theme/background.scss +5 -5
  100. package/src/styles/theme/border-radius.scss +3 -3
  101. package/src/styles/theme/borders.scss +3 -3
  102. package/src/styles/theme/colors.scss +101 -101
  103. package/src/styles/theme/component-variables.scss +69 -69
  104. package/src/styles/theme/dark-variables.scss +28 -28
  105. package/src/styles/theme/font.scss +12 -12
  106. package/src/styles/theme/index.scss +11 -11
  107. package/src/styles/theme/shadows.scss +2 -2
  108. package/src/styles/theme/spacing.scss +4 -4
  109. package/src/styles/theme/transitions.scss +2 -2
  110. package/src/styles/theme/typography.scss +4 -4
  111. package/src/styles/variables-export.scss +85 -85
  112. package/src/utils/index.js +191 -202
@@ -1,267 +1,267 @@
1
- /**
2
- * 地图适配器基类
3
- * 定义统一的 API 接口,各地图引擎(高德/天地图/百度)通过继承/实现该接口完成适配
4
- *
5
- * 统一坐标系统:WGS84 (lng, lat) 作为输入输出标准,各适配器内部处理转换
6
- * 统一地图类型:standard | satellite | hybrid | traffic
7
- * 统一主题:light | dark
8
- */
9
-
10
- import { loadScript, hasGlobal } from '../loaders/script-loader'
11
-
12
- // 地图类型 -> 内部常量(各适配器可覆盖转换)
13
- const DEFAULT_MAP_TYPE_MAP = {
14
- standard: 'standard',
15
- satellite: 'satellite',
16
- hybrid: 'hybrid',
17
- traffic: 'traffic'
18
- }
19
-
20
- export class MapAdapterBase {
21
- constructor(container, options = {}) {
22
- this.container = container
23
- this.options = options
24
- this.mapInstance = null
25
- this.mapType = options.mapType || 'standard'
26
- this.theme = options.theme || 'light'
27
- this.center = options.center || [116.397428, 39.90923]
28
- this.zoom = options.zoom || 11
29
- this.apiKey = options.apiKey || ''
30
- this.apiUrl = options.apiUrl || null
31
- this.plugins = options.plugins || []
32
- this.eventHandlers = new Map()
33
- this.ready = false
34
- this._mapTypeMap = { ...DEFAULT_MAP_TYPE_MAP }
35
- }
36
-
37
- /**
38
- * 获取 SDK 脚本 URL(各适配器必须实现)
39
- * @returns {string}
40
- */
41
- getScriptUrl() {
42
- throw new Error('[XtMap] 子类必须实现 getScriptUrl()')
43
- }
44
-
45
- /**
46
- * 检查 SDK 是否已加载
47
- */
48
- isSdkLoaded() {
49
- throw new Error('[XtMap] 子类必须实现 isSdkLoaded()')
50
- }
51
-
52
- /**
53
- * 在脚本加载前执行(可选覆盖)
54
- * 用于设置 securityJsCode、注册全局 callback 等前置准备
55
- */
56
- beforeLoadScript() {
57
- // 可选实现 - 各适配器可覆盖
58
- }
59
-
60
- /**
61
- * 创建地图实例(各适配器必须实现)
62
- */
63
- async createMap() {
64
- throw new Error('[XtMap] 子类必须实现 createMap()')
65
- }
66
-
67
- /**
68
- * 加载 SDK 并初始化地图
69
- */
70
- async init() {
71
- if (!this.container) {
72
- throw new Error('[XtMap] 缺少容器元素')
73
- }
74
-
75
- if (!this.isSdkLoaded()) {
76
- // 1. 脚本加载前执行钩子(设置安全密钥等)
77
- this.beforeLoadScript()
78
-
79
- // 2. 获取脚本 URL
80
- const url = this.getScriptUrl()
81
- if (!url) {
82
- throw new Error('[XtMap] 缺少 API URL,请配置 apiKey 或 apiUrl')
83
- }
84
-
85
- // 3. 动态加载脚本
86
- await loadScript(url)
87
-
88
- // 4. 等待 SDK 初始化全局对象(部分 SDK 需要等待 callback 或脚本内部初始化完成)
89
- await this._waitForSdkReady()
90
- }
91
-
92
- // 5. 创建地图实例
93
- await this.createMap()
94
- this.ready = true
95
- return this.mapInstance
96
- }
97
-
98
- /**
99
- * 等待 SDK 准备好(部分地图 SDK 需要等待 callback 执行)
100
- */
101
- async _waitForSdkReady() {
102
- return new Promise((resolve) => {
103
- let attempts = 0
104
- const maxAttempts = 100
105
- const check = () => {
106
- if (this.isSdkLoaded() || attempts >= maxAttempts) {
107
- resolve()
108
- } else {
109
- attempts++
110
- setTimeout(check, 100)
111
- }
112
- }
113
- check()
114
- })
115
- }
116
-
117
- /**
118
- * 统一地图类型转换:xt-map 枚举 -> 引擎内部值
119
- */
120
- getNativeMapType(xtType) {
121
- return this._mapTypeMap[xtType] || this._mapTypeMap.standard
122
- }
123
-
124
- /**
125
- * 设置地图类型
126
- */
127
- setMapType(type) {
128
- this.mapType = type
129
- if (this.ready && this.mapInstance) {
130
- this._applyMapType(type)
131
- }
132
- }
133
-
134
- /**
135
- * 应用地图类型到引擎(各适配器实现)
136
- */
137
- _applyMapType(type) {
138
- // 可选实现
139
- }
140
-
141
- /**
142
- * 设置主题
143
- */
144
- setTheme(theme) {
145
- this.theme = theme
146
- if (this.ready && this.mapInstance) {
147
- this._applyTheme(theme)
148
- }
149
- }
150
-
151
- /**
152
- * 应用主题到引擎(各适配器实现)
153
- */
154
- _applyTheme(theme) {
155
- // 可选实现
156
- }
157
-
158
- /**
159
- * 设置中心坐标 [lng, lat]
160
- */
161
- setCenter(center) {
162
- this.center = center
163
- if (this.ready && this.mapInstance) {
164
- this._applyCenter(center)
165
- }
166
- }
167
-
168
- _applyCenter(center) {
169
- // 各适配器实现
170
- }
171
-
172
- /**
173
- * 设置缩放级别
174
- */
175
- setZoom(zoom) {
176
- this.zoom = zoom
177
- if (this.ready && this.mapInstance) {
178
- this._applyZoom(zoom)
179
- }
180
- }
181
-
182
- _applyZoom(zoom) {
183
- // 各适配器实现
184
- }
185
-
186
- /**
187
- * 获取当前中心坐标
188
- */
189
- getCenter() {
190
- return this.center
191
- }
192
-
193
- /**
194
- * 获取当前缩放级别
195
- */
196
- getZoom() {
197
- return this.zoom
198
- }
199
-
200
- /**
201
- * 获取原始地图实例(用于高级自定义操作)
202
- */
203
- getNativeMap() {
204
- return this.mapInstance
205
- }
206
-
207
- /**
208
- * 绑定事件(统一事件名:click, moveend, zoomend, ready 等)
209
- */
210
- on(eventName, handler) {
211
- if (typeof handler !== 'function') return
212
- this.eventHandlers.set(eventName, handler)
213
- if (this.ready && this.mapInstance) {
214
- this._bindEvent(eventName, handler)
215
- }
216
- }
217
-
218
- _bindEvent(eventName, handler) {
219
- // 各适配器实现具体事件绑定
220
- }
221
-
222
- /**
223
- * 解绑事件
224
- */
225
- off(eventName) {
226
- const handler = this.eventHandlers.get(eventName)
227
- if (handler && this.ready && this.mapInstance) {
228
- this._unbindEvent(eventName, handler)
229
- }
230
- this.eventHandlers.delete(eventName)
231
- }
232
-
233
- _unbindEvent(eventName, handler) {
234
- // 各适配器实现
235
- }
236
-
237
- /**
238
- * 调整地图大小(容器尺寸变化后调用)
239
- */
240
- resize() {
241
- if (this.ready && this.mapInstance) {
242
- this._applyResize()
243
- }
244
- }
245
-
246
- _applyResize() {
247
- // 各适配器实现
248
- }
249
-
250
- /**
251
- * 销毁地图
252
- */
253
- destroy() {
254
- this.eventHandlers.clear()
255
- if (this.mapInstance && typeof this.mapInstance.destroy === 'function') {
256
- try {
257
- this.mapInstance.destroy()
258
- } catch (e) {
259
- // 忽略销毁错误
260
- }
261
- }
262
- this.mapInstance = null
263
- this.ready = false
264
- }
265
- }
266
-
267
- export default MapAdapterBase
1
+ /**
2
+ * 地图适配器基类
3
+ * 定义统一的 API 接口,各地图引擎(高德/天地图/百度)通过继承/实现该接口完成适配
4
+ *
5
+ * 统一坐标系统:WGS84 (lng, lat) 作为输入输出标准,各适配器内部处理转换
6
+ * 统一地图类型:standard | satellite | hybrid | traffic
7
+ * 统一主题:light | dark
8
+ */
9
+
10
+ import { loadScript, hasGlobal } from '../loaders/script-loader'
11
+
12
+ // 地图类型 -> 内部常量(各适配器可覆盖转换)
13
+ const DEFAULT_MAP_TYPE_MAP = {
14
+ standard: 'standard',
15
+ satellite: 'satellite',
16
+ hybrid: 'hybrid',
17
+ traffic: 'traffic'
18
+ }
19
+
20
+ export class MapAdapterBase {
21
+ constructor(container, options = {}) {
22
+ this.container = container
23
+ this.options = options
24
+ this.mapInstance = null
25
+ this.mapType = options.mapType || 'standard'
26
+ this.theme = options.theme || 'light'
27
+ this.center = options.center || [116.397428, 39.90923]
28
+ this.zoom = options.zoom || 11
29
+ this.apiKey = options.apiKey || ''
30
+ this.apiUrl = options.apiUrl || null
31
+ this.plugins = options.plugins || []
32
+ this.eventHandlers = new Map()
33
+ this.ready = false
34
+ this._mapTypeMap = { ...DEFAULT_MAP_TYPE_MAP }
35
+ }
36
+
37
+ /**
38
+ * 获取 SDK 脚本 URL(各适配器必须实现)
39
+ * @returns {string}
40
+ */
41
+ getScriptUrl() {
42
+ throw new Error('[XtMap] 子类必须实现 getScriptUrl()')
43
+ }
44
+
45
+ /**
46
+ * 检查 SDK 是否已加载
47
+ */
48
+ isSdkLoaded() {
49
+ throw new Error('[XtMap] 子类必须实现 isSdkLoaded()')
50
+ }
51
+
52
+ /**
53
+ * 在脚本加载前执行(可选覆盖)
54
+ * 用于设置 securityJsCode、注册全局 callback 等前置准备
55
+ */
56
+ beforeLoadScript() {
57
+ // 可选实现 - 各适配器可覆盖
58
+ }
59
+
60
+ /**
61
+ * 创建地图实例(各适配器必须实现)
62
+ */
63
+ async createMap() {
64
+ throw new Error('[XtMap] 子类必须实现 createMap()')
65
+ }
66
+
67
+ /**
68
+ * 加载 SDK 并初始化地图
69
+ */
70
+ async init() {
71
+ if (!this.container) {
72
+ throw new Error('[XtMap] 缺少容器元素')
73
+ }
74
+
75
+ if (!this.isSdkLoaded()) {
76
+ // 1. 脚本加载前执行钩子(设置安全密钥等)
77
+ this.beforeLoadScript()
78
+
79
+ // 2. 获取脚本 URL
80
+ const url = this.getScriptUrl()
81
+ if (!url) {
82
+ throw new Error('[XtMap] 缺少 API URL,请配置 apiKey 或 apiUrl')
83
+ }
84
+
85
+ // 3. 动态加载脚本
86
+ await loadScript(url)
87
+
88
+ // 4. 等待 SDK 初始化全局对象(部分 SDK 需要等待 callback 或脚本内部初始化完成)
89
+ await this._waitForSdkReady()
90
+ }
91
+
92
+ // 5. 创建地图实例
93
+ await this.createMap()
94
+ this.ready = true
95
+ return this.mapInstance
96
+ }
97
+
98
+ /**
99
+ * 等待 SDK 准备好(部分地图 SDK 需要等待 callback 执行)
100
+ */
101
+ async _waitForSdkReady() {
102
+ return new Promise((resolve) => {
103
+ let attempts = 0
104
+ const maxAttempts = 100
105
+ const check = () => {
106
+ if (this.isSdkLoaded() || attempts >= maxAttempts) {
107
+ resolve()
108
+ } else {
109
+ attempts++
110
+ setTimeout(check, 100)
111
+ }
112
+ }
113
+ check()
114
+ })
115
+ }
116
+
117
+ /**
118
+ * 统一地图类型转换:xt-map 枚举 -> 引擎内部值
119
+ */
120
+ getNativeMapType(xtType) {
121
+ return this._mapTypeMap[xtType] || this._mapTypeMap.standard
122
+ }
123
+
124
+ /**
125
+ * 设置地图类型
126
+ */
127
+ setMapType(type) {
128
+ this.mapType = type
129
+ if (this.ready && this.mapInstance) {
130
+ this._applyMapType(type)
131
+ }
132
+ }
133
+
134
+ /**
135
+ * 应用地图类型到引擎(各适配器实现)
136
+ */
137
+ _applyMapType(type) {
138
+ // 可选实现
139
+ }
140
+
141
+ /**
142
+ * 设置主题
143
+ */
144
+ setTheme(theme) {
145
+ this.theme = theme
146
+ if (this.ready && this.mapInstance) {
147
+ this._applyTheme(theme)
148
+ }
149
+ }
150
+
151
+ /**
152
+ * 应用主题到引擎(各适配器实现)
153
+ */
154
+ _applyTheme(theme) {
155
+ // 可选实现
156
+ }
157
+
158
+ /**
159
+ * 设置中心坐标 [lng, lat]
160
+ */
161
+ setCenter(center) {
162
+ this.center = center
163
+ if (this.ready && this.mapInstance) {
164
+ this._applyCenter(center)
165
+ }
166
+ }
167
+
168
+ _applyCenter(center) {
169
+ // 各适配器实现
170
+ }
171
+
172
+ /**
173
+ * 设置缩放级别
174
+ */
175
+ setZoom(zoom) {
176
+ this.zoom = zoom
177
+ if (this.ready && this.mapInstance) {
178
+ this._applyZoom(zoom)
179
+ }
180
+ }
181
+
182
+ _applyZoom(zoom) {
183
+ // 各适配器实现
184
+ }
185
+
186
+ /**
187
+ * 获取当前中心坐标
188
+ */
189
+ getCenter() {
190
+ return this.center
191
+ }
192
+
193
+ /**
194
+ * 获取当前缩放级别
195
+ */
196
+ getZoom() {
197
+ return this.zoom
198
+ }
199
+
200
+ /**
201
+ * 获取原始地图实例(用于高级自定义操作)
202
+ */
203
+ getNativeMap() {
204
+ return this.mapInstance
205
+ }
206
+
207
+ /**
208
+ * 绑定事件(统一事件名:click, moveend, zoomend, ready 等)
209
+ */
210
+ on(eventName, handler) {
211
+ if (typeof handler !== 'function') return
212
+ this.eventHandlers.set(eventName, handler)
213
+ if (this.ready && this.mapInstance) {
214
+ this._bindEvent(eventName, handler)
215
+ }
216
+ }
217
+
218
+ _bindEvent(eventName, handler) {
219
+ // 各适配器实现具体事件绑定
220
+ }
221
+
222
+ /**
223
+ * 解绑事件
224
+ */
225
+ off(eventName) {
226
+ const handler = this.eventHandlers.get(eventName)
227
+ if (handler && this.ready && this.mapInstance) {
228
+ this._unbindEvent(eventName, handler)
229
+ }
230
+ this.eventHandlers.delete(eventName)
231
+ }
232
+
233
+ _unbindEvent(eventName, handler) {
234
+ // 各适配器实现
235
+ }
236
+
237
+ /**
238
+ * 调整地图大小(容器尺寸变化后调用)
239
+ */
240
+ resize() {
241
+ if (this.ready && this.mapInstance) {
242
+ this._applyResize()
243
+ }
244
+ }
245
+
246
+ _applyResize() {
247
+ // 各适配器实现
248
+ }
249
+
250
+ /**
251
+ * 销毁地图
252
+ */
253
+ destroy() {
254
+ this.eventHandlers.clear()
255
+ if (this.mapInstance && typeof this.mapInstance.destroy === 'function') {
256
+ try {
257
+ this.mapInstance.destroy()
258
+ } catch (e) {
259
+ // 忽略销毁错误
260
+ }
261
+ }
262
+ this.mapInstance = null
263
+ this.ready = false
264
+ }
265
+ }
266
+
267
+ export default MapAdapterBase
@@ -1,29 +1,29 @@
1
- /**
2
- * 地图适配器索引
3
- * 根据 provider 字符串返回对应的适配器构造函数
4
- */
5
-
6
- import { AMapAdapter } from './amap'
7
- import { TiandituAdapter } from './tianditu'
8
- import { BaiduAdapter } from './baidu'
9
-
10
- export const adapters = {
11
- amap: AMapAdapter,
12
- tianditu: TiandituAdapter,
13
- baidu: BaiduAdapter
14
- }
15
-
16
- export const getAdapterClass = (provider) => {
17
- return adapters[provider] || AMapAdapter
18
- }
19
-
20
- export { AMapAdapter, TiandituAdapter, BaiduAdapter }
21
- export { MapAdapterBase } from './base'
22
-
23
- export default {
24
- adapters,
25
- getAdapterClass,
26
- AMapAdapter,
27
- TiandituAdapter,
28
- BaiduAdapter
29
- }
1
+ /**
2
+ * 地图适配器索引
3
+ * 根据 provider 字符串返回对应的适配器构造函数
4
+ */
5
+
6
+ import { AMapAdapter } from './amap'
7
+ import { TiandituAdapter } from './tianditu'
8
+ import { BaiduAdapter } from './baidu'
9
+
10
+ export const adapters = {
11
+ amap: AMapAdapter,
12
+ tianditu: TiandituAdapter,
13
+ baidu: BaiduAdapter
14
+ }
15
+
16
+ export const getAdapterClass = (provider) => {
17
+ return adapters[provider] || AMapAdapter
18
+ }
19
+
20
+ export { AMapAdapter, TiandituAdapter, BaiduAdapter }
21
+ export { MapAdapterBase } from './base'
22
+
23
+ export default {
24
+ adapters,
25
+ getAdapterClass,
26
+ AMapAdapter,
27
+ TiandituAdapter,
28
+ BaiduAdapter
29
+ }