xt-element-ui 2.1.61 → 2.2.0

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 (202) hide show
  1. package/docs/components/base/xt-bar.md +5 -5
  2. package/docs/components/base/xt-chart.md +5 -5
  3. package/docs/components/base/xt-line.md +4 -4
  4. package/docs/components/base/xt-multi.md +5 -5
  5. package/docs/components/base/xt-pie.md +5 -5
  6. package/lib/index.common.js +503 -165
  7. package/lib/index.css +1 -1
  8. package/lib/index.umd.js +506 -168
  9. package/lib/index.umd.min.js +1 -1
  10. package/lib/xt-badge/demo.html +10 -0
  11. package/lib/xt-badge/index.js +1 -0
  12. package/lib/xt-badge/xt-badge.common.js +335 -0
  13. package/lib/xt-badge/xt-badge.css +1 -0
  14. package/lib/xt-badge/xt-badge.umd.js +345 -0
  15. package/lib/xt-badge/xt-badge.umd.min.js +1 -0
  16. package/lib/xt-button/demo.html +10 -0
  17. package/lib/xt-button/index.js +1 -0
  18. package/lib/xt-button/xt-button.common.js +331 -0
  19. package/lib/xt-button/xt-button.css +1 -0
  20. package/lib/xt-button/xt-button.umd.js +341 -0
  21. package/lib/xt-button/xt-button.umd.min.js +1 -0
  22. package/lib/xt-card/demo.html +10 -0
  23. package/lib/xt-card/index.js +1 -0
  24. package/lib/xt-card/xt-card.common.js +325 -0
  25. package/lib/xt-card/xt-card.css +1 -0
  26. package/lib/xt-card/xt-card.umd.js +335 -0
  27. package/lib/xt-card/xt-card.umd.min.js +1 -0
  28. package/lib/xt-card-item/demo.html +10 -0
  29. package/lib/xt-card-item/index.js +1 -0
  30. package/lib/xt-card-item/xt-card-item.common.js +291 -0
  31. package/lib/xt-card-item/xt-card-item.css +1 -0
  32. package/lib/xt-card-item/xt-card-item.umd.js +301 -0
  33. package/lib/xt-card-item/xt-card-item.umd.min.js +1 -0
  34. package/lib/xt-chart/demo.html +10 -0
  35. package/lib/xt-chart/index.js +1 -0
  36. package/lib/xt-chart/xt-chart.common.js +109203 -0
  37. package/lib/xt-chart/xt-chart.css +1 -0
  38. package/lib/xt-chart/xt-chart.umd.js +109213 -0
  39. package/lib/xt-chart/xt-chart.umd.min.js +1 -0
  40. package/lib/xt-config-provider/demo.html +10 -0
  41. package/lib/xt-config-provider/index.js +1 -0
  42. package/lib/xt-config-provider/xt-config-provider.common.js +108388 -0
  43. package/lib/xt-config-provider/xt-config-provider.css +1 -0
  44. package/lib/xt-config-provider/xt-config-provider.umd.js +108398 -0
  45. package/lib/xt-config-provider/xt-config-provider.umd.min.js +1 -0
  46. package/lib/xt-date-picker/demo.html +10 -0
  47. package/lib/xt-date-picker/index.js +1 -0
  48. package/lib/xt-date-picker/xt-date-picker.common.js +768 -0
  49. package/lib/xt-date-picker/xt-date-picker.css +1 -0
  50. package/lib/xt-date-picker/xt-date-picker.umd.js +778 -0
  51. package/lib/xt-date-picker/xt-date-picker.umd.min.js +1 -0
  52. package/lib/xt-flex-box/demo.html +10 -0
  53. package/lib/xt-flex-box/index.js +1 -0
  54. package/lib/xt-flex-box/xt-flex-box.common.js +303 -0
  55. package/lib/xt-flex-box/xt-flex-box.css +1 -0
  56. package/lib/xt-flex-box/xt-flex-box.umd.js +313 -0
  57. package/lib/xt-flex-box/xt-flex-box.umd.min.js +1 -0
  58. package/lib/xt-form-schema/demo.html +10 -0
  59. package/lib/xt-form-schema/index.js +1 -0
  60. package/lib/xt-form-schema/xt-form-schema.common.js +510 -0
  61. package/lib/xt-form-schema/xt-form-schema.css +1 -0
  62. package/lib/xt-form-schema/xt-form-schema.umd.js +520 -0
  63. package/lib/xt-form-schema/xt-form-schema.umd.min.js +1 -0
  64. package/lib/xt-grid-box/demo.html +10 -0
  65. package/lib/xt-grid-box/index.js +1 -0
  66. package/lib/xt-grid-box/xt-grid-box.common.js +404 -0
  67. package/lib/xt-grid-box/xt-grid-box.css +1 -0
  68. package/lib/xt-grid-box/xt-grid-box.umd.js +414 -0
  69. package/lib/xt-grid-box/xt-grid-box.umd.min.js +1 -0
  70. package/lib/xt-grid-item/demo.html +10 -0
  71. package/lib/xt-grid-item/index.js +1 -0
  72. package/lib/xt-grid-item/xt-grid-item.common.js +381 -0
  73. package/lib/xt-grid-item/xt-grid-item.css +1 -0
  74. package/lib/xt-grid-item/xt-grid-item.umd.js +391 -0
  75. package/lib/xt-grid-item/xt-grid-item.umd.min.js +1 -0
  76. package/lib/xt-icon/demo.html +10 -0
  77. package/lib/xt-icon/index.js +1 -0
  78. package/lib/xt-icon/xt-icon.common.js +430 -0
  79. package/lib/xt-icon/xt-icon.css +1 -0
  80. package/lib/xt-icon/xt-icon.umd.js +440 -0
  81. package/lib/xt-icon/xt-icon.umd.min.js +1 -0
  82. package/lib/xt-input/demo.html +10 -0
  83. package/lib/xt-input/index.js +1 -0
  84. package/lib/xt-input/xt-input.common.js +584 -0
  85. package/lib/xt-input/xt-input.css +1 -0
  86. package/lib/xt-input/xt-input.umd.js +594 -0
  87. package/lib/xt-input/xt-input.umd.min.js +1 -0
  88. package/lib/xt-list/demo.html +10 -0
  89. package/lib/xt-list/index.js +1 -0
  90. package/lib/xt-list/xt-list.common.js +714 -0
  91. package/lib/xt-list/xt-list.css +1 -0
  92. package/lib/xt-list/xt-list.umd.js +724 -0
  93. package/lib/xt-list/xt-list.umd.min.js +1 -0
  94. package/lib/xt-map/demo.html +10 -0
  95. package/lib/xt-map/index.js +1 -0
  96. package/lib/xt-map/xt-map.common.js +1951 -0
  97. package/lib/xt-map/xt-map.css +1 -0
  98. package/lib/xt-map/xt-map.umd.js +1961 -0
  99. package/lib/xt-map/xt-map.umd.min.js +1 -0
  100. package/lib/xt-map-provider/demo.html +10 -0
  101. package/lib/xt-map-provider/index.js +1 -0
  102. package/lib/xt-map-provider/xt-map-provider.common.js +644 -0
  103. package/lib/xt-map-provider/xt-map-provider.css +1 -0
  104. package/lib/xt-map-provider/xt-map-provider.umd.js +654 -0
  105. package/lib/xt-map-provider/xt-map-provider.umd.min.js +1 -0
  106. package/lib/xt-page/demo.html +10 -0
  107. package/lib/xt-page/index.js +1 -0
  108. package/lib/xt-page/xt-page.common.js +353 -0
  109. package/lib/xt-page/xt-page.css +1 -0
  110. package/lib/xt-page/xt-page.umd.js +363 -0
  111. package/lib/xt-page/xt-page.umd.min.js +1 -0
  112. package/lib/xt-progress/demo.html +10 -0
  113. package/lib/xt-progress/index.js +1 -0
  114. package/lib/xt-progress/xt-progress.common.js +327 -0
  115. package/lib/xt-progress/xt-progress.css +1 -0
  116. package/lib/xt-progress/xt-progress.umd.js +337 -0
  117. package/lib/xt-progress/xt-progress.umd.min.js +1 -0
  118. package/lib/xt-scroll-arrow/demo.html +10 -0
  119. package/lib/xt-scroll-arrow/index.js +1 -0
  120. package/lib/xt-scroll-arrow/xt-scroll-arrow.common.js +495 -0
  121. package/lib/xt-scroll-arrow/xt-scroll-arrow.css +1 -0
  122. package/lib/xt-scroll-arrow/xt-scroll-arrow.umd.js +505 -0
  123. package/lib/xt-scroll-arrow/xt-scroll-arrow.umd.min.js +1 -0
  124. package/lib/xt-select-tree/demo.html +10 -0
  125. package/lib/xt-select-tree/index.js +1 -0
  126. package/lib/xt-select-tree/xt-select-tree.common.js +1791 -0
  127. package/lib/xt-select-tree/xt-select-tree.css +1 -0
  128. package/lib/xt-select-tree/xt-select-tree.umd.js +1801 -0
  129. package/lib/xt-select-tree/xt-select-tree.umd.min.js +1 -0
  130. package/lib/xt-step-price/demo.html +10 -0
  131. package/lib/xt-step-price/index.js +1 -0
  132. package/lib/xt-step-price/xt-step-price.common.js +800 -0
  133. package/lib/xt-step-price/xt-step-price.css +1 -0
  134. package/lib/xt-step-price/xt-step-price.umd.js +810 -0
  135. package/lib/xt-step-price/xt-step-price.umd.min.js +1 -0
  136. package/lib/xt-step-price-item/demo.html +10 -0
  137. package/lib/xt-step-price-item/index.js +1 -0
  138. package/lib/xt-step-price-item/xt-step-price-item.common.js +417 -0
  139. package/lib/xt-step-price-item/xt-step-price-item.umd.js +427 -0
  140. package/lib/xt-step-price-item/xt-step-price-item.umd.min.js +1 -0
  141. package/lib/xt-tab-pane/demo.html +10 -0
  142. package/lib/xt-tab-pane/index.js +1 -0
  143. package/lib/xt-tab-pane/xt-tab-pane.common.js +309 -0
  144. package/lib/xt-tab-pane/xt-tab-pane.umd.js +319 -0
  145. package/lib/xt-tab-pane/xt-tab-pane.umd.min.js +1 -0
  146. package/lib/xt-table/demo.html +10 -0
  147. package/lib/xt-table/index.js +1 -0
  148. package/lib/xt-table/xt-table.common.js +1027 -0
  149. package/lib/xt-table/xt-table.css +1 -0
  150. package/lib/xt-table/xt-table.umd.js +1037 -0
  151. package/lib/xt-table/xt-table.umd.min.js +1 -0
  152. package/lib/xt-tabs/demo.html +10 -0
  153. package/lib/xt-tabs/index.js +1 -0
  154. package/lib/xt-tabs/xt-tabs.common.js +463 -0
  155. package/lib/xt-tabs/xt-tabs.css +1 -0
  156. package/lib/xt-tabs/xt-tabs.umd.js +473 -0
  157. package/lib/xt-tabs/xt-tabs.umd.min.js +1 -0
  158. package/lib/xt-text/demo.html +10 -0
  159. package/lib/xt-text/index.js +1 -0
  160. package/lib/xt-text/xt-text.common.js +536 -0
  161. package/lib/xt-text/xt-text.css +1 -0
  162. package/lib/xt-text/xt-text.umd.js +546 -0
  163. package/lib/xt-text/xt-text.umd.min.js +1 -0
  164. package/lib/xt-time/demo.html +10 -0
  165. package/lib/xt-time/index.js +1 -0
  166. package/lib/xt-time/xt-time.common.js +555 -0
  167. package/lib/xt-time/xt-time.css +1 -0
  168. package/lib/xt-time/xt-time.umd.js +565 -0
  169. package/lib/xt-time/xt-time.umd.min.js +1 -0
  170. package/lib/xt-transfer-tree/demo.html +10 -0
  171. package/lib/xt-transfer-tree/index.js +1 -0
  172. package/lib/xt-transfer-tree/xt-transfer-tree.common.js +594 -0
  173. package/lib/xt-transfer-tree/xt-transfer-tree.css +1 -0
  174. package/lib/xt-transfer-tree/xt-transfer-tree.umd.js +604 -0
  175. package/lib/xt-transfer-tree/xt-transfer-tree.umd.min.js +1 -0
  176. package/lib/xt-upload/demo.html +10 -0
  177. package/lib/xt-upload/index.js +1 -0
  178. package/lib/xt-upload/xt-upload.common.js +1292 -0
  179. package/lib/xt-upload/xt-upload.css +1 -0
  180. package/lib/xt-upload/xt-upload.umd.js +1302 -0
  181. package/lib/xt-upload/xt-upload.umd.min.js +1 -0
  182. package/package.json +10 -7
  183. package/src/components/xt-badge/index.js +8 -7
  184. package/src/components/xt-button/index.js +1 -0
  185. package/src/components/xt-card/index.js +1 -0
  186. package/src/components/xt-card-item/index.js +1 -0
  187. package/src/components/xt-config-provider/index.js +1 -0
  188. package/src/components/xt-flex-box/index.js +1 -0
  189. package/src/components/xt-grid-box/index.js +1 -0
  190. package/src/components/xt-icon/index.js +1 -0
  191. package/src/components/xt-input/index.js +1 -0
  192. package/src/components/xt-map/index.js +1 -0
  193. package/src/components/xt-progress/index.js +8 -7
  194. package/src/components/xt-scroll-arrow/index.js +8 -7
  195. package/src/components/xt-step-price/index.js +1 -0
  196. package/src/components/xt-tab-pane/index.js +10 -0
  197. package/src/components/{xt-tabs/TabPane.vue → xt-tab-pane/index.vue} +14 -1
  198. package/src/components/xt-tabs/index.js +9 -10
  199. package/src/components/xt-tabs/index.vue +303 -44
  200. package/src/components/xt-text/index.js +1 -0
  201. package/src/components/xt-time/index.js +1 -0
  202. package/src/index.js +34 -2
@@ -0,0 +1 @@
1
+ (function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["xt-map"]=t():e["xt-map"]=t()})("undefined"!==typeof self?self:this,(function(){return function(e){var t={};function a(i){if(t[i])return t[i].exports;var s=t[i]={i:i,l:!1,exports:{}};return e[i].call(s.exports,s,s.exports,a),s.l=!0,s.exports}return a.m=e,a.c=t,a.d=function(e,t,i){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},a.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)a.d(i,s,function(t){return e[t]}.bind(null,s));return i},a.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s="fb15")}({c759:function(e,t,a){},fb15:function(e,t,a){"use strict";if(a.r(t),a.d(t,"XtMap",(function(){return H})),"undefined"!==typeof window){var i=window.document.currentScript,s=i&&i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);s&&(a.p=s[1])}a("c759");var n=function(){var e=this,t=e._self._c;return t("div",{staticClass:"xt-map-wrapper"},[t("div",{ref:"mapContainer",staticClass:"xt-map-container",attrs:{"data-theme":e.mergedTheme}}),e.loading?t("div",{staticClass:"xt-map-loading"},[t("span",[e._v("地图加载中...")])]):e._e(),e.errorMessage?t("div",{staticClass:"xt-map-error"},[t("span",[e._v(e._s(e.errorMessage))])]):e._e(),e._t("overlay")],2)},r=[];const o=new Map,p=new Map,h=(e,t={})=>{if("undefined"===typeof window)return Promise.reject(new Error("[XtMap] 非浏览器环境"));const{charset:a="utf-8",async:i=!0,timeout:s=3e4}=t;if(o.has(e))return o.get(e);if(p.has(e))return p.get(e);const n=new Promise((t,n)=>{const r=document.createElement("script");r.type="text/javascript",r.src=e,r.charset=a,r.async=i;let h=null,c=!1;const d=()=>{c=!0,h&&clearTimeout(h),r.onload=null,r.onerror=null};r.onload=()=>{c||(d(),p.delete(e),o.set(e,Promise.resolve(r)),t(r))},r.onerror=t=>{c||(d(),p.delete(e),n(new Error("[XtMap] 脚本加载失败: "+e)))},s>0&&(h=setTimeout(()=>{c||(d(),p.delete(e),n(new Error("[XtMap] 脚本加载超时: "+e)))},s)),document.head.appendChild(r)});return p.set(e,n),n},c=()=>{o.clear(),p.clear()},d=e=>"undefined"!==typeof window&&void 0!==window[e];const l={standard:"standard",satellite:"satellite",hybrid:"hybrid",traffic:"traffic"};class y{constructor(e,t={}){this.container=e,this.options=t,this.mapInstance=null,this.mapType=t.mapType||"standard",this.theme=t.theme||"light",this.center=t.center||[116.397428,39.90923],this.zoom=t.zoom||11,this.apiKey=t.apiKey||"",this.apiUrl=t.apiUrl||null,this.plugins=t.plugins||[],this.eventHandlers=new Map,this.ready=!1,this._mapTypeMap={...l}}getScriptUrl(){throw new Error("[XtMap] 子类必须实现 getScriptUrl()")}isSdkLoaded(){throw new Error("[XtMap] 子类必须实现 isSdkLoaded()")}beforeLoadScript(){}async createMap(){throw new Error("[XtMap] 子类必须实现 createMap()")}async init(){if(!this.container)throw new Error("[XtMap] 缺少容器元素");if(!this.isSdkLoaded()){this.beforeLoadScript();const e=this.getScriptUrl();if(!e)throw new Error("[XtMap] 缺少 API URL,请配置 apiKey 或 apiUrl");await h(e),await this._waitForSdkReady()}return await this.createMap(),this.ready=!0,this.mapInstance}async _waitForSdkReady(){return new Promise(e=>{let t=0;const a=100,i=()=>{this.isSdkLoaded()||t>=a?e():(t++,setTimeout(i,100))};i()})}getNativeMapType(e){return this._mapTypeMap[e]||this._mapTypeMap.standard}setMapType(e){this.mapType=e,this.ready&&this.mapInstance&&this._applyMapType(e)}_applyMapType(e){}setTheme(e){this.theme=e,this.ready&&this.mapInstance&&this._applyTheme(e)}_applyTheme(e){}setCenter(e){this.center=e,this.ready&&this.mapInstance&&this._applyCenter(e)}_applyCenter(e){}setZoom(e){this.zoom=e,this.ready&&this.mapInstance&&this._applyZoom(e)}_applyZoom(e){}getCenter(){return this.center}getZoom(){return this.zoom}getNativeMap(){return this.mapInstance}on(e,t){"function"===typeof t&&(this.eventHandlers.set(e,t),this.ready&&this.mapInstance&&this._bindEvent(e,t))}_bindEvent(e,t){}off(e){const t=this.eventHandlers.get(e);t&&this.ready&&this.mapInstance&&this._unbindEvent(e,t),this.eventHandlers.delete(e)}_unbindEvent(e,t){}resize(){this.ready&&this.mapInstance&&this._applyResize()}_applyResize(){}destroy(){if(this.eventHandlers.clear(),this.mapInstance&&"function"===typeof this.mapInstance.destroy)try{this.mapInstance.destroy()}catch(e){}this.mapInstance=null,this.ready=!1}}const m={standard:"amap",satellite:"satellite",hybrid:"satellite",traffic:"traffic"},u={light:"amap://styles/normal",dark:"amap://styles/dark"};class f extends y{constructor(e,t={}){super(e,t),this._mapTypeMap={...m},this._trafficLayer=null,this._satelliteLayer=null,this._roadnetLayer=null,this._currentLayers=[]}getScriptUrl(){return this.apiUrl?this.apiUrl:this.apiKey?`https://webapi.amap.com/maps?v=2.0&key=${encodeURIComponent(this.apiKey)}&plugin=AMap.Scale,AMap.ToolBar`:(console.warn("[XtMap] 高德地图需要配置 apiKey"),"")}beforeLoadScript(){const e=this.options.securityJsCode||"undefined"!==typeof window&&window._AMapSecurityConfig&&window._AMapSecurityConfig.securityJsCode||"";e&&"undefined"!==typeof window&&(window._AMapSecurityConfig={securityJsCode:e})}isSdkLoaded(){return d("AMap")&&"function"===typeof window.AMap}async createMap(){const e=window.AMap;if(!e)throw new Error("[XtMap] 高德地图 SDK 未加载");const t={center:this.center,zoom:this.zoom,mapStyle:u[this.theme]||u.light,viewMode:"2D",resizeEnable:!0};this.mapInstance=new e.Map(this.container,t),this._applyMapType(this.mapType),await new Promise(e=>{this.mapInstance.on("complete",()=>e()),setTimeout(e,1500)});for(const[a,i]of this.eventHandlers.entries())this._bindEvent(a,i)}_applyMapType(e){if(!this.mapInstance)return;const t=window.AMap;if(t){this._clearLayers();try{this.mapInstance.setMapStyle(u[this.theme]||u.light),"satellite"===e?(this._satelliteLayer=new t.TileLayer.Satellite,this.mapInstance.add(this._satelliteLayer),this._currentLayers.push(this._satelliteLayer)):"hybrid"===e?(this._satelliteLayer=new t.TileLayer.Satellite,this._roadnetLayer=new t.TileLayer.RoadNet,this.mapInstance.add([this._satelliteLayer,this._roadnetLayer]),this._currentLayers.push(this._satelliteLayer,this._roadnetLayer)):"traffic"===e&&(this._trafficLayer=new t.TileLayer.Traffic({autoRefresh:!0,interval:180}),this.mapInstance.add(this._trafficLayer),this._currentLayers.push(this._trafficLayer))}catch(a){console.warn("[XtMap] 设置地图类型失败:",a)}}}_clearLayers(){if(this.mapInstance){try{this._currentLayers.length>0&&this.mapInstance.remove(this._currentLayers)}catch(e){}this._currentLayers=[],this._trafficLayer=null,this._satelliteLayer=null,this._roadnetLayer=null}}_applyTheme(e){if(this.mapInstance)try{this.mapInstance.setMapStyle(u[e]||u.light),this._applyMapType(this.mapType)}catch(t){console.warn("[XtMap] 设置主题失败:",t)}}_applyCenter(e){if(this.mapInstance)try{this.mapInstance.setCenter(e)}catch(t){}}_applyZoom(e){if(this.mapInstance)try{this.mapInstance.setZoom(e)}catch(t){}}getCenter(){if(this.mapInstance&&this.mapInstance.getCenter){const e=this.mapInstance.getCenter();return[e.lng,e.lat]}return this.center}getZoom(){return this.mapInstance&&this.mapInstance.getZoom?this.mapInstance.getZoom():this.zoom}_bindEvent(e,t){if(this.mapInstance)try{const a={click:"click",moveend:"moveend",zoomend:"zoomend",zoomchange:"zoomchange",mapmove:"mapmove",complete:"complete",resize:"resize"},i=a[e]||e;this.mapInstance.on(i,e=>{const a={originalEvent:e,lnglat:e&&e.lnglat?[e.lnglat.lng,e.lnglat.lat]:null};t(a)})}catch(a){console.warn("[XtMap] 事件绑定失败:",e,a)}}_unbindEvent(e,t){if(this.mapInstance)try{this.mapInstance.off(e,t)}catch(a){}}_applyResize(){if(this.mapInstance&&this.mapInstance.resize)try{this.mapInstance.resize()}catch(e){}}destroy(){this._clearLayers(),super.destroy()}}const g={standard:"vec",satellite:"img",hybrid:"img",traffic:"vec"},_={light:"none",dark:"invert(1) hue-rotate(180deg) saturate(1.2) brightness(0.95)"};class w extends y{constructor(e,t={}){super(e,t),this._mapTypeMap={...g},this._layerType=t.tiandituLayerType||"vec",this._currentLayer=null,this._annotationLayer=null}getScriptUrl(){return this.apiUrl?this.apiUrl:this.apiKey?"https://api.tianditu.gov.cn/api?v=4.0&tk="+encodeURIComponent(this.apiKey):(console.warn("[XtMap] 天地图需要配置 apiKey (tk)"),"")}isSdkLoaded(){return d("T")&&"object"===typeof window.T&&window.T.Map}async createMap(){const e=window.T;if(!e||!e.Map)throw new Error("[XtMap] 天地图 SDK 未加载");const t={center:new e.LngLat(this.center[0],this.center[1]),zoom:this.zoom};this.mapInstance=new e.Map(this.container,t),this._applyMapType(this.mapType),this._applyTheme(this.theme),await new Promise(e=>{setTimeout(e,500)});for(const[a,i]of this.eventHandlers.entries())this._bindEvent(a,i)}_applyMapType(e){if(!this.mapInstance)return;const t=window.T;if(t)try{this._mapTypeMap[e];"standard"===e?this.mapInstance.setMapType(window.TMAP_NORMAL_MAP||1):"satellite"===e?this.mapInstance.setMapType(window.TMAP_SATELLITE_MAP||2):"hybrid"===e?this.mapInstance.setMapType(window.TMAP_HYBRID_MAP||3):this.mapInstance.setMapType(window.TMAP_NORMAL_MAP||1)}catch(a){console.warn("[XtMap] 天地图切换地图类型失败:",a)}}_applyTheme(e){if(!this.container)return;const t=_[e]||"none",a=this.container.querySelectorAll("img");a.forEach(e=>{e.style.filter=t,e.style.webkitFilter=t}),this.container.setAttribute("data-map-theme",e),this._setupThemeObserver(e)}_setupThemeObserver(e){if(this._themeObserver&&this._themeObserver.disconnect(),"dark"!==e)return;const t=_[e];this._themeObserver=new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{if(1===e.nodeType)if("IMG"===e.tagName)e.style.filter=t,e.style.webkitFilter=t;else if(e.querySelectorAll){const a=e.querySelectorAll("img");a.forEach(e=>{e.style.filter=t,e.style.webkitFilter=t})}})})});try{this._themeObserver.observe(this.container,{childList:!0,subtree:!0})}catch(a){}}_applyCenter(e){if(this.mapInstance&&window.T)try{this.mapInstance.centerAndZoom(new window.T.LngLat(e[0],e[1]),this.zoom)}catch(t){}}_applyZoom(e){if(this.mapInstance)try{this.mapInstance.setZoom(e)}catch(t){}}getCenter(){if(this.mapInstance&&this.mapInstance.getCenter){const e=this.mapInstance.getCenter();if(e&&void 0!==e.getLng)return[e.getLng(),e.getLat()]}return this.center}getZoom(){return this.mapInstance&&this.mapInstance.getZoom?this.mapInstance.getZoom():this.zoom}_bindEvent(e,t){if(this.mapInstance)try{const a={click:"click",moveend:"moveend",zoomend:"zoomend",zoomchange:"zoomend"},i=a[e]||e;this.mapInstance.addEventListener(i,e=>{const a={originalEvent:e,lnglat:e&&e.lnglat?[e.lnglat.getLng(),e.lnglat.getLat()]:null};t(a)})}catch(a){console.warn("[XtMap] 天地图事件绑定失败:",e,a)}}_unbindEvent(e,t){if(this.mapInstance)try{this.mapInstance.removeEventListener(e,t)}catch(a){}}_applyResize(){if(this.mapInstance&&this.mapInstance.checkResize)try{this.mapInstance.checkResize()}catch(e){}}destroy(){if(this._themeObserver&&(this._themeObserver.disconnect(),this._themeObserver=null),this.mapInstance&&"function"===typeof this.mapInstance.clearOverLays)try{this.mapInstance.clearOverLays()}catch(e){}super.destroy()}}const M={standard:"BMAP_NORMAL_MAP",satellite:"BMAP_SATELLITE_MAP",hybrid:"BMAP_HYBRID_MAP",traffic:"BMAP_NORMAL_MAP"},T={light:{style:"normal"},dark:{style:"dark"}};class v extends y{constructor(e,t={}){super(e,t),this._mapTypeMap={...M},this._coordType=t.baiduCoordType||"bd09ll",this._trafficLayer=null,this._callbackName=null}getScriptUrl(){return this.apiUrl?this.apiUrl:this.apiKey?`https://api.map.baidu.com/api?v=3.0&ak=${encodeURIComponent(this.apiKey)}&callback=${this._callbackName}`:(console.warn("[XtMap] 百度地图需要配置 apiKey (ak)"),"")}beforeLoadScript(){this._callbackName=`__xt_map_baidu_${Date.now()}_${Math.floor(1e5*Math.random())}`,"undefined"!==typeof window&&(window[this._callbackName]=()=>{})}isSdkLoaded(){return d("BMap")&&"function"===typeof window.BMap}async createMap(){const e=window.BMap;if(!e)throw new Error("[XtMap] 百度地图 SDK 未加载");const t={enableMapClick:!1};this.mapInstance=new e.Map(this.container,t),this.mapInstance.centerAndZoom(new e.Point(this.center[0],this.center[1]),this.zoom),this.mapInstance.enableScrollWheelZoom(!0),this._applyMapType(this.mapType),this._applyTheme(this.theme),await new Promise(e=>setTimeout(e,500));for(const[a,i]of this.eventHandlers.entries())this._bindEvent(a,i)}_applyMapType(e){if(this.mapInstance&&window.BMap)try{if(this._trafficLayer){try{this.mapInstance.removeTileLayer(this._trafficLayer)}catch(t){}this._trafficLayer=null}if("satellite"===e)this.mapInstance.setMapType(window.BMAP_SATELLITE_MAP||1);else if("hybrid"===e)this.mapInstance.setMapType(window.BMAP_HYBRID_MAP||2);else if("traffic"===e){this.mapInstance.setMapType(window.BMAP_NORMAL_MAP||0);try{const e=window.BMap;this._trafficLayer=new e.TrafficLayer,this.mapInstance.addTileLayer(this._trafficLayer)}catch(t){console.warn("[XtMap] 百度地图加载路况图层失败:",t)}}else this.mapInstance.setMapType(window.BMAP_NORMAL_MAP||0)}catch(t){console.warn("[XtMap] 百度地图切换地图类型失败:",t)}}_applyTheme(e){if(this.mapInstance&&window.BMap)try{const t=T[e]||T.light;if(this.mapInstance.setMapStyleV2)this.mapInstance.setMapStyleV2({styleId:"dark"===t.style?"midnight":""});else if(this.mapInstance.setMapStyle){const t="dark"===e?this._getDarkStyleJson():null;t&&this.mapInstance.setMapStyle({styleJson:t})}}catch(t){console.warn("[XtMap] 百度地图设置主题失败:",t)}}_getDarkStyleJson(){return[{featureType:"land",elementType:"geometry",stylers:{color:"#1a1a1a"}},{featureType:"water",elementType:"geometry",stylers:{color:"#0a1a2a"}},{featureType:"green",elementType:"geometry",stylers:{color:"#0a2a1a"}},{featureType:"building",elementType:"geometry",stylers:{color:"#2a2a2a"}},{featureType:"highway",elementType:"geometry",stylers:{color:"#3a3a3a"}},{featureType:"highway",elementType:"geometry.stroke",stylers:{color:"#4a4a4a"}},{featureType:"arterial",elementType:"geometry",stylers:{color:"#333333"}},{featureType:"arterial",elementType:"geometry.stroke",stylers:{color:"#3d3d3d"}},{featureType:"local",elementType:"geometry",stylers:{color:"#2a2a2a"}},{featureType:"railway",elementType:"geometry",stylers:{color:"#3a3a3a"}},{featureType:"subway",elementType:"geometry",stylers:{color:"#3a3a3a"}},{featureType:"boundary",elementType:"geometry",stylers:{color:"#666666"}},{featureType:"district",elementType:"labels.text.fill",stylers:{color:"#888888"}},{featureType:"poi",elementType:"labels",stylers:{visibility:"off"}}]}_applyCenter(e){if(this.mapInstance&&window.BMap)try{this.mapInstance.centerAndZoom(new window.BMap.Point(e[0],e[1]),this.zoom)}catch(t){}}_applyZoom(e){if(this.mapInstance)try{this.mapInstance.setZoom(e)}catch(t){}}getCenter(){if(this.mapInstance&&this.mapInstance.getCenter){const e=this.mapInstance.getCenter();if(e)return[e.lng,e.lat]}return this.center}getZoom(){return this.mapInstance&&this.mapInstance.getZoom?this.mapInstance.getZoom():this.zoom}_bindEvent(e,t){if(this.mapInstance)try{const a={click:"click",moveend:"moveend",zoomend:"zoomend",zoomchange:"zoomend",mapmove:"movestart"},i=a[e]||e;this.mapInstance.addEventListener(i,e=>{const a={originalEvent:e,lnglat:e&&e.point?[e.point.lng,e.point.lat]:null};t(a)})}catch(a){console.warn("[XtMap] 百度地图事件绑定失败:",e,a)}}_unbindEvent(e,t){if(this.mapInstance)try{this.mapInstance.removeEventListener(e,t)}catch(a){}}_applyResize(){if(this.mapInstance&&this.mapInstance.enableResize)try{"function"===typeof this.mapInstance.checkResize&&this.mapInstance.checkResize()}catch(e){}}destroy(){if(this._callbackName&&"undefined"!==typeof window)try{delete window[this._callbackName]}catch(e){}super.destroy()}}const b={amap:f,tianditu:w,baidu:v},I=e=>b[e]||f;const L=["amap","tianditu","baidu"],C=["standard","satellite","hybrid","traffic"],S=["light","dark"],z={provider:"amap",apiKey:"",apiUrl:null,mapType:"standard",theme:"light",center:[116.397428,39.90923],zoom:11,plugins:[],securityJsCode:null,tiandituLayerType:"vec",baiduCoordType:"bd09ll"};let A={...z};const k=[],E=(e,t)=>{k.forEach(a=>{try{a(e,t)}catch(i){console.warn("[XtMap] 配置变更监听异常:",i)}})},P=()=>({...A}),x=e=>{A.securityJsCode=e,"undefined"!==typeof window&&e&&(window._AMapSecurityConfig={securityJsCode:e,...window._AMapSecurityConfig||{}}),E("securityJsCode",e)},R=()=>A.provider,Z=()=>A.apiKey,U=()=>A.apiUrl,O=()=>A.mapType,X=()=>A.theme,$=()=>A.center,K=()=>A.zoom,N=e=>{if("function"===typeof e)return k.push(e),()=>{const t=k.indexOf(e);t>-1&&k.splice(t,1)}};var J={name:"XtMap",props:{provider:{type:String,default:"",validator:e=>""===e||L.includes(e)},apiKey:{type:String,default:""},apiUrl:{type:String,default:""},mapType:{type:String,default:"",validator:e=>""===e||C.includes(e)},theme:{type:String,default:"",validator:e=>""===e||S.includes(e)},center:{type:Array,default:()=>null},zoom:{type:Number,default:null},plugins:{type:Array,default:()=>[]},width:{type:String,default:"100%"},height:{type:String,default:"400px"},securityJsCode:{type:String,default:""},tiandituLayerType:{type:String,default:"vec"},baiduCoordType:{type:String,default:"bd09ll"}},data(){return{loading:!0,errorMessage:"",adapter:null,_unsubscribeConfig:null}},computed:{mergedProvider(){return this.provider||R()||"amap"},mergedApiKey(){return this.apiKey||Z()||""},mergedApiUrl(){return this.apiUrl||U()||""},mergedMapType(){return this.mapType||O()||"standard"},mergedTheme(){return this.theme||X()||"light"},mergedCenter(){return this.center||$()||[116.397428,39.90923]},mergedZoom(){return null!==this.zoom?this.zoom:K()},mergedSecurityJsCode(){return this.securityJsCode||P().securityJsCode||""},mergedPlugins(){return this.plugins.length>0?this.plugins:P().plugins||[]}},watch:{mergedProvider:{handler(){this.$nextTick(()=>this.rebuildMap())}},mergedApiKey:{handler(){this.$nextTick(()=>this.rebuildMap())}},mergedMapType:{handler(e){this.adapter&&this.adapter.setMapType(e)}},mergedTheme:{handler(e){this.adapter&&this.adapter.setTheme(e),this.$refs.mapContainer&&this.$refs.mapContainer.setAttribute("data-theme",e)}},mergedCenter:{handler(e){this.adapter&&this.adapter.setCenter(e)}},mergedZoom:{handler(e){this.adapter&&this.adapter.setZoom(e)}},width:{handler(){this.$nextTick(()=>{this.adapter&&this.adapter.resize()})}},height:{handler(){this.$nextTick(()=>{this.adapter&&this.adapter.resize()})}},securityJsCode:{handler(e){e&&(x(e),"amap"===this.mergedProvider&&this.adapter&&this.adapter.ready&&this.$nextTick(()=>this.rebuildMap()))}}},mounted(){this._unsubscribeConfig=N((e,t)=>{this.provider||"provider"!==e||this.$nextTick(()=>this.rebuildMap()),this.apiKey||"apiKey"!==e||this.$nextTick(()=>this.rebuildMap()),this.apiUrl||"apiUrl"!==e||this.$nextTick(()=>this.rebuildMap()),!this.theme&&"theme"===e&&this.adapter&&this.adapter.setTheme(t),!this.mapType&&"mapType"===e&&this.adapter&&this.adapter.setMapType(t),!this.center&&"center"===e&&this.adapter&&this.adapter.setCenter(t),null===this.zoom&&"zoom"===e&&this.adapter&&this.adapter.setZoom(t)}),this.securityJsCode&&x(this.securityJsCode),this.$nextTick(()=>this.initMap()),this._onWindowResize=()=>{this.adapter&&this.adapter.resize()},"undefined"!==typeof window&&window.addEventListener("resize",this._onWindowResize)},beforeDestroy(){this.destroyMap(),this._unsubscribeConfig&&this._unsubscribeConfig(),this._onWindowResize&&"undefined"!==typeof window&&window.removeEventListener("resize",this._onWindowResize)},methods:{async initMap(){const e=this.$refs.mapContainer;if(!e)return;e.style.width=this.width,e.style.height=this.height,this.securityJsCode&&x(this.securityJsCode),this.loading=!0,this.errorMessage="";const t=I(this.mergedProvider);this.adapter=new t(e,{apiKey:this.mergedApiKey,apiUrl:this.mergedApiUrl,mapType:this.mergedMapType,theme:this.mergedTheme,center:this.mergedCenter,zoom:this.mergedZoom,plugins:this.mergedPlugins,securityJsCode:this.mergedSecurityJsCode,tiandituLayerType:this.tiandituLayerType,baiduCoordType:this.baiduCoordType});try{await this.adapter.init(),this.loading=!1,this._bindAdapterEvents(),this.$emit("ready",{provider:this.mergedProvider,map:this.adapter.getNativeMap(),adapter:this.adapter})}catch(a){this.loading=!1,this.errorMessage=a.message||"地图初始化失败",this.$emit("error",a)}},rebuildMap(){this.destroyMap(),"function"===typeof c&&c(),this.$nextTick(()=>this.initMap())},destroyMap(){this.adapter&&(this.adapter.destroy(),this.adapter=null)},_bindAdapterEvents(){if(!this.adapter)return;const e=["click","moveend","zoomend","zoomchange","mapmove"];e.forEach(e=>{this.adapter.on(e,t=>{this.$emit(e,t)})})},setCenter(e){this.adapter&&this.adapter.setCenter(e)},setZoom(e){this.adapter&&this.adapter.setZoom(e)},setMapType(e){this.adapter&&this.adapter.setMapType(e)},setTheme(e){this.adapter&&this.adapter.setTheme(e)},getCenter(){return this.adapter?this.adapter.getCenter():this.mergedCenter},getZoom(){return this.adapter?this.adapter.getZoom():this.mergedZoom},getNativeMap(){return this.adapter?this.adapter.getNativeMap():null},resize(){this.adapter&&this.adapter.resize()},on(e,t){this.adapter&&this.adapter.on(e,t)},off(e){this.adapter&&this.adapter.off(e)},rebuild(){this.rebuildMap()}}},B=J;function j(e,t,a,i,s,n,r,o){var p,h="function"===typeof e?e.options:e;if(t&&(h.render=t,h.staticRenderFns=a,h._compiled=!0),i&&(h.functional=!0),n&&(h._scopeId="data-v-"+n),r?(p=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),s&&s.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(r)},h._ssrRegister=p):s&&(p=o?function(){s.call(this,(h.functional?this.parent:this).$root.$options.shadowRoot)}:s),p)if(h.functional){h._injectStyles=p;var c=h.render;h.render=function(e,t){return p.call(t),c(e,t)}}else{var d=h.beforeCreate;h.beforeCreate=d?[].concat(d,p):[p]}return{exports:e,options:h}}var D=j(B,n,r,!1,null,null,null),H=D.exports;H.install=function(e){e.component(H.name,H)};var F=H;t["default"]=F}})}));
@@ -0,0 +1,10 @@
1
+ <meta charset="utf-8">
2
+ <title>xt-map-provider demo</title>
3
+ <script src="./xt-map-provider.umd.js"></script>
4
+
5
+ <link rel="stylesheet" href="./xt-map-provider.css">
6
+
7
+
8
+ <script>
9
+ console.log(xt-map-provider)
10
+ </script>
@@ -0,0 +1 @@
1
+ module.exports = require('./xt-map-provider.common.js');