@qxs-bns/components 0.0.68 → 0.0.70

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 (172) hide show
  1. package/es/package.json.mjs +1 -1
  2. package/es/src/data-chart/src/components/area.vue2.mjs +1 -1
  3. package/es/src/data-chart/src/components/area.vue2.mjs.map +1 -1
  4. package/es/src/data-chart/src/components/bar.vue2.mjs.map +1 -1
  5. package/es/src/data-chart/src/components/card.vue2.mjs +1 -1
  6. package/es/src/data-chart/src/components/card.vue2.mjs.map +1 -1
  7. package/es/src/data-chart/src/components/funnel.vue2.mjs.map +1 -1
  8. package/es/src/data-chart/src/components/line.vue2.mjs.map +1 -1
  9. package/es/src/data-chart/src/components/pie.vue2.mjs.map +1 -1
  10. package/es/src/data-chart/src/components/radar.vue2.mjs.map +1 -1
  11. package/es/src/data-chart/src/components/scatter-simple.vue2.mjs.map +1 -1
  12. package/es/src/data-chart/src/components/scatter.vue2.mjs.map +1 -1
  13. package/es/src/data-chart/src/components/table.vue.mjs +1 -1
  14. package/es/src/data-chart/src/components/table.vue.mjs.map +1 -1
  15. package/es/src/data-chart/src/data-chart.vue.mjs +1 -1
  16. package/es/src/data-chart/src/data-chart.vue.mjs.map +1 -1
  17. package/es/src/data-chart/src/utils/config.mjs +1 -1
  18. package/es/src/data-chart/src/utils/config.mjs.map +1 -1
  19. package/es/src/data-chart/src/utils/mapData.mjs.map +1 -1
  20. package/es/src/data-chart/src/utils/useCharts.mjs +1 -1
  21. package/es/src/data-chart/src/utils/useCharts.mjs.map +1 -1
  22. package/es/src/file-upload/src/file-upload.vue.mjs +1 -1
  23. package/es/src/file-upload/src/file-upload.vue.mjs.map +1 -1
  24. package/es/src/fixed-action-bar/src/fixed-action-bar.vue.mjs +1 -1
  25. package/es/src/fixed-action-bar/src/fixed-action-bar.vue.mjs.map +1 -1
  26. package/es/src/icon/index.mjs +1 -1
  27. package/es/src/icon/index.mjs.map +1 -1
  28. package/es/src/icon/src/icon.vue.mjs +1 -1
  29. package/es/src/icon/src/icon.vue.mjs.map +1 -1
  30. package/es/src/image-upload/src/image-upload.vue.mjs +1 -1
  31. package/es/src/image-upload/src/image-upload.vue.mjs.map +1 -1
  32. package/es/src/photo-crop-tool/src/composables.mjs.map +1 -1
  33. package/es/src/photo-crop-tool/src/photo-crop-tool.vue.mjs +1 -1
  34. package/es/src/photo-crop-tool/src/photo-crop-tool.vue.mjs.map +1 -1
  35. package/es/src/subject-action/src/subject-action.vue.mjs +1 -1
  36. package/es/src/subject-action/src/subject-action.vue.mjs.map +1 -1
  37. package/es/src/subject-list/src/components/SubjectPageEnd.vue.mjs +1 -1
  38. package/es/src/subject-list/src/components/SubjectPageEnd.vue.mjs.map +1 -1
  39. package/es/src/subject-list/src/components/SubjectRichText.vue.mjs +1 -1
  40. package/es/src/subject-list/src/components/SubjectRichText.vue.mjs.map +1 -1
  41. package/es/src/subject-list/src/components/subject-blank-fill.vue.mjs +1 -1
  42. package/es/src/subject-list/src/components/subject-blank-fill.vue.mjs.map +1 -1
  43. package/es/src/subject-list/src/components/subject-scale.vue.mjs +1 -1
  44. package/es/src/subject-list/src/components/subject-scale.vue.mjs.map +1 -1
  45. package/es/src/subject-list/src/components/subject-single.vue.mjs +1 -1
  46. package/es/src/subject-list/src/components/subject-single.vue.mjs.map +1 -1
  47. package/es/src/subject-list/src/components/subject-text-fill.vue.mjs +1 -1
  48. package/es/src/subject-list/src/components/subject-text-fill.vue.mjs.map +1 -1
  49. package/es/src/subject-list/src/subject-list.vue.mjs +1 -1
  50. package/es/src/subject-list/src/subject-list.vue.mjs.map +1 -1
  51. package/es/src/subject-type/src/subject-type.vue.mjs +1 -1
  52. package/es/src/subject-type/src/subject-type.vue.mjs.map +1 -1
  53. package/es/src/tiny-mce-editor/src/tiny-mce-editor.vue.mjs +1 -1
  54. package/es/src/tiny-mce-editor/src/tiny-mce-editor.vue.mjs.map +1 -1
  55. package/lib/package.json.cjs +1 -1
  56. package/lib/src/data-chart/src/components/area.vue2.cjs +1 -1
  57. package/lib/src/data-chart/src/components/area.vue2.cjs.map +1 -1
  58. package/lib/src/data-chart/src/components/bar.vue2.cjs.map +1 -1
  59. package/lib/src/data-chart/src/components/card.vue2.cjs +1 -1
  60. package/lib/src/data-chart/src/components/card.vue2.cjs.map +1 -1
  61. package/lib/src/data-chart/src/components/funnel.vue2.cjs.map +1 -1
  62. package/lib/src/data-chart/src/components/line.vue2.cjs.map +1 -1
  63. package/lib/src/data-chart/src/components/pie.vue2.cjs.map +1 -1
  64. package/lib/src/data-chart/src/components/radar.vue2.cjs.map +1 -1
  65. package/lib/src/data-chart/src/components/scatter-simple.vue2.cjs.map +1 -1
  66. package/lib/src/data-chart/src/components/scatter.vue2.cjs.map +1 -1
  67. package/lib/src/data-chart/src/components/table.vue.cjs +1 -1
  68. package/lib/src/data-chart/src/components/table.vue.cjs.map +1 -1
  69. package/lib/src/data-chart/src/data-chart.vue.cjs +1 -1
  70. package/lib/src/data-chart/src/data-chart.vue.cjs.map +1 -1
  71. package/lib/src/data-chart/src/utils/config.cjs +1 -1
  72. package/lib/src/data-chart/src/utils/config.cjs.map +1 -1
  73. package/lib/src/data-chart/src/utils/mapData.cjs.map +1 -1
  74. package/lib/src/data-chart/src/utils/useCharts.cjs +1 -1
  75. package/lib/src/data-chart/src/utils/useCharts.cjs.map +1 -1
  76. package/lib/src/file-upload/src/file-upload.vue.cjs +1 -1
  77. package/lib/src/file-upload/src/file-upload.vue.cjs.map +1 -1
  78. package/lib/src/fixed-action-bar/src/fixed-action-bar.vue.cjs +1 -1
  79. package/lib/src/fixed-action-bar/src/fixed-action-bar.vue.cjs.map +1 -1
  80. package/lib/src/icon/index.cjs +1 -1
  81. package/lib/src/icon/index.cjs.map +1 -1
  82. package/lib/src/icon/src/icon.vue.cjs +1 -1
  83. package/lib/src/icon/src/icon.vue.cjs.map +1 -1
  84. package/lib/src/image-upload/src/image-upload.vue.cjs +1 -1
  85. package/lib/src/image-upload/src/image-upload.vue.cjs.map +1 -1
  86. package/lib/src/photo-crop-tool/src/composables.cjs.map +1 -1
  87. package/lib/src/photo-crop-tool/src/photo-crop-tool.vue.cjs +1 -1
  88. package/lib/src/photo-crop-tool/src/photo-crop-tool.vue.cjs.map +1 -1
  89. package/lib/src/subject-action/src/subject-action.vue.cjs +1 -1
  90. package/lib/src/subject-action/src/subject-action.vue.cjs.map +1 -1
  91. package/lib/src/subject-list/src/components/SubjectPageEnd.vue.cjs +1 -1
  92. package/lib/src/subject-list/src/components/SubjectPageEnd.vue.cjs.map +1 -1
  93. package/lib/src/subject-list/src/components/SubjectRichText.vue.cjs +1 -1
  94. package/lib/src/subject-list/src/components/SubjectRichText.vue.cjs.map +1 -1
  95. package/lib/src/subject-list/src/components/subject-blank-fill.vue.cjs +1 -1
  96. package/lib/src/subject-list/src/components/subject-blank-fill.vue.cjs.map +1 -1
  97. package/lib/src/subject-list/src/components/subject-scale.vue.cjs +1 -1
  98. package/lib/src/subject-list/src/components/subject-scale.vue.cjs.map +1 -1
  99. package/lib/src/subject-list/src/components/subject-single.vue.cjs +1 -1
  100. package/lib/src/subject-list/src/components/subject-single.vue.cjs.map +1 -1
  101. package/lib/src/subject-list/src/components/subject-text-fill.vue.cjs +1 -1
  102. package/lib/src/subject-list/src/components/subject-text-fill.vue.cjs.map +1 -1
  103. package/lib/src/subject-list/src/subject-list.vue.cjs +1 -1
  104. package/lib/src/subject-list/src/subject-list.vue.cjs.map +1 -1
  105. package/lib/src/subject-type/src/subject-type.vue.cjs +1 -1
  106. package/lib/src/subject-type/src/subject-type.vue.cjs.map +1 -1
  107. package/lib/src/tiny-mce-editor/src/tiny-mce-editor.vue.cjs +1 -1
  108. package/lib/src/tiny-mce-editor/src/tiny-mce-editor.vue.cjs.map +1 -1
  109. package/package.json +8 -15
  110. package/theme-chalk/index.css +1 -1
  111. package/theme-chalk/index.scss +1 -1
  112. package/theme-chalk/src/common/element-plus.scss +1 -1
  113. package/theme-chalk/src/data-chart/empty.css +1 -1
  114. package/theme-chalk/src/data-chart/empty.scss +3 -3
  115. package/theme-chalk/src/data-chart/index.css +1 -1
  116. package/theme-chalk/src/icon.css +1 -1
  117. package/theme-chalk/src/icon.scss +5 -5
  118. package/theme-chalk/src/image-upload.css +1 -1
  119. package/theme-chalk/src/image-upload.scss +21 -18
  120. package/theme-chalk/src/mixins/config.scss +1 -3
  121. package/theme-chalk/src/mixins/mixins.scss +1 -2
  122. package/theme-chalk/src/normalize.css +1 -1
  123. package/theme-chalk/src/normalize.scss +41 -19
  124. package/theme-chalk/src/photo-crop-tool.css +1 -1
  125. package/theme-chalk/src/photo-crop-tool.scss +7 -7
  126. package/theme-chalk/src/subject-action.css +1 -1
  127. package/theme-chalk/src/subject-action.scss +1 -1
  128. package/types/src/data-chart/index.d.ts +1 -1
  129. package/types/src/data-chart/src/components/area.vue.d.ts.map +1 -1
  130. package/types/src/data-chart/src/components/bar.vue.d.ts.map +1 -1
  131. package/types/src/data-chart/src/components/card.vue.d.ts +2 -2
  132. package/types/src/data-chart/src/components/funnel.vue.d.ts.map +1 -1
  133. package/types/src/data-chart/src/components/line.vue.d.ts.map +1 -1
  134. package/types/src/data-chart/src/components/pie.vue.d.ts.map +1 -1
  135. package/types/src/data-chart/src/components/radar.vue.d.ts.map +1 -1
  136. package/types/src/data-chart/src/components/scatter-simple.vue.d.ts.map +1 -1
  137. package/types/src/data-chart/src/components/scatter.vue.d.ts.map +1 -1
  138. package/types/src/data-chart/src/components/table.vue.d.ts +2 -2
  139. package/types/src/data-chart/src/components/table.vue.d.ts.map +1 -1
  140. package/types/src/data-chart/src/data-chart.vue.d.ts +2 -2
  141. package/types/src/data-chart/src/data-chart.vue.d.ts.map +1 -1
  142. package/types/src/data-chart/src/utils/config.d.ts.map +1 -1
  143. package/types/src/data-chart/src/utils/mapData.d.ts.map +1 -1
  144. package/types/src/data-chart/src/utils/useCharts.d.ts.map +1 -1
  145. package/types/src/file-upload/src/file-upload.vue.d.ts.map +1 -1
  146. package/types/src/fixed-action-bar/index.d.ts +3 -3
  147. package/types/src/fixed-action-bar/src/fixed-action-bar.vue.d.ts +2 -2
  148. package/types/src/fixed-action-bar/src/fixed-action-bar.vue.d.ts.map +1 -1
  149. package/types/src/icon/index.d.ts +2 -2
  150. package/types/src/icon/index.d.ts.map +1 -1
  151. package/types/src/icon/src/icon.vue.d.ts.map +1 -1
  152. package/types/src/image-upload/src/image-upload.vue.d.ts.map +1 -1
  153. package/types/src/photo-crop-tool/index.d.ts +4 -4
  154. package/types/src/photo-crop-tool/src/composables.d.ts.map +1 -1
  155. package/types/src/photo-crop-tool/src/photo-crop-tool.vue.d.ts +2 -2
  156. package/types/src/photo-crop-tool/src/photo-crop-tool.vue.d.ts.map +1 -1
  157. package/types/src/subject-action/index.d.ts +2 -2
  158. package/types/src/subject-action/src/subject-action.vue.d.ts +2 -2
  159. package/types/src/subject-action/src/subject-action.vue.d.ts.map +1 -1
  160. package/types/src/subject-list/index.d.ts +1 -1
  161. package/types/src/subject-list/src/components/SubjectPageEnd.vue.d.ts.map +1 -1
  162. package/types/src/subject-list/src/components/SubjectRichText.vue.d.ts.map +1 -1
  163. package/types/src/subject-list/src/components/subject-blank-fill.vue.d.ts.map +1 -1
  164. package/types/src/subject-list/src/components/subject-scale.vue.d.ts.map +1 -1
  165. package/types/src/subject-list/src/components/subject-single.vue.d.ts.map +1 -1
  166. package/types/src/subject-list/src/components/subject-text-fill.vue.d.ts.map +1 -1
  167. package/types/src/subject-list/src/subject-list.vue.d.ts +1 -1
  168. package/types/src/subject-list/src/subject-list.vue.d.ts.map +1 -1
  169. package/types/src/subject-type/src/subject-type.vue.d.ts.map +1 -1
  170. package/types/src/tiny-mce-editor/index.d.ts.map +1 -1
  171. package/types/src/tiny-mce-editor/src/tiny-mce-editor.vue.d.ts.map +1 -1
  172. package/types/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"card.vue2.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/card.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { EChartData, IFormatPublicData } from '../utils/types'\nimport bgLeft from './data-chart-card-bg-left.svg'\nimport bgRight from './data-chart-card-bg-right.svg'\nimport Empty from './empty.vue'\n\ndefineOptions({\n name: 'DataChartCard',\n})\n\nconst props = defineProps({\n chartData: {\n type: Object as PropType<IFormatPublicData>,\n default: () => ({\n colDesc: [],\n xGroupByDesc: [],\n data: [],\n modelName: '',\n }),\n },\n})\n\n// 将 SVG 文件转换为 URL\nconst bgLeftUrl = `url(${bgLeft})`\nconst bgRightUrl = `url(${bgRight})`\n\nfunction cardTitle(dataItem: EChartData['data'][0]) {\n const colDesc = props.chartData.xGroupByDesc?.colDesc || ''\n\n return colDesc ? (colDesc + dataItem[colDesc]) : ''\n}\n</script>\n\n<template>\n <div class=\"data-chart-card\">\n <p class=\"title\">\n {{ chartData.modelName }}\n </p>\n <template v-if=\"chartData.data.length\">\n <el-scrollbar v-if=\"chartData.groupByDesc.length\">\n <div :class=\"{ 'data-chart-card-grid-layout': chartData.groupByDesc.length }\">\n <div\n v-for=\"(dataItem, dataIndex) in chartData.data\"\n :key=\"dataIndex\"\n class=\"card-item\"\n :style=\"{\n 'background-image': `${bgLeftUrl}, ${bgRightUrl}`,\n }\"\n >\n <div\n class=\"card-title\"\n :title=\"cardTitle(dataItem)\"\n >\n {{ cardTitle(dataItem) }}\n </div>\n <div class=\"context\">\n <span\n v-for=\"(item, index) in chartData.colDesc\"\n :key=\"item\"\n >\n {{ `${item}: ` || '-' }}<strong>{{ dataItem[item] || '-' }}</strong> {{ index === chartData.colDesc.length\n - 1 ? '' : ',' }}\n </span>\n </div>\n <div class=\"suffix-icon\">\n {{ dataIndex + 1 }}\n </div>\n </div>\n </div>\n </el-scrollbar>\n <div\n v-else\n class=\"data-chart-card-wrap\"\n >\n <div\n v-for=\"(dataItem, dataIndex) in chartData.data\"\n :key=\"dataIndex\"\n class=\"card-item\"\n :style=\"{\n 'background-image': `${bgLeftUrl}, ${bgRightUrl}`,\n }\"\n >\n <div\n class=\"card-title\"\n :title=\"chartData.modelName\"\n >\n {{ chartData.modelName }}\n </div>\n <div class=\"context\">\n <span\n v-for=\"(item, index) in chartData.colDesc\"\n :key=\"item\"\n >\n <template v-if=\"dataItem\">\n {{ `${item}: ` || '-' }}<strong>{{ dataItem[item] || '-' }}</strong> {{ index === chartData.colDesc.length\n - 1 ? '' : ',' }}\n </template>\n </span>\n </div>\n </div>\n </div>\n </template>\n <Empty v-else />\n </div>\n</template>\n\n<style scoped lang=\"scss\">\n.data-chart-card {\n display: flex;\n flex-direction: column;\n\n .title {\n margin: 0;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0 5.5px;\n line-height: 26px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n color: #464646;\n }\n\n .data-chart-card-grid-layout {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));\n gap: 10px;\n width: calc(100% - 3px);\n }\n\n .data-chart-card-wrap {\n height: 100% !important;\n\n .card-item {\n width: 100% !important;\n }\n }\n\n .card-item {\n position: relative;\n background-repeat: no-repeat;\n background-position: left top, right top;\n background-size: contain, contain;\n border: 2px solid #2196f3;\n border-radius: 6px;\n\n .suffix-icon {\n position: absolute;\n right: 1px;\n bottom: calc(25% - 14px);\n width: 20px;\n font-size: 20px;\n font-weight: bold;\n color: #fff;\n text-align: center;\n }\n\n .card-title {\n padding-left: 15px;\n margin-top: 10px;\n margin-bottom: 5px;\n overflow: hidden;\n font-size: 16px;\n font-weight: bold;\n color: #2196f3;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .context {\n padding: 0 30px 10px 20px;\n font-size: 14px;\n color: #464646;\n }\n }\n}\n</style>\n"],"names":["props","__props","bgLeftUrl","bgLeft","bgRightUrl","bgRight","cardTitle","dataItem","colDesc","chartData","xGroupByDesc","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_toDisplayString","modelName","data","length","_Fragment","key","groupByDesc","_createBlock","_component_el_scrollbar","class","_normalizeClass","dataIndex","style","_normalizeStyle","title","_hoisted_3","_hoisted_4","item","index","_createTextVNode","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","Empty"],"mappings":"isBAWA,MAAMA,EAAQC,EAaRC,EAAY,OAAOC,EAAAA,WACnBC,EAAa,OAAOC,EAAAA,WAE1B,SAASC,EAAUC,GACjB,MAAMC,EAAUR,EAAMS,UAAUC,cAAcF,SAAW,GAEzD,OAAOA,EAAWA,EAAUD,EAASC,GAAY,EACnD,qCAIE,OAAAG,cAAAC,qBAqEM,MArENC,EAqEM,CApEJC,EAAAA,mBAEI,IAFJC,EAEIC,kBADCf,EAAAQ,UAAUQ,WAAS,GAERhB,EAAAQ,UAAUS,KAAKC,sBAA/BP,EAAAA,mBA+DWQ,EAAAA,SAAA,CAAAC,IAAA,GAAA,CA9DWpB,EAAAQ,UAAUa,YAAYH,sBAA1CI,EAAAA,YA8BeC,EAAA,CAAAH,IAAA,GAAA,mBA7Bb,IA4BM,CA5BNP,EAAAA,mBA4BM,MAAA,CA5BAW,MAAKC,EAAAA,eAAA,CAAA,8BAAmCzB,EAAAQ,UAAUa,YAAYH,YAClER,EAAAA,WAAA,GAAAC,EAAAA,mBA0BMQ,EAAAA,2BAzB4BnB,EAAAQ,UAAUS,KAAI,CAAtCX,EAAUoB,mBADpBf,EAAAA,mBA0BM,MAAA,CAxBHS,IAAKM,EACNF,MAAM,YACLG,MAAKC,EAAAA,eAAA,CAAyC,mBAAA,GAAA3B,MAAcE,QAI7DU,EAAAA,mBAKM,MAAA,CAJJW,MAAM,aACLK,MAAOxB,EAAUC,IAEfS,EAAAA,gBAAAV,EAAUC,IAAQ,EAAAwB,GAEvBjB,EAAAA,mBAQM,MARNkB,EAQM,EAPJrB,EAAAA,WAAA,GAAAC,EAAAA,mBAMOQ,EAAAA,2BALmBnB,EAAAQ,UAAUD,QAAO,CAAjCyB,EAAMC,mBADhBtB,EAAAA,mBAMO,OAAA,CAJJS,IAAKY,GAAI,wCAEJA,OAAI,KAAA,GAAcnB,EAAAA,mBAA4C,SAAA,KAAAE,EAAAA,gBAAjCT,EAAS0B,IAAI,KAAA,GAAoBE,EAAAA,gBAAA,sBAAID,IAAUjC,YAAUO,QAAQW,gCAIxGL,EAAAA,mBAEM,MAFNsB,EAEMpB,EAAAA,gBADDW,EAAS,GAAA,6BAKpBhB,EAAAA,YAAAC,qBA8BM,MA9BNyB,EA8BM,EA1BJ1B,EAAAA,WAAA,GAAAC,EAAAA,mBAyBMQ,EAAAA,2BAxB4BnB,EAAAQ,UAAUS,KAAI,CAAtCX,EAAUoB,mBADpBf,EAAAA,mBAyBM,MAAA,CAvBHS,IAAKM,EACNF,MAAM,YACLG,MAAKC,EAAAA,eAAA,CAAuC,mBAAA,GAAA3B,MAAcE,QAI3DU,EAAAA,mBAKM,MAAA,CAJJW,MAAM,aACLK,MAAO7B,EAAAQ,UAAUQ,WAEfD,EAAAA,gBAAAf,EAAAQ,UAAUQ,WAAS,EAAAqB,GAExBxB,EAAAA,mBAUM,MAVNyB,EAUM,EATJ5B,EAAAA,WAAA,GAAAC,EAAAA,mBAQOQ,EAAAA,2BAPmBnB,EAAAQ,UAAUD,QAAO,CAAjCyB,EAAMC,mBADhBtB,EAAAA,mBAQO,OAAA,CANJS,IAAKY,GAAI,CAEM1B,iBAAhBK,EAAAA,mBAGWQ,EAAAA,SAAA,CAAAC,IAAA,GAAA,wCAFHY,OAAI,KAAA,GAAcnB,EAAAA,mBAA4C,SAAA,KAAAE,EAAAA,gBAAjCT,EAAS0B,IAAI,KAAA,GAAoBE,EAAAA,gBAAA,sBAAID,IAAUjC,YAAUO,QAAQW,0GAQhHI,EAAAA,YAAgBiB,EAAAA,QAAA,CAAAnB,IAAA"}
1
+ {"version":3,"file":"card.vue2.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/card.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { EChartData, IFormatPublicData } from '../utils/types'\nimport bgLeft from './data-chart-card-bg-left.svg'\nimport bgRight from './data-chart-card-bg-right.svg'\nimport Empty from './empty.vue'\n\ndefineOptions({\n name: 'DataChartCard',\n})\n\nconst props = defineProps({\n chartData: {\n type: Object as PropType<IFormatPublicData>,\n default: () => ({\n colDesc: [],\n xGroupByDesc: [],\n data: [],\n modelName: '',\n }),\n },\n})\n\n// 将 SVG 文件转换为 URL\nconst bgLeftUrl = `url(${bgLeft})`\nconst bgRightUrl = `url(${bgRight})`\n\nfunction cardTitle(dataItem: EChartData['data'][0]) {\n const colDesc = props.chartData.xGroupByDesc?.colDesc || ''\n\n return colDesc ? (colDesc + dataItem[colDesc]) : ''\n}\n</script>\n\n<template>\n <div class=\"data-chart-card\">\n <p class=\"title\">\n {{ chartData.modelName }}\n </p>\n <template v-if=\"chartData.data.length\">\n <el-scrollbar v-if=\"chartData.groupByDesc.length\">\n <div :class=\"{ 'data-chart-card-grid-layout': chartData.groupByDesc.length }\">\n <div\n v-for=\"(dataItem, dataIndex) in chartData.data\"\n :key=\"dataIndex\"\n class=\"card-item\"\n :style=\"{\n 'background-image': `${bgLeftUrl}, ${bgRightUrl}`,\n }\"\n >\n <div\n class=\"card-title\"\n :title=\"cardTitle(dataItem)\"\n >\n {{ cardTitle(dataItem) }}\n </div>\n <div class=\"context\">\n <span\n v-for=\"(item, index) in chartData.colDesc\"\n :key=\"item\"\n >\n {{ `${item}: ` || '-' }}<strong>{{ dataItem[item] || '-' }}</strong> {{ index === chartData.colDesc.length\n - 1 ? '' : ',' }}\n </span>\n </div>\n <div class=\"suffix-icon\">\n {{ dataIndex + 1 }}\n </div>\n </div>\n </div>\n </el-scrollbar>\n <div\n v-else\n class=\"data-chart-card-wrap\"\n >\n <div\n v-for=\"(dataItem, dataIndex) in chartData.data\"\n :key=\"dataIndex\"\n class=\"card-item\"\n :style=\"{\n 'background-image': `${bgLeftUrl}, ${bgRightUrl}`,\n }\"\n >\n <div\n class=\"card-title\"\n :title=\"chartData.modelName\"\n >\n {{ chartData.modelName }}\n </div>\n <div class=\"context\">\n <span\n v-for=\"(item, index) in chartData.colDesc\"\n :key=\"item\"\n >\n <template v-if=\"dataItem\">\n {{ `${item}: ` || '-' }}<strong>{{ dataItem[item] || '-' }}</strong> {{ index === chartData.colDesc.length\n - 1 ? '' : ',' }}\n </template>\n </span>\n </div>\n </div>\n </div>\n </template>\n <Empty v-else />\n </div>\n</template>\n\n<style scoped lang=\"scss\">\n.data-chart-card {\n display: flex;\n flex-direction: column;\n\n .title {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0 5.5px;\n margin: 0;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n line-height: 26px;\n color: #464646;\n }\n\n .data-chart-card-grid-layout {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));\n gap: 10px;\n width: calc(100% - 3px);\n }\n\n .data-chart-card-wrap {\n height: 100% !important;\n\n .card-item {\n width: 100% !important;\n }\n }\n\n .card-item {\n position: relative;\n background-repeat: no-repeat;\n background-position: left top, right top;\n background-size: contain, contain;\n border: 2px solid #2196f3;\n border-radius: 6px;\n\n .suffix-icon {\n position: absolute;\n right: 1px;\n bottom: calc(25% - 14px);\n width: 20px;\n font-size: 20px;\n font-weight: bold;\n color: #fff;\n text-align: center;\n }\n\n .card-title {\n padding-left: 15px;\n margin-top: 10px;\n margin-bottom: 5px;\n overflow: hidden;\n font-size: 16px;\n font-weight: bold;\n color: #2196f3;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .context {\n padding: 0 30px 10px 20px;\n font-size: 14px;\n color: #464646;\n }\n }\n}\n</style>\n"],"names":["props","__props","bgLeftUrl","bgLeft","bgRightUrl","bgRight","cardTitle","dataItem","colDesc","chartData","xGroupByDesc","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_toDisplayString","modelName","data","length","_Fragment","key","groupByDesc","_createBlock","_component_el_scrollbar","class","_normalizeClass","data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,GAAcnB,EAAAA,mBAA4C,SAAA,KAAAE,EAAAA,gBAAjCT,EAAS0B,IAAI,KAAA,GAAoBE,EAAAA,gBAAA,sBAAID,IAAUjC,YAAUO,QAAQW,gCAIxGL,EAAAA,mBAEM,MAFNsB,EAEMpB,EAAAA,gBADDW,EAAS,GAAA,6BAKpBhB,EAAAA,YAAAC,qBA8BM,MA9BNyB,EA8BM,EA1BJ1B,EAAAA,WAAA,GAAAC,EAAAA,mBAyBMQ,EAAAA,2BAxB4BnB,EAAAQ,UAAUS,KAAI,CAAtCX,EAAUoB,mBADpBf,EAAAA,mBAyBM,MAAA,CAvBHS,IAAKM,EACNF,MAAM,YACLG,MAAKC,EAAAA,eAAA,CAAuC,mBAAA,GAAA3B,MAAcE,QAI3DU,EAAAA,mBAKM,MAAA,CAJJW,MAAM,aACLK,MAAO7B,EAAAQ,UAAUQ,WAEfD,EAAAA,gBAAAf,EAAAQ,UAAUQ,WAAS,EAAAqB,GAExBxB,EAAAA,mBAUM,MAVNyB,EAUM,EATJ5B,EAAAA,WAAA,GAAAC,EAAAA,mBAQOQ,EAAAA,2BAPmBnB,EAAAQ,UAAUD,QAAO,CAAjCyB,EAAMC,mBADhBtB,EAAAA,mBAQO,OAAA,CANJS,IAAKY,GAAI,CAEM1B,iBAAhBK,EAAAA,mBAGWQ,EAAAA,SAAA,CAAAC,IAAA,GAAA,wCAFHY,OAAI,KAAA,GAAcnB,EAAAA,mBAA4C,SAAA,KAAAE,EAAAA,gBAAjCT,EAAS0B,IAAI,KAAA,GAAoBE,EAAAA,gBAAA,sBAAID,IAAUjC,YAAUO,QAAQW,0GAQhHI,EAAAA,YAAgBiB,EAAAA,QAAA,CAAAnB,IAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"funnel.vue2.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/funnel.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { LegendOption } from 'echarts/types/dist/shared'\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartFunnel',\n})\nconst {\n chartOptions,\n chartData,\n lazyLoad = true,\n} = defineProps<{\n chartData: IFormatPublicData\n chartOptions: EChartsOption\n lazyLoad?: boolean\n}>()\nconst dataChartFunnel = ref()\nconst merge = inject(InjectionChartMerge, (v: any) => v, true)\nconst funnelChartOptions = computed<EChartsOption>(() => {\n const { colDesc, xGroupByDesc, modelName, data } = chartData\n\n const config = {\n title: {\n text: modelName,\n },\n legend: {},\n series: colDesc.map((item) => {\n return {\n name: item,\n type: 'funnel',\n left: '10%',\n width: '80%',\n label: {\n formatter: '{c}',\n },\n labelLine: {\n show: false,\n },\n itemStyle: {\n opacity: 0.7,\n },\n emphasis: {\n label: {\n position: 'inside',\n formatter: `{b}${item}: {c}`,\n },\n },\n data: data.map(yItem => ({\n name: yItem[xGroupByDesc?.colDesc || ''],\n value: yItem[item] || '',\n })),\n }\n }),\n }\n if (colDesc.length !== 1) {\n (config.legend as LegendOption).data = colDesc\n }\n return merge(config, chartOptions)\n})\n\nconst { myChart } = useCharts({\n chartDOM: dataChartFunnel,\n chartOptions: funnelChartOptions,\n chartData: computed(() => chartData),\n lazyLoad\n})\n\n// 暴露 myChart 方法供父组件访问\ndefineExpose({\n myChart,\n})\n</script>\n\n<template>\n <div\n ref=\"dataChartFunnel\"\n class=\"data-chart-funnel\"\n />\n</template>\n\n<style scoped lang=\"scss\">\n.data-chart-funnel {\n width: 100%;\n height: 100%;\n}\n</style>\n"],"names":["dataChartFunnel","ref","merge","inject","InjectionChartMerge","v","funnelChartOptions","computed","colDesc","xGroupByDesc","modelName","data","__props","chartData","config","title","text","legend","series","map","item","name","type","left","width","label","formatter","labelLine","show","itemStyle","opacity","emphasis","position","yItem","value","length","chartOptions","myChart","useCharts","chartDOM","lazyLoad","__expose","_createElementBlock","class"],"mappings":"qXAkBA,MAAMA,EAAkBC,EAAAA,MAClBC,EAAQC,EAAAA,OAAOC,EAAAA,oBAAsBC,GAAWA,GAAG,GACnDC,EAAqBC,EAAAA,SAAwB,KACjD,MAAMC,QAAEA,EAAAC,aAASA,EAAAC,UAAcA,EAAAC,KAAWA,GAASC,EAAAC,UAE7CC,EAAS,CACbC,MAAO,CACLC,KAAMN,GAERO,OAAQ,CAAA,EACRC,OAAQV,EAAQW,IAAKC,IACZ,CACLC,KAAMD,EACNE,KAAM,SACNC,KAAM,MACNC,MAAO,MACPC,MAAO,CACLC,UAAW,OAEbC,UAAW,CACTC,MAAM,GAERC,UAAW,CACTC,QAAS,IAEXC,SAAU,CACRN,MAAO,CACLO,SAAU,SACVN,UAAW,MAAMN,WAGrBT,KAAMA,EAAKQ,IAAIc,IAAA,CACbZ,KAAMY,EAAMxB,GAAcD,SAAW,IACrC0B,MAAOD,EAAMb,IAAS,UAQ9B,OAHuB,IAAnBZ,EAAQ2B,SACTrB,EAAOG,OAAwBN,KAAOH,GAElCN,EAAMY,EAAQF,EAAAwB,iBAGjBC,QAAEA,GAAYC,YAAU,CAC5BC,SAAUvC,EACVoC,aAAc9B,EACdO,UAAWN,EAAAA,SAAS,IAAMK,EAAAC,WAC1B2B,SAAO5B,EAAA4B,kBAITC,EAAa,CACXJ,kCAKAK,EAAAA,mBAGE,MAAA,SAFI,kBAAJzC,IAAID,EACJ2C,MAAM"}
1
+ {"version":3,"file":"funnel.vue2.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/funnel.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { LegendOption } from 'echarts/types/dist/shared'\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { computed, inject, ref } from 'vue'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartFunnel',\n})\nconst {\n chartOptions,\n chartData,\n lazyLoad = true,\n} = defineProps<{\n chartData: IFormatPublicData\n chartOptions: EChartsOption\n lazyLoad?: boolean\n}>()\nconst dataChartFunnel = ref()\nconst merge = inject(InjectionChartMerge, (v: any) => v, true)\nconst funnelChartOptions = computed<EChartsOption>(() => {\n const { colDesc, xGroupByDesc, modelName, data } = chartData\n\n const config = {\n title: {\n text: modelName,\n },\n legend: {},\n series: colDesc.map((item) => {\n return {\n name: item,\n type: 'funnel',\n left: '10%',\n width: '80%',\n label: {\n formatter: '{c}',\n },\n labelLine: {\n show: false,\n },\n itemStyle: {\n opacity: 0.7,\n },\n emphasis: {\n label: {\n position: 'inside',\n formatter: `{b}${item}: {c}`,\n },\n },\n data: data.map(yItem => ({\n name: yItem[xGroupByDesc?.colDesc || ''],\n value: yItem[item] || '',\n })),\n }\n }),\n }\n if (colDesc.length !== 1) {\n (config.legend as LegendOption).data = colDesc\n }\n return merge(config, chartOptions)\n})\n\nconst { myChart } = useCharts({\n chartDOM: dataChartFunnel,\n chartOptions: funnelChartOptions,\n chartData: computed(() => chartData),\n lazyLoad,\n})\n\n// 暴露 myChart 方法供父组件访问\ndefineExpose({\n myChart,\n})\n</script>\n\n<template>\n <div\n ref=\"dataChartFunnel\"\n class=\"data-chart-funnel\"\n />\n</template>\n\n<style scoped lang=\"scss\">\n.data-chart-funnel {\n width: 100%;\n height: 100%;\n}\n</style>\n"],"names":["dataChartFunnel","ref","merge","inject","InjectionChartMerge","v","funnelChartOptions","computed","colDesc","xGroupByDesc","modelName","data","__props","chartData","config","title","text","legend","series","map","item","name","type","left","width","label","formatter","labelLine","show","itemStyle","opacity","emphasis","position","yItem","value","length","chartOptions","myChart","useCharts","chartDOM","lazyLoad","__expose","_createElementBlock","class"],"mappings":"qXAmBA,MAAMA,EAAkBC,EAAAA,MAClBC,EAAQC,EAAAA,OAAOC,EAAAA,oBAAsBC,GAAWA,GAAG,GACnDC,EAAqBC,EAAAA,SAAwB,KACjD,MAAMC,QAAEA,EAAAC,aAASA,EAAAC,UAAcA,EAAAC,KAAWA,GAASC,EAAAC,UAE7CC,EAAS,CACbC,MAAO,CACLC,KAAMN,GAERO,OAAQ,CAAA,EACRC,OAAQV,EAAQW,IAAKC,IACZ,CACLC,KAAMD,EACNE,KAAM,SACNC,KAAM,MACNC,MAAO,MACPC,MAAO,CACLC,UAAW,OAEbC,UAAW,CACTC,MAAM,GAERC,UAAW,CACTC,QAAS,IAEXC,SAAU,CACRN,MAAO,CACLO,SAAU,SACVN,UAAW,MAAMN,WAGrBT,KAAMA,EAAKQ,IAAIc,IAAA,CACbZ,KAAMY,EAAMxB,GAAcD,SAAW,IACrC0B,MAAOD,EAAMb,IAAS,UAQ9B,OAHuB,IAAnBZ,EAAQ2B,SACTrB,EAAOG,OAAwBN,KAAOH,GAElCN,EAAMY,EAAQF,EAAAwB,iBAGjBC,QAAEA,GAAYC,YAAU,CAC5BC,SAAUvC,EACVoC,aAAc9B,EACdO,UAAWN,EAAAA,SAAS,IAAMK,EAAAC,WAC1B2B,SAAO5B,EAAA4B,kBAITC,EAAa,CACXJ,kCAKAK,EAAAA,mBAGE,MAAA,SAFI,kBAAJzC,IAAID,EACJ2C,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"line.vue2.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/line.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { LegendComponentOption } from 'echarts'\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartLine',\n})\nconst {\n chartData,\n subShowType = 'line-simple',\n chartOptions,\n lazyLoad = true,\n} = defineProps<{\n chartData: IFormatPublicData\n subShowType: string\n chartOptions: EChartsOption\n lazyLoad?: boolean\n}>()\nconst dataChartLine = ref()\nconst merge = inject(InjectionChartMerge, (v: any) => v, true)\n\n// 抽取类型定义\ninterface SeriesItem {\n name: string\n type: 'line'\n stack?: string\n smooth?: boolean\n areaStyle?: Record<string, any>\n data: Array<string | number | null>\n}\n\n// 将配置提取为常量\nconst CHART_CONSTANTS = {\n MIN_ZOOM_LENGTH: 15,\n STACK_NAME: 'Total',\n SMOOTH: true,\n} as const\n\n// 提取处理图表系列数据的函数\nfunction processSeriesData(legendDataItem: string,\n xAxisData: (string | number)[],\n data: any[],\n xGroupByDesc: any,\n yGroupByDesc: any,\n colDesc: string[]): SeriesItem {\n const seriesData: (string | number | null)[] = []\n\n xAxisData.forEach((xAxisItem) => {\n const targetData = data\n .find(dataItem =>\n dataItem[xGroupByDesc?.colDesc] === xAxisItem\n && dataItem[yGroupByDesc?.colDesc] === legendDataItem,\n )\n\n if (targetData && targetData[colDesc[0]] !== undefined && targetData[colDesc[0]] !== null) {\n seriesData.push(targetData[colDesc[0]])\n }\n else {\n seriesData.push(null) // 使用 null 而不是 0,让 ECharts 自动处理空值\n }\n })\n\n return {\n name: legendDataItem,\n type: 'line',\n smooth: CHART_CONSTANTS.SMOOTH,\n stack: CHART_CONSTANTS.STACK_NAME,\n areaStyle: {},\n data: seriesData,\n }\n}\n\nconst lineChartOptions = computed<EChartsOption>(() => {\n const { colDesc, xGroupByDesc, groupByDesc, data, modelName } = chartData\n\n // 数据验证\n if (!data || data.length === 0) {\n console.warn('[LineChart] 数据为空,图表将显示空状态')\n }\n\n if (!colDesc || colDesc.length === 0) {\n console.warn('[LineChart] colDesc 为空,无法生成图表系列')\n }\n\n if (!xGroupByDesc?.colDesc) {\n console.warn('[LineChart] xGroupByDesc.colDesc 为空,无法生成 X 轴数据')\n }\n\n const xAxisData = Array.from(new Set(data?.map(item => item[xGroupByDesc?.colDesc || '']))).filter(item => item !== undefined && item !== null) || []\n const yGroupByDesc = groupByDesc?.find(item => !item.xAxis)\n\n const config: EChartsOption & { series?: SeriesItem[] } = {\n title: { text: modelName },\n legend: { data: [] },\n xAxis: {\n name: xGroupByDesc?.colDesc || '',\n data: xAxisData,\n },\n dataZoom: [{\n type: 'inside',\n disabled: xAxisData.length < CHART_CONSTANTS.MIN_ZOOM_LENGTH,\n }],\n }\n\n // 处理系列数据\n if (groupByDesc?.length === 1) {\n config.series = colDesc.map(yItem => ({\n name: yItem,\n type: 'line',\n smooth: CHART_CONSTANTS.SMOOTH,\n data: xAxisData.map(xValue => {\n const dataItem = data.find(item => item[xGroupByDesc?.colDesc || ''] === xValue)\n return dataItem ? (dataItem[yItem] ?? null) : null\n }),\n }));\n (config.legend as LegendComponentOption).data = colDesc\n }\n else if (groupByDesc?.length === 2) {\n const legendData = [...new Set(data.map(item => String(item[yGroupByDesc?.colDesc || ''])))]\n ;(config.legend as LegendComponentOption).data = legendData\n\n config.series = legendData.map(legendDataItem =>\n processSeriesData(legendDataItem, xAxisData, data, xGroupByDesc, yGroupByDesc, colDesc),\n )\n }\n\n // 处理图表展示类型\n config.series = config.series?.map((item) => {\n const seriesItem = { ...item }\n\n switch (subShowType) {\n case 'line-simple':\n delete seriesItem.areaStyle\n break\n case 'area-basic':\n seriesItem.areaStyle = {}\n break\n default:\n delete seriesItem.areaStyle\n }\n\n return seriesItem\n })\n\n return merge(config, chartOptions)\n})\n\nconst { myChart } = useCharts({\n chartDOM: dataChartLine,\n chartOptions: lineChartOptions,\n chartData: computed(() => chartData),\n lazyLoad\n})\n\n// 暴露 myChart 方法供父组件访问\ndefineExpose({\n myChart,\n})\n</script>\n\n<template>\n <div\n ref=\"dataChartLine\"\n class=\"data-chart-line\"\n />\n</template>\n\n<style scoped lang=\"scss\">\n.data-chart-line {\n width: 100%;\n height: 100%;\n}\n</style>\n"],"names":["dataChartLine","ref","merge","inject","InjectionChartMerge","v","CHART_CONSTANTS","lineChartOptions","computed","colDesc","xGroupByDesc","groupByDesc","data","modelName","__props","chartData","length","console","warn","xAxisData","Array","from","Set","map","item","filter","yGroupByDesc","find","xAxis","config","title","text","legend","name","dataZoom","type","disabled","series","yItem","smooth","xValue","dataItem","legendData","String","legendDataItem","seriesData","forEach","xAxisItem","targetData","push","stack","areaStyle","processSeriesData","seriesItem","subShowType","chartOptions","myChart","useCharts","chartDOM","lazyLoad","__expose","_createElementBlock","class"],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nB,OAlF/B,SAA2BqB,EACzBzB,EACAP,EACAF,EACAgB,EACAjB,GACA,MAAMoC,EAAyC,GAiB/C,OAfA1B,EAAU2B,QAASC,IACjB,MAAMC,EAAapC,EAChBe,KAAKc,GACJA,EAAS/B,GAAcD,WAAasC,GACjCN,EAASf,GAAcjB,WAAamC,GAGvCI,QAAyC,IAA3BA,EAAWvC,EAAQ,KAAgD,OAA3BuC,EAAWvC,EAAQ,IAC3EoC,EAAWI,KAAKD,EAAWvC,EAAQ,KAGnCoC,EAAWI,KAAK,QAIb,CACLhB,KAAMW,EACNT,KAAM,OACNI,OAAQjC,EACR4C,MAAO5C,EACP6C,UAAW,CAAA,EACXvC,KAAMiC,EAEV,CAoDMO,CAAkBR,EAAgBzB,EAAWP,EAAMF,EAAcgB,EAAcjB,GAEnF,CAoBA,OAjBAoB,EAAOQ,OAASR,EAAOQ,QAAQd,IAAKC,IAClC,MAAM6B,EAAa,IAAK7B,GAExB,OAAQV,EAAAwC,aACN,IAAK,cAML,eACSD,EAAWF,gBAJpB,IAAK,aACHE,EAAWF,UAAY,CAAA,EAM3B,OAAOE,IAGFnD,EAAM2B,EAAQf,EAAAyC,iBAGjBC,QAAEA,GAAYC,YAAU,CAC5BC,SAAU1D,EACVuD,aAAchD,EACdQ,UAAWP,EAAAA,SAAS,IAAMM,EAAAC,WAC1B4C,SAAO7C,EAAA6C,kBAITC,EAAa,CACXJ,kCAKAK,EAAAA,mBAGE,MAAA,SAFI,gBAAJ5D,IAAID,EACJ8D,MAAM"}
1
+ {"version":3,"file":"line.vue2.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/line.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { LegendComponentOption } from 'echarts'\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { computed, inject, ref } from 'vue'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartLine',\n})\nconst {\n chartData,\n subShowType = 'line-simple',\n chartOptions,\n lazyLoad = true,\n} = defineProps<{\n chartData: IFormatPublicData\n subShowType: string\n chartOptions: EChartsOption\n lazyLoad?: boolean\n}>()\nconst dataChartLine = ref()\nconst merge = inject(InjectionChartMerge, (v: any) => v, true)\n\n// 抽取类型定义\ninterface SeriesItem {\n name: string\n type: 'line'\n stack?: string\n smooth?: boolean\n areaStyle?: Record<string, any>\n data: Array<string | number | null>\n}\n\n// 将配置提取为常量\nconst CHART_CONSTANTS = {\n MIN_ZOOM_LENGTH: 15,\n STACK_NAME: 'Total',\n SMOOTH: true,\n} as const\n\n// 提取处理图表系列数据的函数\nfunction processSeriesData(legendDataItem: string,\n xAxisData: (string | number)[],\n data: any[],\n xGroupByDesc: any,\n yGroupByDesc: any,\n colDesc: string[]): SeriesItem {\n const seriesData: (string | number | null)[] = []\n\n xAxisData.forEach((xAxisItem) => {\n const targetData = data\n .find(dataItem =>\n dataItem[xGroupByDesc?.colDesc] === xAxisItem\n && dataItem[yGroupByDesc?.colDesc] === legendDataItem,\n )\n\n if (targetData && targetData[colDesc[0]] !== undefined && targetData[colDesc[0]] !== null) {\n seriesData.push(targetData[colDesc[0]])\n }\n else {\n seriesData.push(null) // 使用 null 而不是 0,让 ECharts 自动处理空值\n }\n })\n\n return {\n name: legendDataItem,\n type: 'line',\n smooth: CHART_CONSTANTS.SMOOTH,\n stack: CHART_CONSTANTS.STACK_NAME,\n areaStyle: {},\n data: seriesData,\n }\n}\n\nconst lineChartOptions = computed<EChartsOption>(() => {\n const { colDesc, xGroupByDesc, groupByDesc, data, modelName } = chartData\n\n // 数据验证\n if (!data || data.length === 0) {\n console.warn('[LineChart] 数据为空,图表将显示空状态')\n }\n\n if (!colDesc || colDesc.length === 0) {\n console.warn('[LineChart] colDesc 为空,无法生成图表系列')\n }\n\n if (!xGroupByDesc?.colDesc) {\n console.warn('[LineChart] xGroupByDesc.colDesc 为空,无法生成 X 轴数据')\n }\n\n const xAxisData = Array.from(new Set(data?.map(item => item[xGroupByDesc?.colDesc || '']))).filter(item => item !== undefined && item !== null) || []\n const yGroupByDesc = groupByDesc?.find(item => !item.xAxis)\n\n const config: EChartsOption & { series?: SeriesItem[] } = {\n title: { text: modelName },\n legend: { data: [] },\n xAxis: {\n name: xGroupByDesc?.colDesc || '',\n data: xAxisData,\n },\n dataZoom: [{\n type: 'inside',\n disabled: xAxisData.length < CHART_CONSTANTS.MIN_ZOOM_LENGTH,\n }],\n }\n\n // 处理系列数据\n if (groupByDesc?.length === 1) {\n config.series = colDesc.map(yItem => ({\n name: yItem,\n type: 'line',\n smooth: CHART_CONSTANTS.SMOOTH,\n data: xAxisData.map((xValue) => {\n const dataItem = data.find(item => item[xGroupByDesc?.colDesc || ''] === xValue)\n return dataItem ? (dataItem[yItem] ?? null) : null\n }),\n }));\n (config.legend as LegendComponentOption).data = colDesc\n }\n else if (groupByDesc?.length === 2) {\n const legendData = [...new Set(data.map(item => String(item[yGroupByDesc?.colDesc || ''])))]\n ;(config.legend as LegendComponentOption).data = legendData\n\n config.series = legendData.map(legendDataItem =>\n processSeriesData(legendDataItem, xAxisData, data, xGroupByDesc, yGroupByDesc, colDesc),\n )\n }\n\n // 处理图表展示类型\n config.series = config.series?.map((item) => {\n const seriesItem = { ...item }\n\n switch (subShowType) {\n case 'line-simple':\n delete seriesItem.areaStyle\n break\n case 'area-basic':\n seriesItem.areaStyle = {}\n break\n default:\n delete seriesItem.areaStyle\n }\n\n return seriesItem\n })\n\n return merge(config, chartOptions)\n})\n\nconst { myChart } = useCharts({\n chartDOM: dataChartLine,\n chartOptions: lineChartOptions,\n chartData: computed(() => chartData),\n lazyLoad,\n})\n\n// 暴露 myChart 方法供父组件访问\ndefineExpose({\n myChart,\n})\n</script>\n\n<template>\n <div\n ref=\"dataChartLine\"\n class=\"data-chart-line\"\n />\n</template>\n\n<style scoped lang=\"scss\">\n.data-chart-line {\n width: 100%;\n height: 100%;\n}\n</style>\n"],"names":["dataChartLine","ref","merge","inject","InjectionChartMerge","v","CHART_CONSTANTS","lineChartOptions","computed","colDesc","xGroupByDesc","groupByDesc","data","modelName","__props","chartData","length","console","warn","xAxisData","Array","from","Set","map","item","filter","yGroupByDesc","find","xAxis","config","title","text","legend","name","dataZoom","type","disabled","series","yItem","smooth","xValue","dataItem","legendData","String","legendDataItem","seriesData","forEach","xAxisItem","targetData","push","stack","areaStyle","processSeriesData","seriesItem","subShowType","chartOptions","myChart","useCharts","chartDOM","lazyLoad","__expose","_createElementBlock","class"],"mappings":"6aAqBA,MAAMA,EAAgBC,EAAAA,MAChBC,EAAQC,EAAAA,OAAOC,EAAAA,oBAAsBC,GAAWA,GAAG,GAanDC,EACa,GADbA,EAEQ,QAFRA,GAGI,EAqCV,MAAMC,EAAmBC,EAAAA,SAAwB,KAC/C,MAAMC,QAAEA,EAAAC,aAASA,EAAAC,YAAcA,OAAaC,EAAAC,UAAMA,GAAcC,EAAAC,UAG3DH,GAAwB,IAAhBA,EAAKI,QAChBC,QAAQC,KAAK,6BAGVT,GAA8B,IAAnBA,EAAQO,QACtBC,QAAQC,KAAK,mCAGVR,GAAcD,SACjBQ,QAAQC,KAAK,kDAGf,MAAMC,EAAYC,MAAMC,KAAK,IAAIC,IAAIV,GAAMW,IAAIC,GAAQA,EAAKd,GAAcD,SAAW,OAAOgB,OAAOD,GAAQA,UAAwC,GAC7IE,EAAef,GAAagB,KAAKH,IAASA,EAAKI,OAE/CC,EAAoD,CACxDC,MAAO,CAAEC,KAAMlB,GACfmB,OAAQ,CAAEpB,KAAM,IAChBgB,MAAO,CACLK,KAAMvB,GAAcD,SAAW,GAC/BG,KAAMO,GAERe,SAAU,CAAC,CACTC,KAAM,SACNC,SAAUjB,EAAUH,OAASV,KAKjC,GAA4B,IAAxBK,GAAaK,OACfa,EAAOQ,OAAS5B,EAAQc,IAAIe,IAAA,CAC1BL,KAAMK,EACNH,KAAM,OACNI,OAAQjC,EACRM,KAAMO,EAAUI,IAAKiB,IACnB,MAAMC,EAAW7B,EAAKe,KAAK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8D,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"pie.vue2.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/pie.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { PieSeriesOption } from 'echarts/charts'\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { orderBy } from 'lodash-es'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartPie',\n})\nconst {\n chartData,\n subShowType = 'pie-simple',\n chartOptions,\n lazyLoad = true,\n} = defineProps<{\n chartData: IFormatPublicData\n subShowType: string\n chartOptions: EChartsOption\n lazyLoad?: boolean\n}>()\nconst merge = inject(InjectionChartMerge, (v: any) => v, true)\n\nconst dataChartPie = ref(null)\nconst pieChartOptions = computed<EChartsOption>(() => {\n const { colDesc, xGroupByDesc, data, modelName } = chartData\n const colDescLength = colDesc.length\n const config = {\n title: { text: modelName },\n series: colDesc.map((item, index) => {\n const seriesItem: PieSeriesOption = {\n name: item,\n type: 'pie',\n center: ['50%', '50%'],\n data: [],\n emphasis: {\n itemStyle: {\n shadowBlur: 10,\n shadowOffsetX: 0,\n shadowColor: 'rgba(0, 0, 0, 0.5)',\n },\n },\n label: {\n formatter: '{b}:{c}({d}%)',\n rich: {\n b: {\n color: '#4C5058',\n fontSize: 14,\n fontWeight: 'bold',\n lineHeight: 33,\n },\n },\n },\n }\n\n let cutNum = 5\n const currentItemData = data.filter(row => row[item] !== undefined)\n const orderByData = orderBy(currentItemData, [item], ['desc'])\n // 总数\n const totalDesc = orderByData.reduce((prev, cur) => {\n const value = Number(cur[item]) || 0\n return Number.isNaN(value) ? prev : prev + value\n }, 0)\n if (currentItemData.length > cutNum) {\n while (cutNum < 9) {\n const headerData = orderByData.slice(0, cutNum)\n // 前 cutNum 个总数\n const headerTotal = headerData.reduce(\n (prev, cur) => prev + Number(cur[item]),\n 0,\n )\n // 前五总占比\n const headerScale = headerTotal / totalDesc\n if (headerScale > 0.9 || cutNum === 8) {\n const footerData = orderByData.slice(\n cutNum,\n orderByData.length - 1,\n )\n seriesItem.data = currentItemData\n .map((yItem) => {\n let obj = {}\n headerData.forEach((headerDataItem) => {\n if (JSON.stringify(headerDataItem) === JSON.stringify(yItem)) {\n obj = {\n name: xGroupByDesc?.colDesc\n ? yItem[xGroupByDesc.colDesc]\n : '',\n value: yItem[item],\n }\n }\n })\n return obj\n })\n .filter(v => v && Object.keys(v).length > 0)\n seriesItem.data.push({\n name: '其它',\n value: footerData.reduce(\n (prev, cur) => prev + Number(cur[item]),\n 0,\n ),\n })\n\n break\n }\n else {\n cutNum++\n }\n }\n }\n else {\n seriesItem.data = currentItemData.map(yItem => ({\n name: xGroupByDesc?.colDesc ? (yItem[xGroupByDesc.colDesc] || '') : '',\n value: Number(yItem[item] || 0),\n }))\n }\n\n if (colDescLength === 1) {\n seriesItem.center = ['50%', '60%']\n }\n else if (colDescLength === 2) {\n if (index === 0) {\n seriesItem.right = '40%'\n seriesItem.left = ''\n seriesItem.center = ['40%', '60%']\n }\n else {\n seriesItem.right = ''\n seriesItem.left = '40%'\n seriesItem.center = ['60%', '60%']\n }\n }\n else if (colDescLength === 3) {\n if (index === 0) {\n seriesItem.right = '40%'\n seriesItem.bottom = '50%'\n seriesItem.top = ''\n seriesItem.left = ''\n seriesItem.center = ['40%', '78%']\n }\n else if (index === 1) {\n seriesItem.right = ''\n seriesItem.bottom = '50%'\n seriesItem.top = ''\n seriesItem.left = '40%'\n seriesItem.center = ['60%', '78%']\n }\n else {\n seriesItem.right = '40%'\n seriesItem.bottom = ''\n seriesItem.top = '50%'\n seriesItem.left = ''\n seriesItem.center = ['40%', '60%']\n }\n }\n else if (colDescLength === 4) {\n if (index === 0) {\n seriesItem.right = '40%'\n seriesItem.bottom = '50%'\n seriesItem.top = ''\n seriesItem.left = ''\n seriesItem.center = ['40%', '78%']\n }\n else if (index === 1) {\n seriesItem.right = ''\n seriesItem.bottom = '50%'\n seriesItem.top = ''\n seriesItem.left = '40%'\n seriesItem.center = ['60%', '78%']\n }\n else if (index === 2) {\n seriesItem.right = '40%'\n seriesItem.bottom = ''\n seriesItem.top = '50%'\n seriesItem.left = ''\n seriesItem.center = ['40%', '60%']\n }\n else {\n seriesItem.right = ''\n seriesItem.bottom = ''\n seriesItem.top = '50%'\n seriesItem.left = '40%'\n seriesItem.center = ['60%', '60%']\n }\n }\n // 处理图表形状\n switch (subShowType) {\n case 'pie-borderRadius':\n seriesItem.radius = ['50%', '70%']\n break\n case 'pie-simple':\n seriesItem.radius = '50%'\n break\n default:\n seriesItem.radius = '50%'\n break\n }\n return seriesItem\n }),\n }\n\n return merge(config, chartOptions)\n})\n\nconst { myChart } = useCharts({\n chartDOM: dataChartPie,\n chartOptions: pieChartOptions,\n chartData: computed(() => chartData),\n lazyLoad\n})\n\n// 暴露 myChart 方法供父组件访问\ndefineExpose({\n myChart,\n})\n</script>\n\n<template>\n <div\n ref=\"dataChartPie\"\n class=\"data-chart-pie\"\n />\n</template>\n\n<style scoped lang=\"scss\">\n.data-chart-pie {\n width: 100%;\n height: 100%;\n}\n</style>\n"],"names":["merge","inject","InjectionChartMerge","v","dataChartPie","ref","pieChartOptions","computed","colDesc","xGroupByDesc","data","modelName","__props","chartData","colDescLength","length","config","title","text","series","map","item","index","seriesItem","name","type","center","emphasis","itemStyle","shadowBlur","shadowOffsetX","shadowColor","label","formatter","rich","b","color","fontSize","fontWeight","lineHeight","cutNum","currentItemData","filter","row","orderByData","orderBy","totalDesc","reduce","prev","cur","value","Number","isNaN","headerData","slice","footerData","yItem","obj","forEach","headerDataItem","JSON","stringify","Object","keys","push","right","left","bottom","top","subShowType","radius","chartOptions","myChart","useCharts","chartDOM","lazyLoad","__expose","_createElementBlock","class"],"mappings":"icAqBA,MAAMA,EAAQC,EAAAA,OAAOC,EAAAA,oBAAsBC,GAAWA,GAAG,GAEnDC,EAAeC,EAAAA,IAAI,MACnBC,EAAkBC,EAAAA,SAAwB,KAC9C,MA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MAClB3C,EAAWG,OAAS,CAAC,MAAO,QAEX,IAAVJ,GACPC,EAAW0C,MAAQ,MACnB1C,EAAW4C,OAAS,GACpB5C,EAAW6C,IAAM,MACjB7C,EAAW2C,KAAO,GAClB3C,EAAWG,OAAS,CAAC,MAAO,SAG5BH,EAAW0C,MAAQ,GACnB1C,EAAW4C,OAAS,GACpB5C,EAAW6C,IAAM,MACjB7C,EAAW2C,KAAO,MAClB3C,EAAWG,OAAS,CAAC,MAAO,SAKzB,qBADCd,EAAAyD,YAEJ9C,EAAW+C,OAAS,CAAC,MAAO,YAM5B/C,EAAW+C,OAAS,MAGxB,OAAO/C,KAIX,OAAOvB,EAAMgB,EAAQJ,EAAA2D,iBAGjBC,QAAEA,GAAYC,YAAU,CAC5BC,SAAUtE,EACVmE,aAAcjE,EACdO,UAAWN,EAAAA,SAAS,IAAMK,EAAAC,WAC1B8D,SAAO/D,EAAA+D,kBAITC,EAAa,CACXJ,kCAKAK,EAAAA,mBAGE,MAAA,SAFI,eAAJxE,IAAID,EACJ0E,MAAM"}
1
+ {"version":3,"file":"pie.vue2.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/pie.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { PieSeriesOption } from 'echarts/charts'\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { orderBy } from 'lodash-es'\nimport { computed, inject, ref } from 'vue'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartPie',\n})\nconst {\n chartData,\n subShowType = 'pie-simple',\n chartOptions,\n lazyLoad = true,\n} = defineProps<{\n chartData: IFormatPublicData\n subShowType: string\n chartOptions: EChartsOption\n lazyLoad?: boolean\n}>()\nconst merge = inject(InjectionChartMerge, (v: any) => v, true)\n\nconst dataChartPie = ref(null)\nconst pieChartOptions = computed<EChartsOption>(() => {\n const { colDesc, xGroupByDesc, data, modelName } = chartData\n const colDescLength = colDesc.length\n const config = {\n title: { text: modelName },\n series: colDesc.map((item, index) => {\n const seriesItem: PieSeriesOption = {\n name: item,\n type: 'pie',\n center: ['50%', '50%'],\n data: [],\n emphasis: {\n itemStyle: {\n shadowBlur: 10,\n shadowOffsetX: 0,\n shadowColor: 'rgba(0, 0, 0, 0.5)',\n },\n },\n label: {\n formatter: '{b}:{c}({d}%)',\n rich: {\n b: {\n color: '#4C5058',\n fontSize: 14,\n fontWeight: 'bold',\n lineHeight: 33,\n },\n },\n },\n }\n\n let cutNum = 5\n const currentItemData = data.filter(row => row[item] !== undefined)\n const orderByData = orderBy(currentItemData, [item], ['desc'])\n // 总数\n const totalDesc = orderByData.reduce((prev, cur) => {\n const value = Number(cur[item]) || 0\n return Number.isNaN(value) ? prev : prev + value\n }, 0)\n if (currentItemData.length > cutNum) {\n while (cutNum < 9) {\n const headerData = orderByData.slice(0, cutNum)\n // 前 cutNum 个总数\n const headerTotal = headerData.reduce(\n (prev, cur) => prev + Number(cur[item]),\n 0,\n )\n // 前五总占比\n const headerScale = headerTotal / totalDesc\n if (headerScale > 0.9 || cutNum === 8) {\n const footerData = orderByData.slice(\n cutNum,\n orderByData.length - 1,\n )\n seriesItem.data = currentItemData\n .map((yItem) => {\n let obj = {}\n headerData.forEach((headerDataItem) => {\n if (JSON.stringify(headerDataItem) === JSON.stringify(yItem)) {\n obj = {\n name: xGroupByDesc?.colDesc\n ? yItem[xGroupByDesc.colDesc]\n : '',\n value: yItem[item],\n }\n }\n })\n return obj\n })\n .filter(v => v && Object.keys(v).length > 0)\n seriesItem.data.push({\n name: '其它',\n value: footerData.reduce(\n (prev, cur) => prev + Number(cur[item]),\n 0,\n ),\n })\n\n break\n }\n else {\n cutNum++\n }\n }\n }\n else {\n seriesItem.data = currentItemData.map(yItem => ({\n name: xGroupByDesc?.colDesc ? (yItem[xGroupByDesc.colDesc] || '') : '',\n value: Number(yItem[item] || 0),\n }))\n }\n\n if (colDescLength === 1) {\n seriesItem.center = ['50%', '60%']\n }\n else if (colDescLength === 2) {\n if (index === 0) {\n seriesItem.right = '40%'\n seriesItem.left = ''\n seriesItem.center = ['40%', '60%']\n }\n else {\n seriesItem.right = ''\n seriesItem.left = '40%'\n seriesItem.center = ['60%', '60%']\n }\n }\n else if (colDescLength === 3) {\n if (index === 0) {\n seriesItem.right = '40%'\n seriesItem.bottom = '50%'\n seriesItem.top = ''\n seriesItem.left = ''\n seriesItem.center = ['40%', '78%']\n }\n else if (index === 1) {\n seriesItem.right = ''\n seriesItem.bottom = '50%'\n seriesItem.top = ''\n seriesItem.left = '40%'\n seriesItem.center = ['60%', '78%']\n }\n else {\n seriesItem.right = '40%'\n seriesItem.bottom = ''\n seriesItem.top = '50%'\n seriesItem.left = ''\n seriesItem.center = ['40%', '60%']\n }\n }\n else if (colDescLength === 4) {\n if (index === 0) {\n seriesItem.right = '40%'\n seriesItem.bottom = '50%'\n seriesItem.top = ''\n seriesItem.left = ''\n seriesItem.center = ['40%', '78%']\n }\n else if (index === 1) {\n seriesItem.right = ''\n seriesItem.bottom = '50%'\n seriesItem.top = ''\n seriesItem.left = '40%'\n seriesItem.center = ['60%', '78%']\n }\n else if (index === 2) {\n seriesItem.right = '40%'\n seriesItem.bottom = ''\n seriesItem.top = '50%'\n seriesItem.left = ''\n seriesItem.center = ['40%', '60%']\n }\n else {\n seriesItem.right = ''\n seriesItem.bottom = ''\n seriesItem.top = '50%'\n seriesItem.left = '40%'\n seriesItem.center = ['60%', '60%']\n }\n }\n // 处理图表形状\n switch (subShowType) {\n case 'pie-borderRadius':\n seriesItem.radius = ['50%', '70%']\n break\n case 'pie-simple':\n seriesItem.radius = '50%'\n break\n default:\n seriesItem.radius = '50%'\n break\n }\n return seriesItem\n }),\n }\n\n return merge(config, chartOptions)\n})\n\nconst { myChart } = useCharts({\n chartDOM: dataChartPie,\n chartOptions: pieChartOptions,\n chartData: computed(() => chartData),\n lazyLoad,\n})\n\n// 暴露 myChart 方法供父组件访问\ndefineExpose({\n myChart,\n})\n</script>\n\n<template>\n <div\n ref=\"dataChartPie\"\n class=\"data-chart-pie\"\n />\n</template>\n\n<style scoped lang=\"scss\">\n.data-chart-pie {\n width: 100%;\n height: 100%;\n}\n</style>\n"],"names":["merge","inject","InjectionChartMerge","v","dataChartPie","ref","pieChartOptions","computed","colDesc","xGroupByDesc","data","modelName","__props","chartData","colDescLength","length","config","title","text","series","map","item","index","seriesItem","name","type","center","emphasis","itemStyle","shadowBlur","shadowOffsetX","shadowColor","label","formatter","rich","b","color","fontSize","fontWeight","lineHeight","cutNum","currentItemData","filter","row","orderByData","orderBy","totalDesc","reduce","prev","cur","value","Number","isNaN","headerData","slice","footerData","yItem","obj","forEach","headerDataItem","JSON","stringify","Object","keys","push","right","left","bottom","top","subShowType","radius","chartOptions","myChart","useCharts","chartDOM","lazyLoad","__expose","_createElementBlock","class"],"mappings":"icAsBA,MAAMA,EAAQC,EAAAA,OAAOC,EAAAA,oBAAsBC,GAAWA,GAAG,GAEnDC,EAAeC,EAAAA,IAAI,MACnBC,EAAkBC,EAAAA,SAAwB,KAC9C,MAAMC,QAAEA,EAAAC,aAASA,EAAAC,KAAcA,EAAAC,UAAMA,GAAcC,EAAAC,UAC7CC,EAAgBN,EAAQO,OACxBC,EAAS,CACbC,MAAO,CAAEC,KAAMP,GACfQ,OAAQX,EAAQY,IAAI,CAACC,EAAMC,KACzB,MAAMC,EAA8B,CAClCC,KAAMH,EACNI,KAAM,MACNC,OAAQ,CAAC,MAAO,OAChBhB,KAAM,GACNiB,SAAU,CACRC,UAAW,CACTC,WAAY,GACZC,cAAe,EACfC,YAAa,uBAGjBC,MAAO,CACLC,UAAW,gBACXC,KAAM,CACJC,EAAG,CACDC,MAAO,UACPC,SAAU,GACVC,WAAY,OACZC,WAAY,OAMpB,IAAIC,EAAS,EACb,MAAMC,EAAkB/B,EAAKgC,eAA4B,IAAdC,EAAItB,IACzCuB,EAAcC,EAAAA,QAAQJ,EAAiB,CAACpB,GAAO,CAAC,SAEhDyB,EAAYF,EAAYG,OAA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CACXJ,kCAKAK,EAAAA,mBAGE,MAAA,SAFI,eAAJxE,IAAID,EACJ0E,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"radar.vue2.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/radar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { uniq } from 'lodash-es'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartRadar',\n})\n\nconst {\n chartData,\n chartOptions,\n lazyLoad = true,\n} = defineProps<{\n chartData: IFormatPublicData\n chartOptions: EChartsOption\n lazyLoad?: boolean\n}>()\n\nconst dataChartRadar = ref()\nconst merge = inject(InjectionChartMerge, (v: any) => v, true)\nconst radarChartOptions = computed<EChartsOption>(() => {\n const { colDesc, xGroupByDesc, modelName, data } = chartData\n\n if (!xGroupByDesc?.groupByValues) {\n xGroupByDesc.groupByValues = []\n }\n xGroupByDesc.groupByValues = uniq(data.map((item) => {\n return item[xGroupByDesc.colDesc || ''] as string\n }).filter(v => v))\n\n const config = {\n title: {\n text: modelName,\n },\n radar: {\n indicator: xGroupByDesc?.groupByValues?.map((groupByValuesItem) => {\n return {\n name: groupByValuesItem,\n max: Math.max(...data.map(item => Number(item[colDesc[0]]))),\n }\n }) || [],\n },\n series: [{\n name: xGroupByDesc?.colDesc,\n type: 'radar',\n tooltip: {\n trigger: 'item',\n },\n data: colDesc.map(colDescItem => ({\n name: colDescItem,\n value: xGroupByDesc?.groupByValues?.map((groupByValuesItem) => {\n return (data.map((dataItem) => {\n if (groupByValuesItem === dataItem[xGroupByDesc.colDesc || '']) {\n return dataItem[colDescItem]\n }\n return null\n }).filter(v => v)).reduce((pre, cur) => Number(pre || 0) + Number(cur || 0), 0)\n }),\n })),\n }],\n }\n\n return merge(config, chartOptions)\n})\n\nconst { myChart } = useCharts({\n chartDOM: dataChartRadar,\n chartOptions: radarChartOptions,\n chartData: computed(() => chartData),\n lazyLoad\n})\n\n// 暴露 myChart 方法供父组件访问\ndefineExpose({\n myChart,\n})\n</script>\n\n<template>\n <div\n ref=\"dataChartRadar\"\n class=\"data-chart-radar\"\n />\n</template>\n\n<style scoped lang=\"scss\">\n.data-chart-radar {\n width: 100%;\n height: 100%;\n}\n</style>\n"],"names":["dataChartRadar","ref","merge","inject","InjectionChartMerge","v","radarChartOptions","computed","colDesc","xGroupByDesc","modelName","data","__props","chartData","groupByValues","uniq","map","item","filter","config","title","text","radar","indicator","groupByValuesItem","name","max","Math","Number","series","type","tooltip","trigger","colDescItem","value","dataItem","reduce","pre","cur","chartOptions","myChart","useCharts","chartDOM","lazyLoad","__expose","_createElementBlock","class"],"mappings":"0YAoBA,MAAMA,EAAiBC,EAAAA,MACjBC,EAAQC,EAAAA,OAAOC,EAAAA,oBAAsBC,GAAWA,GAAG,GACnDC,EAAoBC,EAAAA,SAAwB,KAChD,MAAMC,QAAEA,EAAAC,aAASA,EAAAC,UAAcA,EAAAC,KAAWA,GAASC,EAAAC,UAE9CJ,GAAcK,gBACjBL,EAAaK,cAAgB,IAE/BL,EAAaK,cAAgBC,EAAAA,KAAKJ,EAAKK,IAAKC,GACnCA,EAAKR,EAAaD,SAAW,KACnCU,OAAOb,GAAKA,IAEf,MAAMc,EAAS,CACbC,MAAO,CACLC,KAAMX,GAERY,MAAO,CACLC,UAAWd,GAAcK,eAAeE,IAAKQ,IACpC,CACLC,KAAMD,EACNE,IAAKC,KAAKD,OAAOf,EAAKK,IAAIC,GAAQW,OAAOX,EAAKT,EAAQ,WAEpD,IAERqB,OAAQ,CAAC,CACPJ,KAAMhB,GAAcD,QACpBsB,KAAM,QACNC,QAAS,CACPC,QAAS,QAEXrB,KAAMH,EAAQQ,IAAIiB,IAAA,CAChBR,KAAMQ,EACNC,MAAOzB,GAAcK,eAAeE,IAAKQ,GAC/Bb,EAAKK,IAAKmB,GACZX,IAAsBW,EAAS1B,EAAaD,SAAW,IAClD2B,EAASF,GAEX,MACNf,UAAYb,GAAI+B,OAAO,CAACC,EAAKC,IAAQV,OAAOS,GAAO,GAAKT,OAAOU,GAAO,GAAI,UAMrF,OAAOpC,EAAMiB,EAAQP,EAAA2B,iBAGjBC,QAAEA,GAAYC,YAAU,CAC5BC,SAAU1C,EACVuC,aAAcjC,EACdO,UAAWN,EAAAA,SAAS,IAAMK,EAAAC,WAC1B8B,SAAO/B,EAAA+B,kBAITC,EAAa,CACXJ,kCAKAK,EAAAA,mBAGE,MAAA,SAFI,iBAAJ5C,IAAID,EACJ8C,MAAM"}
1
+ {"version":3,"file":"radar.vue2.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/radar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { uniq } from 'lodash-es'\nimport { computed, inject, ref } from 'vue'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartRadar',\n})\n\nconst {\n chartData,\n chartOptions,\n lazyLoad = true,\n} = defineProps<{\n chartData: IFormatPublicData\n chartOptions: EChartsOption\n lazyLoad?: boolean\n}>()\n\nconst dataChartRadar = ref()\nconst merge = inject(InjectionChartMerge, (v: any) => v, true)\nconst radarChartOptions = computed<EChartsOption>(() => {\n const { colDesc, xGroupByDesc, modelName, data } = chartData\n\n if (!xGroupByDesc?.groupByValues) {\n xGroupByDesc.groupByValues = []\n }\n xGroupByDesc.groupByValues = uniq(data.map((item) => {\n return item[xGroupByDesc.colDesc || ''] as string\n }).filter(v => v))\n\n const config = {\n title: {\n text: modelName,\n },\n radar: {\n indicator: xGroupByDesc?.groupByValues?.map((groupByValuesItem) => {\n return {\n name: groupByValuesItem,\n max: Math.max(...data.map(item => Number(item[colDesc[0]]))),\n }\n }) || [],\n },\n series: [{\n name: xGroupByDesc?.colDesc,\n type: 'radar',\n tooltip: {\n trigger: 'item',\n },\n data: colDesc.map(colDescItem => ({\n name: colDescItem,\n value: xGroupByDesc?.groupByValues?.map((groupByValuesItem) => {\n return (data.map((dataItem) => {\n if (groupByValuesItem === dataItem[xGroupByDesc.colDesc || '']) {\n return dataItem[colDescItem]\n }\n return null\n }).filter(v => v)).reduce((pre, cur) => Number(pre || 0) + Number(cur || 0), 0)\n }),\n })),\n }],\n }\n\n return merge(config, chartOptions)\n})\n\nconst { myChart } = useCharts({\n chartDOM: dataChartRadar,\n chartOptions: radarChartOptions,\n chartData: computed(() => chartData),\n lazyLoad,\n})\n\n// 暴露 myChart 方法供父组件访问\ndefineExpose({\n myChart,\n})\n</script>\n\n<template>\n <div\n ref=\"dataChartRadar\"\n class=\"data-chart-radar\"\n />\n</template>\n\n<style scoped lang=\"scss\">\n.data-chart-radar {\n width: 100%;\n height: 100%;\n}\n</style>\n"],"names":["dataChartRadar","ref","merge","inject","InjectionChartMerge","v","radarChartOptions","computed","colDesc","xGroupByDesc","modelName","data","__props","chartData","groupByValues","uniq","map","item","filter","config","title","text","radar","indicator","groupByValuesItem","name","max","Math","Number","series","type","tooltip","trigger","colDescItem","value","dataItem","reduce","pre","cur","chartOptions","myChart","useCharts","chartDOM","lazyLoad","__expose","_createElementBlock","class"],"mappings":"0YAqBA,MAAMA,EAAiBC,EAAAA,MACjBC,EAAQC,EAAAA,OAAOC,EAAAA,oBAAsBC,GAAWA,GAAG,GACnDC,EAAoBC,EAAAA,SAAwB,KAChD,MAAMC,QAAEA,EAAAC,aAASA,EAAAC,UAAcA,EAAAC,KAAWA,GAASC,EAAAC,UAE9CJ,GAAcK,gBACjBL,EAAaK,cAAgB,IAE/BL,EAAaK,cAAgBC,EAAAA,KAAKJ,EAAKK,IAAKC,GACnCA,EAAKR,EAAaD,SAAW,KACnCU,OAAOb,GAAKA,IAEf,MAAMc,EAAS,CACbC,MAAO,CACLC,KAAMX,GAERY,MAAO,CACLC,UAAWd,GAAcK,eAAeE,IAAKQ,IACpC,CACLC,KAAMD,EACNE,IAAKC,KAAKD,OAAOf,EAAKK,IAAIC,GAAQW,OAAOX,EAAKT,EAAQ,WAEpD,IAERqB,OAAQ,CAAC,CACPJ,KAAMhB,GAAcD,QACpBsB,KAAM,QACNC,QAAS,CACPC,QAAS,QAEXrB,KAAMH,EAAQQ,IAAIiB,IAAA,CAChBR,KAAMQ,EACNC,MAAOzB,GAAcK,eAAeE,IAAKQ,GAC/Bb,EAAKK,IAAKmB,GACZX,IAAsBW,EAAS1B,EAAaD,SAAW,IAClD2B,EAASF,GAEX,MACNf,UAAYb,GAAI+B,OAAO,CAACC,EAAKC,IAAQV,OAAOS,GAAO,GAAKT,OAAOU,GAAO,GAAI,UAMrF,OAAOpC,EAAMiB,EAAQP,EAAA2B,iBAGjBC,QAAEA,GAAYC,YAAU,CAC5BC,SAAU1C,EACVuC,aAAcjC,EACdO,UAAWN,EAAAA,SAAS,IAAMK,EAAAC,WAC1B8B,SAAO/B,EAAA+B,kBAITC,EAAa,CACXJ,kCAKAK,EAAAA,mBAGE,MAAA,SAFI,iBAAJ5C,IAAID,EACJ8C,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"scatter-simple.vue2.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/scatter-simple.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartScatterSimple',\n})\nconst {\n chartData,\n chartOptions,\n lazyLoad = true,\n} = defineProps<{\n chartData: IFormatPublicData\n chartOptions: EChartsOption\n lazyLoad?: boolean\n}>()\nconst dataChartScatterSimple = ref()\nconst merge = inject(InjectionChartMerge, (v: any) => v, true)\n\nconst scatterChartOptions = computed<EChartsOption>(() => {\n const { colDesc, xGroupByDesc, modelName, data } = chartData\n const config = {\n title: {\n text: modelName,\n },\n tooltip: {\n formatter(params: { value: string, seriesName: string, name: string }) {\n if (params.value.length > 1) {\n return (\n `${params.seriesName\n } :<br/>${params.value[0]\n } ${params.value[1]\n } `\n )\n }\n else {\n return (\n `${params.seriesName\n } :<br/>${params.name\n } : ${params.value\n } `\n )\n }\n },\n },\n series: colDesc.map((colDescItem) => {\n return {\n symbolSize: 20,\n name: colDescItem,\n data: data.map((dataItem) => {\n return [dataItem[colDescItem], dataItem[xGroupByDesc?.colDesc || '']]\n }),\n type: 'scatter',\n }\n }),\n }\n return merge(config, chartOptions)\n})\n\nconst { myChart } = useCharts({\n chartDOM: dataChartScatterSimple,\n chartOptions: scatterChartOptions,\n chartData: computed(() => chartData),\n lazyLoad\n})\n\n// 暴露 myChart 方法供父组件访问\ndefineExpose({\n myChart,\n})\n</script>\n\n<template>\n <div\n ref=\"dataChartScatterSimple\"\n class=\"data-chart-scatter-simple\"\n />\n</template>\n\n<style scoped lang=\"scss\">\n.data-chart-scatter-simple {\n width: 100%;\n height: 100%;\n}\n</style>\n"],"names":["dataChartScatterSimple","ref","merge","inject","InjectionChartMerge","v","scatterChartOptions","computed","colDesc","xGroupByDesc","modelName","data","__props","chartData","config","title","text","tooltip","formatter","params","value","length","seriesName","name","series","map","colDescItem","symbolSize","dataItem","type","chartOptions","myChart","useCharts","chartDOM","lazyLoad","__expose","_createElementBlock","class"],"mappings":"oYAiBA,MAAMA,EAAyBC,EAAAA,MACzBC,EAAQC,EAAAA,OAAOC,EAAAA,oBAAsBC,GAAWA,GAAG,GAEnDC,EAAsBC,EAAAA,SAAwB,KAClD,MAAMC,QAAEA,EAAAC,aAASA,EAAAC,UAAcA,EAAAC,KAAWA,GAASC,EAAAC,UAC7CC,EAAS,CACbC,MAAO,CACLC,KAAMN,GAERO,QAAS,CACPC,UAAUC,GACJA,EAAOC,MAAMC,OAAS,EAEtB,GAAGF,EAAOG,oBACAH,EAAOC,MAAM,MACnBD,EAAOC,MAAM,MAMjB,GAAGD,EAAOG,oBACAH,EAAOI,UACXJ,EAAOC,UAMrBI,OAAQhB,EAAQiB,IAAKC,IACZ,CACLC,WAAY,GACZJ,KAAMG,EACNf,KAAMA,EAAKc,IAAKG,GACP,CAACA,EAASF,GAAcE,EAASnB,GAAcD,SAAW,MAEnEqB,KAAM,cAIZ,OAAO3B,EAAMY,EAAQF,EAAAkB,iBAGjBC,QAAEA,GAAYC,YAAU,CAC5BC,SAAUjC,EACV8B,aAAcxB,EACdO,UAAWN,EAAAA,SAAS,IAAMK,EAAAC,WAC1BqB,SAAOtB,EAAAsB,kBAITC,EAAa,CACXJ,kCAKAK,EAAAA,mBAGE,MAAA,SAFI,yBAAJnC,IAAID,EACJqC,MAAM"}
1
+ {"version":3,"file":"scatter-simple.vue2.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/scatter-simple.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { computed, inject, ref } from 'vue'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartScatterSimple',\n})\nconst {\n chartData,\n chartOptions,\n lazyLoad = true,\n} = defineProps<{\n chartData: IFormatPublicData\n chartOptions: EChartsOption\n lazyLoad?: boolean\n}>()\nconst dataChartScatterSimple = ref()\nconst merge = inject(InjectionChartMerge, (v: any) => v, true)\n\nconst scatterChartOptions = computed<EChartsOption>(() => {\n const { colDesc, xGroupByDesc, modelName, data } = chartData\n const config = {\n title: {\n text: modelName,\n },\n tooltip: {\n formatter(params: { value: string, seriesName: string, name: string }) {\n if (params.value.length > 1) {\n return (\n `${params.seriesName\n } :<br/>${params.value[0]\n } ${params.value[1]\n } `\n )\n }\n else {\n return (\n `${params.seriesName\n } :<br/>${params.name\n } : ${params.value\n } `\n )\n }\n },\n },\n series: colDesc.map((colDescItem) => {\n return {\n symbolSize: 20,\n name: colDescItem,\n data: data.map((dataItem) => {\n return [dataItem[colDescItem], dataItem[xGroupByDesc?.colDesc || '']]\n }),\n type: 'scatter',\n }\n }),\n }\n return merge(config, chartOptions)\n})\n\nconst { myChart } = useCharts({\n chartDOM: dataChartScatterSimple,\n chartOptions: scatterChartOptions,\n chartData: computed(() => chartData),\n lazyLoad,\n})\n\n// 暴露 myChart 方法供父组件访问\ndefineExpose({\n myChart,\n})\n</script>\n\n<template>\n <div\n ref=\"dataChartScatterSimple\"\n class=\"data-chart-scatter-simple\"\n />\n</template>\n\n<style scoped lang=\"scss\">\n.data-chart-scatter-simple {\n width: 100%;\n height: 100%;\n}\n</style>\n"],"names":["dataChartScatterSimple","ref","merge","inject","InjectionChartMerge","v","scatterChartOptions","computed","colDesc","xGroupByDesc","modelName","data","__props","chartData","config","title","text","tooltip","formatter","params","value","length","seriesName","name","series","map","colDescItem","symbolSize","dataItem","type","chartOptions","myChart","useCharts","chartDOM","lazyLoad","__expose","_createElementBlock","class"],"mappings":"oYAkBA,MAAMA,EAAyBC,EAAAA,MACzBC,EAAQC,EAAAA,OAAOC,EAAAA,oBAAsBC,GAAWA,GAAG,GAEnDC,EAAsBC,EAAAA,SAAwB,KAClD,MAAMC,QAAEA,EAAAC,aAASA,EAAAC,UAAcA,EAAAC,KAAWA,GAASC,EAAAC,UAC7CC,EAAS,CACbC,MAAO,CACLC,KAAMN,GAERO,QAAS,CACPC,UAAUC,GACJA,EAAOC,MAAMC,OAAS,EAEtB,GAAGF,EAAOG,oBACAH,EAAOC,MAAM,MACnBD,EAAOC,MAAM,MAMjB,GAAGD,EAAOG,oBACAH,EAAOI,UACXJ,EAAOC,UAMrBI,OAAQhB,EAAQiB,IAAKC,IACZ,CACLC,WAAY,GACZJ,KAAMG,EACNf,KAAMA,EAAKc,IAAKG,GACP,CAACA,EAASF,GAAcE,EAASnB,GAAcD,SAAW,MAEnEqB,KAAM,cAIZ,OAAO3B,EAAMY,EAAQF,EAAAkB,iBAGjBC,QAAEA,GAAYC,YAAU,CAC5BC,SAAUjC,EACV8B,aAAcxB,EACdO,UAAWN,EAAAA,SAAS,IAAMK,EAAAC,WAC1BqB,SAAOtB,EAAAsB,kBAITC,EAAa,CACXJ,kCAKAK,EAAAA,mBAGE,MAAA,SAFI,yBAAJnC,IAAID,EACJqC,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"scatter.vue2.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/scatter.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartScatter',\n})\n\nconst {\n chartData,\n chartOptions,\n lazyLoad = true,\n} = defineProps<{\n chartData: IFormatPublicData\n chartOptions: EChartsOption\n lazyLoad?: boolean\n}>()\n\nconst dataChartScatter = ref()\nconst merge = inject(InjectionChartMerge, (v: any) => v, true)\n\nconst scatterChartOptions = computed<EChartsOption>(() => {\n const config = {\n xAxis: {},\n yAxis: {},\n series: [\n {\n symbolSize: 20,\n data: [\n [10.0, 8.04],\n [8.07, 6.95],\n [13.0, 7.58],\n [9.05, 8.81],\n [11.0, 8.33],\n [14.0, 7.66],\n [13.4, 6.81],\n [10.0, 6.33],\n [14.0, 8.96],\n [12.5, 6.82],\n [9.15, 7.2],\n [11.5, 7.2],\n [3.03, 4.23],\n [12.2, 7.83],\n [2.02, 4.47],\n [1.05, 3.33],\n [4.05, 4.96],\n [6.03, 7.24],\n [12.0, 6.26],\n [12.0, 8.84],\n [7.08, 5.82],\n [5.02, 5.68],\n ],\n type: 'scatter',\n },\n ],\n }\n\n return merge(config, chartOptions)\n})\n\nconst { myChart } = useCharts({\n chartDOM: dataChartScatter,\n chartOptions: scatterChartOptions,\n chartData: computed(() => chartData),\n lazyLoad\n})\n\n// 暴露 myChart 方法供父组件访问\ndefineExpose({\n myChart,\n})\n</script>\n\n<template>\n <div\n ref=\"dataChartScatter\"\n class=\"data-chart-scatter\"\n />\n</template>\n\n<style scoped lang=\"scss\">\n.data-chart-scatter {\n width: 100%;\n height: 100%;\n}\n</style>\n"],"names":["dataChartScatter","ref","merge","inject","InjectionChartMerge","v","scatterChartOptions","computed","xAxis","yAxis","series","symbolSize","data","type","__props","chartOptions","myChart","useCharts","chartDOM","chartData","lazyLoad","__expose","_createElementBlock","class"],"mappings":"uXAmBA,MAAMA,EAAmBC,EAAAA,MACnBC,EAAQC,EAAAA,OAAOC,EAAAA,oBAAsBC,GAAWA,GAAG,GAEnDC,EAAsBC,EAAAA,SAAwB,IAoC3CL,EAnCQ,CACbM,MAAO,CAAA,EACPC,MAAO,CAAA,EACPC,OAAQ,CACN,CACEC,WAAY,GACZC,KAAM,CACJ,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,GAAM,MACP,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,GAAM,MACP,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,KACP,CAAC,KAAM,KACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,GAAM,MACP,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,OAETC,KAAM,aAKSC,EAAAC,gBAGjBC,QAAEA,GAAYC,YAAU,CAC5BC,SAAUlB,EACVe,aAAcT,EACda,UAAWZ,EAAAA,SAAS,IAAMO,EAAAK,WAC1BC,SAAON,EAAAM,kBAITC,EAAa,CACXL,kCAKAM,EAAAA,mBAGE,MAAA,SAFI,mBAAJrB,IAAID,EACJuB,MAAM"}
1
+ {"version":3,"file":"scatter.vue2.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/scatter.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { computed, inject, ref } from 'vue'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartScatter',\n})\n\nconst {\n chartData,\n chartOptions,\n lazyLoad = true,\n} = defineProps<{\n chartData: IFormatPublicData\n chartOptions: EChartsOption\n lazyLoad?: boolean\n}>()\n\nconst dataChartScatter = ref()\nconst merge = inject(InjectionChartMerge, (v: any) => v, true)\n\nconst scatterChartOptions = computed<EChartsOption>(() => {\n const config = {\n xAxis: {},\n yAxis: {},\n series: [\n {\n symbolSize: 20,\n data: [\n [10.0, 8.04],\n [8.07, 6.95],\n [13.0, 7.58],\n [9.05, 8.81],\n [11.0, 8.33],\n [14.0, 7.66],\n [13.4, 6.81],\n [10.0, 6.33],\n [14.0, 8.96],\n [12.5, 6.82],\n [9.15, 7.2],\n [11.5, 7.2],\n [3.03, 4.23],\n [12.2, 7.83],\n [2.02, 4.47],\n [1.05, 3.33],\n [4.05, 4.96],\n [6.03, 7.24],\n [12.0, 6.26],\n [12.0, 8.84],\n [7.08, 5.82],\n [5.02, 5.68],\n ],\n type: 'scatter',\n },\n ],\n }\n\n return merge(config, chartOptions)\n})\n\nconst { myChart } = useCharts({\n chartDOM: dataChartScatter,\n chartOptions: scatterChartOptions,\n chartData: computed(() => chartData),\n lazyLoad,\n})\n\n// 暴露 myChart 方法供父组件访问\ndefineExpose({\n myChart,\n})\n</script>\n\n<template>\n <div\n ref=\"dataChartScatter\"\n class=\"data-chart-scatter\"\n />\n</template>\n\n<style scoped lang=\"scss\">\n.data-chart-scatter {\n width: 100%;\n height: 100%;\n}\n</style>\n"],"names":["dataChartScatter","ref","merge","inject","InjectionChartMerge","v","scatterChartOptions","computed","xAxis","yAxis","series","symbolSize","data","type","__props","chartOptions","myChart","useCharts","chartDOM","chartData","lazyLoad","__expose","_createElementBlock","class"],"mappings":"uXAoBA,MAAMA,EAAmBC,EAAAA,MACnBC,EAAQC,EAAAA,OAAOC,EAAAA,oBAAsBC,GAAWA,GAAG,GAEnDC,EAAsBC,EAAAA,SAAwB,IAoC3CL,EAnCQ,CACbM,MAAO,CAAA,EACPC,MAAO,CAAA,EACPC,OAAQ,CACN,CACEC,WAAY,GACZC,KAAM,CACJ,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,GAAM,MACP,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,GAAM,MACP,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,KACP,CAAC,KAAM,KACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,GAAM,MACP,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,OAETC,KAAM,aAKSC,EAAAC,gBAGjBC,QAAEA,GAAYC,YAAU,CAC5BC,SAAUlB,EACVe,aAAcT,EACda,UAAWZ,EAAAA,SAAS,IAAMO,EAAAK,WAC1BC,SAAON,EAAAM,kBAITC,EAAa,CACXL,kCAKAM,EAAAA,mBAGE,MAAA,SAFI,mBAAJrB,IAAID,EACJuB,MAAM"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("element-plus/es");require("element-plus/es/components/base/style/index"),require("element-plus/es/components/table/style/index"),require("element-plus/es/components/table-column/style/index");var t=require("vue"),a=require("@qxs-bns/hooks"),l=require("./empty.vue.cjs");const o={key:0,class:"title"};var r=t.defineComponent({name:"DataChartTable",__name:"table",props:{chartData:{type:Object,default:()=>({colDesc:[],xGroupByDesc:[],data:[],modelName:""})}},setup(r){const c=r,n=a.useNamespace("data-chart"),s=t.computed(()=>c.chartData.groupByDesc.find(e=>!e.xAxis));function i(e){if(!e)return 100;const t=14*e.length+20+30;return t<100?100:t}return(a,c)=>{const p=e.ElTableColumn,u=e.ElTable;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass([t.unref(n).e("table")])},[r.chartData.modelName?(t.openBlock(),t.createElementBlock("p",o,[t.createElementVNode("span",null,t.toDisplayString(r.chartData.modelName),1)])):t.createCommentVNode("v-if",!0),t.createVNode(u,{class:"customize-table",data:r.chartData.data,stripe:"",height:"100%"},{empty:t.withCtx(()=>[t.createVNode(l.default)]),default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.chartData.groupByDesc,(e,a)=>(t.openBlock(),t.createBlock(p,{key:`${e.colDesc}${e.groupByDesc}${a}`,align:"center","show-overflow-tooltip":"",sortable:"","min-width":`${i(e.colDesc)}px`,prop:e.colDesc||""},{header:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.colDesc),1)]),default:t.withCtx(a=>[t.createTextVNode(t.toDisplayString((t.unref(s)&&(t.unref(s).colDesc,e.colDesc),a.row[e.colDesc||""]||"--")),1)]),_:2},1032,["min-width","prop"]))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.chartData.colDesc,(e,a)=>(t.openBlock(),t.createBlock(p,{key:e+a,align:"center","min-width":`${i(e)}px`,label:e,"show-overflow-tooltip":"",sortable:"",prop:e},{header:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e),1)]),_:2},1032,["min-width","label","prop"]))),128))]),_:1},8,["data"])],2)}}});exports.default=r;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("@qxs-bns/hooks"),a=require("./empty.vue.cjs");const o={key:0,class:"title"};var l=e.defineComponent({name:"DataChartTable",__name:"table",props:{chartData:{type:Object,default:()=>({colDesc:[],xGroupByDesc:[],data:[],modelName:""})}},setup(l){const r=l,c=t.useNamespace("data-chart"),n=e.computed(()=>r.chartData.groupByDesc.find(e=>!e.xAxis));function s(e){if(!e)return 100;const t=14*e.length+20+30;return t<100?100:t}return(t,r)=>{const i=e.resolveComponent("el-table-column"),p=e.resolveComponent("el-table");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(c).e("table")])},[l.chartData.modelName?(e.openBlock(),e.createElementBlock("p",o,[e.createElementVNode("span",null,e.toDisplayString(l.chartData.modelName),1)])):e.createCommentVNode("v-if",!0),e.createVNode(p,{class:"customize-table",data:l.chartData.data,stripe:"",height:"100%"},{empty:e.withCtx(()=>[e.createVNode(a.default)]),default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.chartData.groupByDesc,(t,a)=>(e.openBlock(),e.createBlock(i,{key:`${t.colDesc}${t.groupByDesc}${a}`,align:"center","show-overflow-tooltip":"",sortable:"","min-width":`${s(t.colDesc)}px`,prop:t.colDesc||""},{header:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.colDesc),1)]),default:e.withCtx(a=>[e.createTextVNode(e.toDisplayString((n.value&&(n.value.colDesc,t.colDesc),a.row[t.colDesc||""]||"--")),1)]),_:2},1032,["min-width","prop"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.chartData.colDesc,(t,a)=>(e.openBlock(),e.createBlock(i,{key:t+a,align:"center","min-width":`${s(t)}px`,label:t,"show-overflow-tooltip":"",sortable:"",prop:t},{header:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t),1)]),_:2},1032,["min-width","label","prop"]))),128))]),_:1},8,["data"])],2)}}});exports.default=l;
2
2
  //# sourceMappingURL=table.vue.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"table.vue.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/table.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { IFormatPublicData } from '../utils/types'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport Empty from './empty.vue'\n\ndefineOptions({\n name: 'DataChartTable',\n})\n\nconst props = defineProps({\n chartData: {\n type: Object as PropType<IFormatPublicData>,\n default: () => ({\n colDesc: [],\n xGroupByDesc: [],\n data: [],\n modelName: '',\n }),\n },\n})\n\nconst ns = useNamespace('data-chart')\n\nconst yGroupByDesc = computed(() => {\n const row = props.chartData.groupByDesc.find(item => !item.xAxis)\n return row\n})\n\nfunction baseWidth(str: string | null) {\n if (!str) {\n return 100\n }\n const strWidth = str.length * 14 + 20 + 30\n return strWidth < 100 ? 100 : strWidth\n}\n</script>\n\n<template>\n <div :class=\"[ns.e('table')]\">\n <p\n v-if=\"chartData.modelName\"\n class=\"title\"\n >\n <span>{{ chartData.modelName }}</span>\n </p>\n <el-table\n class=\"customize-table\"\n :data=\"chartData.data\"\n stripe\n height=\"100%\"\n >\n <el-table-column\n v-for=\"(item, index) in chartData.groupByDesc\"\n :key=\"`${item.colDesc}${item.groupByDesc}${index}`\"\n align=\"center\"\n show-overflow-tooltip\n sortable\n :min-width=\"`${baseWidth(item.colDesc)}px`\"\n :prop=\"item.colDesc || ''\"\n >\n <template #header>\n {{ item.colDesc }}\n </template>\n <template #default=\"scoped\">\n {{ (yGroupByDesc && yGroupByDesc.colDesc === item.colDesc ? scoped.row[item.colDesc || ''] : scoped.row[item.colDesc || '']) || '--' }}\n </template>\n </el-table-column>\n <el-table-column\n v-for=\"(item, index) in chartData.colDesc\"\n :key=\"item + index\"\n align=\"center\"\n :min-width=\"`${baseWidth(item)}px`\"\n :label=\"item\"\n show-overflow-tooltip\n sortable\n :prop=\"item\"\n >\n <template #header>\n {{ item }}\n </template>\n </el-table-column>\n <template #empty>\n <Empty />\n </template>\n </el-table>\n </div>\n</template>\n"],"names":["props","__props","ns","useNamespace","yGroupByDesc","computed","chartData","groupByDesc","find","item","xAxis","baseWidth","str","strWidth","length","_createElementBlock","class","_normalizeClass","_unref","e","modelName","_openBlock","_hoisted_1","_createElementVNode","_toDisplayString","_createVNode","_component_el_table","data","stripe","height","empty","Empty","_Fragment","index","_createBlock","_component_el_table_column","key","colDesc","align","sortable","prop","header","_createTextVNode","default","_withCtx","scoped","row","label"],"mappings":"siBAUA,MAAMA,EAAQC,EAYRC,EAAKC,EAAAA,aAAa,cAElBC,EAAeC,EAAAA,SAAS,IAChBL,EAAMM,UAAUC,YAAYC,KAAKC,IAASA,EAAKC,QAI7D,SAASC,EAAUC,GACjB,IAAKA,EACH,OAAO,IAET,MAAMC,EA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iBACT,IAAU,qCAAPhC,GAAI"}
1
+ {"version":3,"file":"table.vue.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/table.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { IFormatPublicData } from '../utils/types'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { computed } from 'vue'\nimport Empty from './empty.vue'\n\ndefineOptions({\n name: 'DataChartTable',\n})\n\nconst props = defineProps({\n chartData: {\n type: Object as PropType<IFormatPublicData>,\n default: () => ({\n colDesc: [],\n xGroupByDesc: [],\n data: [],\n modelName: '',\n }),\n },\n})\n\nconst ns = useNamespace('data-chart')\n\nconst yGroupByDesc = computed(() => {\n const row = props.chartData.groupByDesc.find(item => !item.xAxis)\n return row\n})\n\nfunction baseWidth(str: string | null) {\n if (!str) {\n return 100\n }\n const strWidth = str.length * 14 + 20 + 30\n return strWidth < 100 ? 100 : strWidth\n}\n</script>\n\n<template>\n <div :class=\"[ns.e('table')]\">\n <p\n v-if=\"chartData.modelName\"\n class=\"title\"\n >\n <span>{{ chartData.modelName }}</span>\n </p>\n <el-table\n class=\"customize-table\"\n :data=\"chartData.data\"\n stripe\n height=\"100%\"\n >\n <el-table-column\n v-for=\"(item, index) in chartData.groupByDesc\"\n :key=\"`${item.colDesc}${item.groupByDesc}${index}`\"\n align=\"center\"\n show-overflow-tooltip\n sortable\n :min-width=\"`${baseWidth(item.colDesc)}px`\"\n :prop=\"item.colDesc || ''\"\n >\n <template #header>\n {{ item.colDesc }}\n </template>\n <template #default=\"scoped\">\n {{ (yGroupByDesc && yGroupByDesc.colDesc === item.colDesc ? scoped.row[item.colDesc || ''] : scoped.row[item.colDesc || '']) || '--' }}\n </template>\n </el-table-column>\n <el-table-column\n v-for=\"(item, index) in chartData.colDesc\"\n :key=\"item + index\"\n align=\"center\"\n :min-width=\"`${baseWidth(item)}px`\"\n :label=\"item\"\n show-overflow-tooltip\n sortable\n :prop=\"item\"\n >\n <template #header>\n {{ item }}\n </template>\n </el-table-column>\n <template #empty>\n <Empty />\n </template>\n </el-table>\n </div>\n</template>\n"],"names":["props","__props","ns","useNamespace","yGroupByDesc","computed","chartData","groupByDesc","find","item","xAxis","baseWidth","str","strWidth","length","_createElementBlock","class","_normalizeClass","_unref","e","modelName","_openBlock","_hoisted_1","_createElementVNode","_toDisplayString","_createVNode","_component_el_table","data","stripe","height","empty","Empty","_Fragment","index","_createBlock","_component_el_table_column","key","colDesc","align","sortable","prop","header","_createTextVNode","default","_withCtx","scoped","value","row","label"],"mappings":"uVAWA,MAAMA,EAAQC,EAYRC,EAAKC,EAAAA,aAAa,cAElBC,EAAeC,EAAAA,SAAS,IAChBL,EAAMM,UAAUC,YAAYC,KAAKC,IAASA,EAAKC,QAI7D,SAASC,EAAUC,GACjB,IAAKA,EACH,OAAO,IAET,MAAMC,EAAwB,GAAbD,EAAIE,OAAc,GAAK,GACxC,OAAOD,EAAW,IAAM,IAAMA,CAChC,mHAIEE,EAAAA,mBA+CM,MAAA,CA/CAC,MAAKC,EAAAA,eAAA,CAAGC,EAAAA,MAAAhB,GAAGiB,EAAC,aAERlB,EAAAK,UAAUc,WADlBC,EAAAA,YAAAN,EAAAA,mBAKI,IALJO,EAKI,CADFC,EAAAA,mBAAsC,OAAA,KAAAC,kBAA7BvB,EAAAK,UAAUc,WAAS,sCAE9BK,EAAAA,YAuCWC,EAAA,CAtCTV,MAAM,kBACLW,KAAM1B,EAAAK,UAAUqB,KACjBC,OAAA,GACAC,OAAO,SAgCIC,gBACT,IAAS,CAATL,EAAAA,YAASM,EAAAA,6BA9BT,IAA8C,EADhDV,EAAAA,WAAA,GAAAN,EAAAA,mBAekBiB,EAAAA,2BAdQ/B,EAAAK,UAAUC,YAAW,CAArCE,EAAMwB,mBADhBC,EAAAA,YAekBC,EAAA,CAbfC,IAAG,GAAK3B,EAAK4B,UAAU5B,EAAKF,cAAc0B,IAC3CK,MAAM,SACN,wBAAA,GACAC,SAAA,GACC,YAAS,GAAK5B,EAAUF,EAAK4B,aAC7BG,KAAM/B,EAAK4B,SAAO,KAERI,iBACT,IAAkB,CAAfC,EAAAA,gBAAAlB,EAAAA,gBAAAf,EAAK4B,SAAO,KAENM,QAAOC,EAAAA,QACuHC,GAD/G,sCACpBzC,EAAA0C,QAAgB1C,QAAaiC,QAAY5B,EAAK4B,SAAUQ,EAAOE,IAAItC,EAAK4B,SAAO,KAAiC,OAAA,8CAGxHhB,EAAAA,WAAA,GAAAN,EAAAA,mBAakBiB,EAAAA,2BAZQ/B,EAAAK,UAAU+B,QAAO,CAAjC5B,EAAMwB,mBADhBC,EAAAA,YAakBC,EAAA,CAXfC,IAAK3B,EAAOwB,EACbK,MAAM,SACL,YAAS,GAAK3B,EAAUF,OACxBuC,MAAOvC,EACR,wBAAA,GACA8B,SAAA,GACCC,KAAM/B,IAEIgC,iBACT,IAAU,qCAAPhC,GAAI"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("@qxs-bns/hooks"),r=require("@qxs-bns/utils"),a=require("lodash-es"),s=require("./analyze.cjs"),o=require("./components/area.vue.cjs"),u=require("./components/bar.vue.cjs"),n=require("./components/card.vue.cjs"),c=require("./components/funnel.vue.cjs"),l=require("./components/line.vue.cjs"),i=require("./components/pie.vue.cjs"),p=require("./components/radar.vue.cjs"),d=require("./components/scatter-simple.vue.cjs"),y=require("./components/scatter.vue.cjs"),f=require("./components/table.vue.cjs"),m=require("./utils/config.cjs"),h=require("./utils/injectionKeys.cjs"),q=require("./utils/safe-eval.cjs"),j=require("./utils/types.cjs"),v=require("./utils/useCharts.cjs"),C=e.defineComponent({name:"QxsDataChart",__name:"data-chart",props:{modelName:{type:String,required:!1,default:""},showTypeName:{type:String,required:!1,default:"table"},subShowType:{type:String,required:!1},data:{type:Object,required:!1,default:()=>({data:[],desc:{colDesc:[],showDesc:{showType:0,chartOptions:"{}",jsCodeSnippet:""},groupByDesc:[]}})},chartOptions:{type:null,required:!1,default:()=>({})},jsCodeSnippet:{type:String,required:!1,default:""},lazyLoad:{type:Boolean,required:!1,default:!0}},setup(C,{expose:g}){const D=t.useNamespace("data-chart"),b=e.ref(null),x={analyze:s,config:m,types:j},w={table:f.default,bar:u.default,line:l.default,pie:i.default,radar:p.default,scatter:y.default,funnel:c.default,area:o.default,card:n.default,"scatter-simple":d.default},S=e.computed(()=>a.cloneDeep(m.defaultChartOption[C.showTypeName])),T=e.computed(()=>{const{desc:{colDesc:e=[],groupByDesc:t=[]}={},data:r=[]}=C.data;let a=[],s=null;const o=t;a=o?.map(e=>(e.xAxis&&(s=e),e))||[];const u=s&&s.colDesc?r.filter(e=>{const t=s.colDesc;return e&&t&&void 0!==e[t]&&null!==e[t]}):r;return{colDesc:e||[],modelName:C.modelName,subShowType:C.subShowType,xGroupByDesc:s||{colDesc:"",groupByDesc:"",groupByValues:[],xAxis:!1},groupByDesc:a,data:u}});function N(){if("table"===C.showTypeName)return null;const e=b.value;return e&&"function"==typeof e.myChart?e.myChart():null}return g({exportExal:function(){if(0===C.data.data.length)return void console.log("暂无数据");const e=v.useDataToExcelJson(C.data);r.JsonToExcel(C.modelName,e)},QxsDataChartConfig:x,myChart:e.computed(()=>N()),getMyChart:N}),e.provide(h.InjectionChartMerge,function(e,t){let r=a.merge({},S.value,e,t)||{};if(C.jsCodeSnippet)try{r=q.safeEvalConfig(C.jsCodeSnippet,r)}catch(e){console.error("代码执行失败:",e)}return r}),(t,r)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(w[t.showTypeName]),{ref_key:"myChartRef",ref:b,key:t.showTypeName,class:e.normalizeClass([e.unref(D).e("wrapper")]),"sub-show-type":t.subShowType,"chart-data":e.unref(T),"chart-options":t.chartOptions,"lazy-load":t.lazyLoad},null,8,["class","sub-show-type","chart-data","chart-options","lazy-load"]))}});exports.default=C;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("@qxs-bns/hooks"),r=require("@qxs-bns/utils"),a=require("lodash-es"),s=require("./analyze.cjs"),o=require("./components/area.vue.cjs"),u=require("./components/bar.vue.cjs"),n=require("./components/card.vue.cjs"),c=require("./components/funnel.vue.cjs"),l=require("./components/line.vue.cjs"),i=require("./components/pie.vue.cjs"),p=require("./components/radar.vue.cjs"),d=require("./components/scatter-simple.vue.cjs"),y=require("./components/scatter.vue.cjs"),f=require("./components/table.vue.cjs"),m=require("./utils/config.cjs"),h=require("./utils/injectionKeys.cjs"),q=require("./utils/safe-eval.cjs"),j=require("./utils/types.cjs"),v=require("./utils/useCharts.cjs"),C=e.defineComponent({name:"QxsDataChart",__name:"data-chart",props:{modelName:{type:String,required:!1,default:""},showTypeName:{type:String,required:!1,default:"table"},subShowType:{type:String,required:!1},data:{type:Object,required:!1,default:()=>({data:[],desc:{colDesc:[],showDesc:{showType:0,chartOptions:"{}",jsCodeSnippet:""},groupByDesc:[]}})},chartOptions:{type:null,required:!1,default:()=>({})},jsCodeSnippet:{type:String,required:!1,default:""},lazyLoad:{type:Boolean,required:!1,default:!0}},setup(C,{expose:g}){const D=t.useNamespace("data-chart"),b=e.ref(null),x={analyze:s,config:m,types:j},w={table:f.default,bar:u.default,line:l.default,pie:i.default,radar:p.default,scatter:y.default,funnel:c.default,area:o.default,card:n.default,"scatter-simple":d.default},S=e.computed(()=>a.cloneDeep(m.defaultChartOption[C.showTypeName])),T=e.computed(()=>{const{desc:{colDesc:e=[],groupByDesc:t=[]}={},data:r=[]}=C.data;let a=[],s=null;const o=t;a=o?.map(e=>(e.xAxis&&(s=e),e))||[];const u=s&&s.colDesc?r.filter(e=>{const t=s.colDesc;return e&&t&&void 0!==e[t]&&null!==e[t]}):r;return{colDesc:e||[],modelName:C.modelName,subShowType:C.subShowType,xGroupByDesc:s||{colDesc:"",groupByDesc:"",groupByValues:[],xAxis:!1},groupByDesc:a,data:u}});function N(){if("table"===C.showTypeName)return null;const e=b.value;return e&&"function"==typeof e.myChart?e.myChart():null}return g({exportExal:function(){if(0===C.data.data.length)return void console.log("暂无数据");const e=v.useDataToExcelJson(C.data);r.JsonToExcel(C.modelName,e)},QxsDataChartConfig:x,myChart:e.computed(()=>N()),getMyChart:N}),e.provide(h.InjectionChartMerge,function(e,t){let r=a.merge({},S.value,e,t)||{};if(C.jsCodeSnippet)try{r=q.safeEvalConfig(C.jsCodeSnippet,r)}catch(e){console.error("代码执行失败:",e)}return r}),(t,r)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(w[t.showTypeName]),{ref_key:"myChartRef",ref:b,key:t.showTypeName,class:e.normalizeClass([e.unref(D).e("wrapper")]),"sub-show-type":t.subShowType,"chart-data":T.value,"chart-options":t.chartOptions,"lazy-load":t.lazyLoad},null,8,["class","sub-show-type","chart-data","chart-options","lazy-load"]))}});exports.default=C;
2
2
  //# sourceMappingURL=data-chart.vue.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-chart.vue.cjs","sources":["../../../../../../packages/components/src/data-chart/src/data-chart.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartData, EChartsOption, IconRow, IFormatPublicData } from './utils/types'\nimport type { ECharts } from 'echarts'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { JsonToExcel } from '@qxs-bns/utils'\nimport { cloneDeep, merge as lodashMerge } from 'lodash-es'\nimport * as analyze from './analyze'\nimport Area from './components/area.vue'\nimport Bar from './components/bar.vue'\nimport Card from './components/card.vue'\nimport Funnel from './components/funnel.vue'\nimport Line from './components/line.vue'\nimport Pie from './components/pie.vue'\nimport Radar from './components/radar.vue'\nimport ScatterSimple from './components/scatter-simple.vue'\nimport Scatter from './components/scatter.vue'\nimport Table from './components/table.vue'\nimport * as config from './utils/config'\nimport { defaultChartOption } from './utils/config'\nimport { InjectionChartMerge } from './utils/injectionKeys'\nimport { safeEvalConfig } from './utils/safe-eval'\nimport * as types from './utils/types'\nimport { useDataToExcelJson } from './utils/useCharts'\n\ndefineOptions({\n name: 'QxsDataChart',\n})\nconst {\n showTypeName = 'table',\n subShowType,\n modelName = '',\n data: propData = {\n data: [],\n desc: {\n colDesc: [],\n showDesc: {\n showType: 0,\n chartOptions: '{}',\n jsCodeSnippet: '',\n },\n groupByDesc: [],\n },\n },\n chartOptions = {},\n jsCodeSnippet = '',\n lazyLoad = true,\n} = defineProps<{\n modelName?: string\n showTypeName?: IconRow['showTypeName']\n subShowType?: string\n data?: EChartData\n chartOptions?: EChartsOption\n jsCodeSnippet?: string\n lazyLoad?: boolean\n}>()\n\nconst ns = useNamespace('data-chart')\n\n// 子组件引用\nconst myChartRef = ref<any>(null)\n\nconst QxsDataChartConfig = {\n analyze,\n config,\n types,\n}\nconst coms: {\n [key: string]: any\n} = {\n 'table': Table,\n 'bar': Bar,\n 'line': Line,\n 'pie': Pie,\n 'radar': Radar,\n 'scatter': Scatter,\n 'funnel': Funnel,\n 'area': Area,\n 'card': Card,\n 'scatter-simple': ScatterSimple,\n}\n\nconst defaultChartOptionCopy = computed(() => {\n return cloneDeep(defaultChartOption[showTypeName])\n})\n\nconst formatPublicData = computed<IFormatPublicData>(() => {\n const { desc: { colDesc = [], groupByDesc = [] } = {}, data = [] } = propData\n\n // 处理 X 轴数据\n let xValue: EChartData['desc']['groupByDesc'] = []\n\n let xGroupByDesc: EChartData['desc']['groupByDesc'][0] | null = null\n const typedGroupByDesc = groupByDesc as EChartData['desc']['groupByDesc']\n xValue = typedGroupByDesc?.map((groupByDescItem) => {\n // if (groupByDescItem.colValues) {\n // groupByDescItem.colValuesDesc = {}\n // groupByDescItem.colValues.split(',')?.forEach((item) => {\n // const [key, value] = item.split(':')\n // groupByDescItem.colValuesDesc[key] = value\n // })\n // }\n if (groupByDescItem.xAxis) {\n xGroupByDesc = groupByDescItem\n }\n return groupByDescItem\n }) || []\n\n // 修复数据过滤逻辑,避免因为字段不存在导致数据被过滤掉\n const dataValue = xGroupByDesc && (xGroupByDesc as EChartData['desc']['groupByDesc'][0]).colDesc\n ? data.filter(item => {\n const colDescKey = (xGroupByDesc as EChartData['desc']['groupByDesc'][0]).colDesc\n return item && colDescKey && (item[colDescKey] !== undefined && item[colDescKey] !== null)\n })\n : data\n\n // if (xGroupByDesc && xGroupByDesc.colValuesDesc && Object.keys(xGroupByDesc.colValuesDesc).length) {\n // const { colDesc: colDescItem, colValuesDesc } = xGroupByDesc\n // console.log('colDesc: colDescItem, colValuesDesc: ', colDescItem, colValuesDesc)\n // dataValue = dataValue.map((item) => {\n // if (typeof item[colDescItem] === 'number') {\n // item[colDescItem] = colValuesDesc[item[colDescItem]]\n // }\n // return item\n // })\n // }\n\n const mergeConfig = {\n colDesc: colDesc || [],\n modelName,\n subShowType,\n xGroupByDesc: xGroupByDesc || {\n colDesc: '',\n groupByDesc: '',\n groupByValues: [],\n xAxis: false,\n },\n groupByDesc: xValue,\n data: dataValue,\n }\n return mergeConfig\n})\n\n// 导出数据\nfunction exportExal() {\n if (propData.data.length === 0) {\n // useMessage.error('暂无数据')\n console.log('暂无数据')\n return\n }\n const arr = useDataToExcelJson(propData)\n JsonToExcel(modelName, arr)\n}\nfunction merge(config: EChartsOption, defaultConfig: EChartsOption) {\n const mergeOpt = lodashMerge({}, defaultChartOptionCopy.value, config, defaultConfig)\n let conf = mergeOpt || {}\n\n if (jsCodeSnippet) {\n try {\n // 使用安全的配置处理函数\n conf = safeEvalConfig(jsCodeSnippet, conf)\n }\n catch (error) {\n console.error('代码执行失败:', error)\n }\n }\n\n return conf\n}\n\n// 获取内部 myChart 实例的方法\nfunction getMyChart(): ECharts | null {\n // 对于 table 类型,没有 myChart 实例\n if (showTypeName === 'table') {\n return null\n }\n\n // 尝试从子组件获取 myChart 实例\n const childComponent = myChartRef.value\n if (!childComponent) {\n return null\n }\n\n // 检查子组件是否有 myChart 方法(来自 useCharts)\n if (typeof childComponent.myChart === 'function') {\n return childComponent.myChart()\n }\n\n return null\n}\n\n// 为了保持向后兼容,提供 myChart 计算属性\nconst myChart = computed(() => getMyChart())\n\ndefineExpose({\n exportExal,\n QxsDataChartConfig,\n myChart,\n getMyChart,\n})\nprovide(InjectionChartMerge, merge)\n</script>\n\n<template>\n <component\n :is=\"coms[showTypeName]\"\n ref=\"myChartRef\"\n :key=\"showTypeName\"\n :class=\"[ns.e('wrapper')]\"\n :sub-show-type=\"subShowType\"\n :chart-data=\"formatPublicData\"\n :chart-options=\"chartOptions\"\n :lazy-load=\"lazyLoad\"\n />\n</template>\n"],"names":["ns","useNamespace","myChartRef","ref","QxsDataChartConfig","analyze","config","types","coms","table","Table","bar","Bar","line","Line","pie","Pie","radar","Radar","scatter","Scatter","funnel","Funnel","area","Area","card","Card","ScatterSimple","defaultChartOptionCopy","computed","cloneDeep","defaultChartOption","__props","formatPublicData","desc","colDesc","groupByDesc","data","xValue","xGroupByDesc","typedGroupByDesc","map","groupByDescItem","xAxis","dataValue","filter","item","colDescKey","modelName","subShowType","groupByValues","getMyChart","showTypeName","childComponent","value","myChart","__expose","exportExal","length","console","log","arr","useDataToExcelJson","JsonToExcel","provide","InjectionChartMerge","defaultConfig","conf","lodashMerge","jsCodeSnippet","safeEvalConfig","error","_createBlock","_resolveDynamicComponent","key","class","_normalizeClass","_unref","e","chartOptions","lazyLoad"],"mappings":"kxCAwDA,MAAMA,EAAKC,EAAAA,aAAa,cAGlBC,EAAaC,EAAAA,IAAS,MAEtBC,EAAqB,CACzBC,UACAC,SACAC,SAEIC,EAEF,CACFC,MAASC,EAAAA,QACTC,IAAOC,EAAAA,QACPC,KAAQC,EAAAA,QACRC,IAAOC,EAAAA,QACPC,MAASC,EAAAA,QACTC,QAAWC,EAAAA,QACXC,OAAUC,EAAAA,QACVC,KAAQC,EAAAA,QACRC,KAAQC,EAAAA,QACR,iBAAkBC,EAAAA,SAGdC,EAAyBC,EAAAA,SAAS,IAC/BC,YAAUC,EAAAA,mBAAmBC,kBAGhCC,EAAmBJ,EAAAA,SAA4B,KACnD,MAAQK,MAAMC,QAAEA,EAAU,eAAIC,EAAc,IAAO,CAAA,EAACC,KAAGA,EAAO,IAAOL,EAAAK,KAGrE,IAAIC,EAA4C,G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AAGC,EAAAA,MAAA7E,GAAG8E,EAAC,aACZ,gBAAe7B,EAAAA,YACf,aAAY4B,EAAAA,MAAA5C,GACZ,gBAAe8C,EAAAA,aACf,YAAWC,EAAAA"}
1
+ {"version":3,"file":"data-chart.vue.cjs","sources":["../../../../../../packages/components/src/data-chart/src/data-chart.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ECharts } from 'echarts'\nimport type { EChartData, EChartsOption, IconRow, IFormatPublicData } from './utils/types'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { JsonToExcel } from '@qxs-bns/utils'\nimport { cloneDeep, merge as lodashMerge } from 'lodash-es'\nimport { computed, provide, ref } from 'vue'\nimport * as analyze from './analyze'\nimport Area from './components/area.vue'\nimport Bar from './components/bar.vue'\nimport Card from './components/card.vue'\nimport Funnel from './components/funnel.vue'\nimport Line from './components/line.vue'\nimport Pie from './components/pie.vue'\nimport Radar from './components/radar.vue'\nimport ScatterSimple from './components/scatter-simple.vue'\nimport Scatter from './components/scatter.vue'\nimport Table from './components/table.vue'\nimport * as config from './utils/config'\nimport { defaultChartOption } from './utils/config'\nimport { InjectionChartMerge } from './utils/injectionKeys'\nimport { safeEvalConfig } from './utils/safe-eval'\nimport * as types from './utils/types'\nimport { useDataToExcelJson } from './utils/useCharts'\n\ndefineOptions({\n name: 'QxsDataChart',\n})\nconst {\n showTypeName = 'table',\n subShowType,\n modelName = '',\n data: propData = {\n data: [],\n desc: {\n colDesc: [],\n showDesc: {\n showType: 0,\n chartOptions: '{}',\n jsCodeSnippet: '',\n },\n groupByDesc: [],\n },\n },\n chartOptions = {},\n jsCodeSnippet = '',\n lazyLoad = true,\n} = defineProps<{\n modelName?: string\n showTypeName?: IconRow['showTypeName']\n subShowType?: string\n data?: EChartData\n chartOptions?: EChartsOption\n jsCodeSnippet?: string\n lazyLoad?: boolean\n}>()\n\nconst ns = useNamespace('data-chart')\n\n// 子组件引用\nconst myChartRef = ref<any>(null)\n\nconst QxsDataChartConfig = {\n analyze,\n config,\n types,\n}\nconst coms: {\n [key: string]: any\n} = {\n 'table': Table,\n 'bar': Bar,\n 'line': Line,\n 'pie': Pie,\n 'radar': Radar,\n 'scatter': Scatter,\n 'funnel': Funnel,\n 'area': Area,\n 'card': Card,\n 'scatter-simple': ScatterSimple,\n}\n\nconst defaultChartOptionCopy = computed(() => {\n return cloneDeep(defaultChartOption[showTypeName])\n})\n\nconst formatPublicData = computed<IFormatPublicData>(() => {\n const { desc: { colDesc = [], groupByDesc = [] } = {}, data = [] } = propData\n\n // 处理 X 轴数据\n let xValue: EChartData['desc']['groupByDesc'] = []\n\n let xGroupByDesc: EChartData['desc']['groupByDesc'][0] | null = null\n const typedGroupByDesc = groupByDesc as EChartData['desc']['groupByDesc']\n xValue = typedGroupByDesc?.map((groupByDescItem) => {\n // if (groupByDescItem.colValues) {\n // groupByDescItem.colValuesDesc = {}\n // groupByDescItem.colValues.split(',')?.forEach((item) => {\n // const [key, value] = item.split(':')\n // groupByDescItem.colValuesDesc[key] = value\n // })\n // }\n if (groupByDescItem.xAxis) {\n xGroupByDesc = groupByDescItem\n }\n return groupByDescItem\n }) || []\n\n // 修复数据过滤逻辑,避免因为字段不存在导致数据被过滤掉\n const dataValue = xGroupByDesc && (xGroupByDesc as EChartData['desc']['groupByDesc'][0]).colDesc\n ? data.filter((item) => {\n const colDescKey = (xGroupByDesc as EChartData['desc']['groupByDesc'][0]).colDesc\n return item && colDescKey && (item[colDescKey] !== undefined && item[colDescKey] !== null)\n })\n : data\n\n // if (xGroupByDesc && xGroupByDesc.colValuesDesc && Object.keys(xGroupByDesc.colValuesDesc).length) {\n // const { colDesc: colDescItem, colValuesDesc } = xGroupByDesc\n // console.log('colDesc: colDescItem, colValuesDesc: ', colDescItem, colValuesDesc)\n // dataValue = dataValue.map((item) => {\n // if (typeof item[colDescItem] === 'number') {\n // item[colDescItem] = colValuesDesc[item[colDescItem]]\n // }\n // return item\n // })\n // }\n\n const mergeConfig = {\n colDesc: colDesc || [],\n modelName,\n subShowType,\n xGroupByDesc: xGroupByDesc || {\n colDesc: '',\n groupByDesc: '',\n groupByValues: [],\n xAxis: false,\n },\n groupByDesc: xValue,\n data: dataValue,\n }\n return mergeConfig\n})\n\n// 导出数据\nfunction exportExal() {\n if (propData.data.length === 0) {\n // useMessage.error('暂无数据')\n console.log('暂无数据')\n return\n }\n const arr = useDataToExcelJson(propData)\n JsonToExcel(modelName, arr)\n}\nfunction merge(config: EChartsOption, defaultConfig: EChartsOption) {\n const mergeOpt = lodashMerge({}, defaultChartOptionCopy.value, config, defaultConfig)\n let conf = mergeOpt || {}\n\n if (jsCodeSnippet) {\n try {\n // 使用安全的配置处理函数\n conf = safeEvalConfig(jsCodeSnippet, conf)\n }\n catch (error) {\n console.error('代码执行失败:', error)\n }\n }\n\n return conf\n}\n\n// 获取内部 myChart 实例的方法\nfunction getMyChart(): ECharts | null {\n // 对于 table 类型,没有 myChart 实例\n if (showTypeName === 'table') {\n return null\n }\n\n // 尝试从子组件获取 myChart 实例\n const childComponent = myChartRef.value\n if (!childComponent) {\n return null\n }\n\n // 检查子组件是否有 myChart 方法(来自 useCharts)\n if (typeof childComponent.myChart === 'function') {\n return childComponent.myChart()\n }\n\n return null\n}\n\n// 为了保持向后兼容,提供 myChart 计算属性\nconst myChart = computed(() => getMyChart())\n\ndefineExpose({\n exportExal,\n QxsDataChartConfig,\n myChart,\n getMyChart,\n})\nprovide(InjectionChartMerge, merge)\n</script>\n\n<template>\n <component\n :is=\"coms[showTypeName]\"\n ref=\"myChartRef\"\n :key=\"showTypeName\"\n :class=\"[ns.e('wrapper')]\"\n :sub-show-type=\"subShowType\"\n :chart-data=\"formatPublicData\"\n :chart-options=\"chartOptions\"\n :lazy-load=\"lazyLoad\"\n />\n</template>\n"],"names":["ns","useNamespace","myChartRef","ref","QxsDataChartConfig","analyze","config","types","coms","table","Table","bar","Bar","line","Line","pie","Pie","radar","Radar","scatter","Scatter","funnel","Funnel","area","Area","card","Card","ScatterSimple","defaultChartOptionCopy","computed","cloneDeep","defaultChartOption","__props","formatPublicData","desc","colDesc","groupByDesc","data","xValue","xGroupByDesc","typedGroupByDesc","map","groupByDescItem","xAxis","dataValue","filter","item","colDescKey","modelName","subShowType","groupByValues","getMyChart","showTypeName","childComponent","value","myChart","__expose","exportExal","length","console","log","arr","useDataToExcelJson","JsonToExcel","provide","InjectionChartMerge","defaultConfig","conf","lodashMerge","jsCodeSnippet","safeEvalConfig","error","_createBlock","_resolveDynamicComponent","key","class","_normalizeClass","_unref","e","chartOptions","lazyLoad"],"mappings":"kxCAyDA,MAAMA,EAAKC,EAAAA,aAAa,cAGlBC,EAAaC,EAAAA,IAAS,MAEtBC,EAAqB,CACzBC,UACAC,SACAC,SAEIC,EAEF,CACFC,MAASC,EAAAA,QACTC,IAAOC,EAAAA,QACPC,KAAQC,EAAAA,QACRC,IAAOC,EAAAA,QACPC,MAASC,EAAAA,QACTC,QAAWC,EAAAA,QACXC,OAAUC,EAAAA,QACVC,KAAQC,EAAAA,QACRC,KAAQC,EAAAA,QACR,iBAAkBC,EAAAA,SAGdC,EAAyBC,EAAAA,SAAS,IAC/BC,YAAUC,EAAAA,mBAAmBC,kBAGhCC,EAAmBJ,EAAAA,SAA4B,KACnD,MAAQK,MAAMC,QAAEA,EAAU,eAAIC,EAAc,IAAO,CAAA,EAACC,KAAGA,EAAO,IAAOL,EAAAK,KAGrE,IAAIC,EAA4C,GAE5CC,EAA4D,KAChE,MAAMC,EAAmBJ,EACzBE,EAASE,GAAkBC,IAAKC,IAQ1BA,EAAgBC,QAClBJ,EAAeG,GAEVA,KACH,GAGN,MAAME,EAAYL,GAAiBA,EAAsDJ,QACrFE,EAAKQ,OAAQC,IACX,MAAMC,EAAcR,EAAsDJ,QAC1E,OAAOW,GAAQC,QAAoC,IAArBD,EAAKC,IAAkD,OAArBD,EAAKC,KAEvEV,EA0BJ,MAboB,CAClBF,QAASA,GAAW,GACpBa,UAAQhB,EAAAgB,UACRC,YAAUjB,EAAAiB,YACVV,aAAcA,GAAgB,CAC5BJ,QAAS,GACTC,YAAa,GACbc,cAAe,GACfP,OAAO,GAETP,YAAaE,EACbD,KAAMO,KAiCV,SAASO,IAEP,GAAqB,UAAjBnB,EAAAoB,aACF,OAAO,KAIT,MAAMC,EAAiBnD,EAAWoD,MAClC,OAAKD,GAKiC,mBAA3BA,EAAeE,QACjBF,EAAeE,UALf,IASX,QAKAC,EAAa,CACXC,WAnDF,WACE,GAA6B,IAAzBzB,OAASK,KAAKqB,OAGhB,YADAC,QAAQC,IAAI,QAGd,MAAMC,EAAMC,EAAAA,mBAAmB9B,EAAAK,MAC/B0B,cAAY/B,EAAAgB,UAAWa,EACzB,EA4CEzD,qBACAmD,QALc1B,EAAAA,SAAS,IAAMsB,KAM7BA,eAEFa,EAAAA,QAAQC,EAAAA,oBA/CR,SAAe3D,EAAuB4D,GAEpC,IAAIC,EADaC,EAAAA,MAAY,CAAA,EAAIxC,EAAuB0B,MAAOhD,EAAQ4D,IAChD,CAAA,EAEvB,GAAIlC,EAAAqC,cACF,IAEEF,EAAOG,EAAAA,eAAetC,gBAAemC,EACvC,OACOI,GACLZ,QAAQY,MAAM,UAAWA,EAC3B,CAGF,OAAOJ,CACT,yBAoCEK,cASEC,EAAAA,wBARKjE,EAAK4C,EAAAA,eAAY,SAClB,aAAJjD,IAAID,EACHwE,IAAKtB,EAAAA,aACLuB,MAAKC,EAAAA,eAAA,CAAGC,EAAAA,MAAA7E,GAAG8E,EAAC,aACZ,gBAAe7B,EAAAA,YACf,aAAYhB,EAAAqB,MACZ,gBAAeyB,EAAAA,aACf,YAAWC,EAAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("lodash-es"),t=require("echarts"),o=require("./mapData.cjs");function a(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(o){if("default"!==o){var a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,a.get?a:{enumerable:!0,get:function(){return e[o]}})}}),t.default=e,Object.freeze(t)}var i=a(t);const s={get:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"showTypeName",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"table";return s.data.find(o=>o[e].toString()===t||o[e]===t)},data:[{showTypeName:"table",label:"表格",coverImg:"table.png",disabled:()=>!1,subTypeList:[],showType:0,baseConfig:{}},{showTypeName:"line",label:"折线图",coverImg:"line-stack.png",showType:1,subTypeList:[{value:"line-simple",icon:"line-smooth",tooltipContent:"折线图"},{value:"area-basic",icon:"chart-line-area",tooltipContent:"折线面积图"}],baseConfig:{tooltip:{confine:!1,trigger:"axis",axisPointer:{type:"line"}},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},legend:{type:"scroll",top:"25px"},grid:{left:"0",bottom:"10px",containLabel:!0},xAxis:{type:"category",boundaryGap:!1},yAxis:{type:"value"},dataZoom:[{type:"inside"}]},disabled:(e,t)=>{const o=t?.length;return!(o>=1&&o<2)}},{showTypeName:"bar",label:"柱状图",coverImg:"bar-tick-align.png",showType:2,baseConfig:{legend:{type:"scroll",top:"25px"},tooltip:{confine:!1,trigger:"axis",axisPointer:{type:"shadow"}},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},grid:{left:"0",bottom:"20px",containLabel:!0},xAxis:{axisLabel:{showMaxLabel:!0},axisTick:{alignWithLabel:!0}},yAxis:{},dataZoom:[{type:"inside"}]},subTypeList:[{value:"bar-simple",icon:"bar-simple",tooltipContent:"垂直条形图"},{value:"bar-y-category",icon:"bar-y-category",tooltipContent:"水平条形图"}],disabled:(e,t)=>{const o=t?.length;return!(o>=1)}},{showTypeName:"pie",label:"饼图",coverImg:"pie-simple.png",showType:4,subTypeList:[{value:"pie-simple",icon:"pie-simple",tooltipContent:"饼图"},{value:"pie-borderRadius",icon:"pie-borderRadius",tooltipContent:"环形图"}],baseConfig:{tooltip:{confine:!0,formatter:"{a}<br>{b}: {c}({d}%)",trigger:"item"},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},legend:{type:"scroll",top:"25px"}},disabled:(e,t)=>{const o=t?.length,a=e?.length;return!(a<=4&&o>0&&o<=1)}},{showTypeName:"area",label:"地图",coverImg:"area.png",showType:5,subTypeList:[],baseConfig:{tooltip:{confine:!0,trigger:"item"},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},visualMap:{text:["高","低"],realtime:!1,calculable:!0,inRange:{color:["#E8F4FD","#B8D4F7","#7BA4F0","#4A7BE8","#3562e1"]}}},disabled:(e,t)=>{const o=t?.length,a=t?.some(e=>{let{colDesc:t}=e;return t.includes("省")||t.includes("市")});return!(a&&o>0)}},{showTypeName:"funnel",label:"漏斗图",coverImg:"funnel.png",showType:6,subTypeList:[],baseConfig:{tooltip:{confine:!0,trigger:"item",formatter:"{a} <br/>{b} : {c}"},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},legend:{type:"scroll",top:20}},disabled:(e,t)=>{const o=t?.length,a=e?.length;return!(a<=5&&o>0&&o<=1)}},{showTypeName:"card",label:"卡片",coverImg:"card.png",showType:9,subTypeList:[],baseConfig:{},disabled:(e,t)=>{const o=t?.length,a=e?.length;return!(a>0&&o<=1)}},{showTypeName:"radar",label:"雷达图",coverImg:"radar.png",showType:10,subTypeList:[],baseConfig:{legend:{type:"scroll",orient:"vertical",left:"left",top:"25px"},tooltip:{confine:!0,trigger:"item"},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},radar:{center:["50%","55%"]}},disabled:(e,t)=>{const o=t?.length;return 1!==o||1!==e.length}},{showTypeName:"scatter-simple",label:"散点图",coverImg:"",showType:11,subTypeList:[],disabled:()=>!1,baseConfig:{grid:{left:"0",bottom:"10px",containLabel:!0},tooltip:{showDelay:0,axisPointer:{show:!0,type:"cross",lineStyle:{type:"dashed",width:1}}},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},legend:{type:"scroll",top:"25px"},xAxis:{splitLine:{lineStyle:{type:"dashed"}}},yAxis:{splitLine:{lineStyle:{type:"dashed"}}}}}]};function n(t,o){const a={};return t.forEach(t=>{a[t.showTypeName]=e.merge(t.baseConfig,o)}),a}const l=n(s.data,{backgroundColor:"transparent",title:{textStyle:{fontSize:14,lineHeight:16}}}),r=new Map,p=()=>{try{const e=i.getMap("china");if(e&&e.geoJson)return e.geoJson}catch(e){console.warn("Failed to get builtin China map:",e)}return{type:"FeatureCollection",features:[]}};exports.defaultChartOption=l,exports.getGeoJsonData=function(e){let{adcode:t}=e,a="https://cdnfile.yaomaitong.cn/ksh/lib/geo-data";if("string"!=typeof t||t.match(/^\d{6}$/)||"中国"===t||"100000"===t||(t=o.getProvinceCode(t)),r.has(t)){const e=r.get(t);if(e)return Promise.resolve(e)}return new Promise(async e=>{try{if("中国"===t||"100000"===t)try{const o=await fetch(`${a}/china.json`);if(o.ok){const a=await o.json();return r.set(t,a),void e(a)}}catch(e){console.warn("Failed to load local China map data:",e)}if(o.isProvinceCode(t))try{const o=await fetch(`${a}/${t}.json`);if(o.ok){const a=await o.json();if(a&&a.features&&a.features.length>0)return r.set(t,a),void e(a)}}catch(e){console.warn("Failed to load local province map data:",e)}const i=p();r.set(t,i),e(i)}catch(o){console.error("All map data sources failed, using simple fallback:",o);const a=p();r.set(t,a),e(a)}})},exports.iconList=s,exports.setDefaultChartOption=n,exports.showTypeText=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return s.get("showType",e)};
1
+ "use strict";var e=require("echarts"),t=require("lodash-es"),o=require("./mapData.cjs");function a(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(o){if("default"!==o){var a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,a.get?a:{enumerable:!0,get:function(){return e[o]}})}}),t.default=e,Object.freeze(t)}var n=a(e);const s={get:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"showTypeName",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"table";return s.data.find(o=>o[e].toString()===t||o[e]===t)},data:[{showTypeName:"table",label:"表格",coverImg:"table.png",disabled:()=>!1,subTypeList:[],showType:0,baseConfig:{}},{showTypeName:"line",label:"折线图",coverImg:"line-stack.png",showType:1,subTypeList:[{value:"line-simple",icon:"line-smooth",tooltipContent:"折线图"},{value:"area-basic",icon:"chart-line-area",tooltipContent:"折线面积图"}],baseConfig:{tooltip:{confine:!1,trigger:"axis",axisPointer:{type:"line"}},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},legend:{type:"scroll",top:"25px"},grid:{left:"0",bottom:"10px",containLabel:!0},xAxis:{type:"category",boundaryGap:!1},yAxis:{type:"value"},dataZoom:[{type:"inside"}]},disabled:(e,t)=>{const o=t?.length;return!(o>=1&&o<2)}},{showTypeName:"bar",label:"柱状图",coverImg:"bar-tick-align.png",showType:2,baseConfig:{legend:{type:"scroll",top:"25px"},tooltip:{confine:!1,trigger:"axis",axisPointer:{type:"shadow"}},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},grid:{left:"0",bottom:"20px",containLabel:!0},xAxis:{axisLabel:{showMaxLabel:!0},axisTick:{alignWithLabel:!0}},yAxis:{},dataZoom:[{type:"inside"}]},subTypeList:[{value:"bar-simple",icon:"bar-simple",tooltipContent:"垂直条形图"},{value:"bar-y-category",icon:"bar-y-category",tooltipContent:"水平条形图"}],disabled:(e,t)=>{const o=t?.length;return!(o>=1)}},{showTypeName:"pie",label:"饼图",coverImg:"pie-simple.png",showType:4,subTypeList:[{value:"pie-simple",icon:"pie-simple",tooltipContent:"饼图"},{value:"pie-borderRadius",icon:"pie-borderRadius",tooltipContent:"环形图"}],baseConfig:{tooltip:{confine:!0,formatter:"{a}<br>{b}: {c}({d}%)",trigger:"item"},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},legend:{type:"scroll",top:"25px"}},disabled:(e,t)=>{const o=t?.length,a=e?.length;return!(a<=4&&o>0&&o<=1)}},{showTypeName:"area",label:"地图",coverImg:"area.png",showType:5,subTypeList:[],baseConfig:{tooltip:{confine:!0,trigger:"item"},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},visualMap:{text:["高","低"],realtime:!1,calculable:!0,inRange:{color:["#E8F4FD","#B8D4F7","#7BA4F0","#4A7BE8","#3562e1"]}}},disabled:(e,t)=>{const o=t?.length,a=t?.some(e=>{let{colDesc:t}=e;return t.includes("省")||t.includes("市")});return!(a&&o>0)}},{showTypeName:"funnel",label:"漏斗图",coverImg:"funnel.png",showType:6,subTypeList:[],baseConfig:{tooltip:{confine:!0,trigger:"item",formatter:"{a} <br/>{b} : {c}"},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},legend:{type:"scroll",top:20}},disabled:(e,t)=>{const o=t?.length,a=e?.length;return!(a<=5&&o>0&&o<=1)}},{showTypeName:"card",label:"卡片",coverImg:"card.png",showType:9,subTypeList:[],baseConfig:{},disabled:(e,t)=>{const o=t?.length,a=e?.length;return!(a>0&&o<=1)}},{showTypeName:"radar",label:"雷达图",coverImg:"radar.png",showType:10,subTypeList:[],baseConfig:{legend:{type:"scroll",orient:"vertical",left:"left",top:"25px"},tooltip:{confine:!0,trigger:"item"},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},radar:{center:["50%","55%"]}},disabled:(e,t)=>{const o=t?.length;return 1!==o||1!==e.length}},{showTypeName:"scatter-simple",label:"散点图",coverImg:"",showType:11,subTypeList:[],disabled:()=>!1,baseConfig:{grid:{left:"0",bottom:"10px",containLabel:!0},tooltip:{showDelay:0,axisPointer:{show:!0,type:"cross",lineStyle:{type:"dashed",width:1}}},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},legend:{type:"scroll",top:"25px"},xAxis:{splitLine:{lineStyle:{type:"dashed"}}},yAxis:{splitLine:{lineStyle:{type:"dashed"}}}}}]};function i(e,o){const a={};return e.forEach(e=>{a[e.showTypeName]=t.merge(e.baseConfig,o)}),a}const l=i(s.data,{backgroundColor:"transparent",title:{textStyle:{fontSize:14,lineHeight:16}}}),r=new Map;function c(){try{const e=n.getMap("china");if(e&&e.geoJson)return e.geoJson}catch(e){console.warn("Failed to get builtin China map:",e)}return{type:"FeatureCollection",features:[]}}exports.defaultChartOption=l,exports.getGeoJsonData=function(e){let{adcode:t}=e;const a="https://cdnfile.yaomaitong.cn/ksh/lib/geo-data";if("string"!=typeof t||t.match(/^\d{6}$/)||"中国"===t||"100000"===t||(t=o.getProvinceCode(t)),r.has(t)){const e=r.get(t);if(e)return Promise.resolve(e)}return(async()=>{try{if("中国"===t||"100000"===t)try{const e=await fetch(`${a}/china.json`);if(e.ok){const o=await e.json();return r.set(t,o),o}}catch(e){console.warn("Failed to load local China map data:",e)}if(o.isProvinceCode(t))try{const e=await fetch(`${a}/${t}.json`);if(e.ok){const o=await e.json();if(o&&o.features&&o.features.length>0)return r.set(t,o),o}}catch(e){console.warn("Failed to load local province map data:",e)}const e=c();return r.set(t,e),e}catch(e){console.error("All map data sources failed, using simple fallback:",e);const o=c();return r.set(t,o),o}})()},exports.iconList=s,exports.setDefaultChartOption=i,exports.showTypeText=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return s.get("showType",e)};
2
2
  //# sourceMappingURL=config.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/utils/config.ts"],"sourcesContent":["import type { GeoJson, IconRow, IGroupByInfos, ISelectInfos } from './types'\nimport { merge } from 'lodash-es'\nimport * as echarts from 'echarts'\nimport { getProvinceCode, isProvinceCode } from './mapData'\n\n/**\n * 禁用功能函数\n * 判断当前图表类型是否被禁用\n * 调用时机:渲染页面\n * @param {object} selectInfos 选择信息\n * @param {object} groupByInfos 分组信息\n * @param {Message[]|Message} data 数据\n * @returns Boolean 布尔值\n */\nexport const iconList: {\n data: IconRow[]\n get: (type: keyof IconRow, value: any) => IconRow\n} = {\n get: (type: keyof IconRow = 'showTypeName', value: any = 'table') => {\n return iconList.data.find(item => item[type].toString() === value || item[type] === value)!\n },\n data: [\n {\n showTypeName: 'table',\n label: '表格',\n coverImg: 'table.png',\n disabled: () => false,\n subTypeList: [],\n showType: 0,\n baseConfig: {},\n },\n {\n showTypeName: 'line',\n label: '折线图',\n coverImg: 'line-stack.png',\n showType: 1,\n subTypeList: [\n {\n value: 'line-simple',\n icon: 'line-smooth',\n tooltipContent: '折线图',\n },\n {\n value: 'area-basic',\n icon: 'chart-line-area',\n tooltipContent: '折线面积图',\n },\n ],\n baseConfig: {\n tooltip: {\n confine: false,\n trigger: 'axis',\n axisPointer: {\n type: 'line',\n },\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n },\n },\n legend: {\n type: 'scroll',\n top: '25px',\n },\n grid: {\n left: '0',\n bottom: '10px',\n containLabel: true,\n },\n xAxis: {\n type: 'category',\n boundaryGap: false,\n },\n yAxis: {\n type: 'value',\n },\n dataZoom: [\n {\n type: 'inside',\n },\n ],\n },\n disabled: (_: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n if (groupByInfosLenght >= 1 && groupByInfosLenght < 2) {\n return false\n }\n return true\n },\n },\n {\n showTypeName: 'bar',\n label: '柱状图',\n coverImg: 'bar-tick-align.png',\n showType: 2,\n baseConfig: {\n legend: {\n type: 'scroll',\n top: '25px',\n },\n tooltip: {\n confine: false,\n trigger: 'axis',\n axisPointer: {\n type: 'shadow',\n },\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n // myFull: { // 全屏\n // show: true,\n // title: '全屏',\n // icon: 'path://...',\n // }\n },\n },\n grid: {\n left: '0',\n bottom: '20px',\n containLabel: true,\n },\n xAxis: {\n axisLabel: {\n showMaxLabel: true,\n },\n axisTick: {\n alignWithLabel: true,\n },\n },\n yAxis: {},\n dataZoom: [\n {\n type: 'inside',\n },\n ],\n },\n subTypeList: [\n {\n value: 'bar-simple',\n icon: 'bar-simple',\n tooltipContent: '垂直条形图',\n },\n {\n value: 'bar-y-category',\n icon: 'bar-y-category',\n tooltipContent: '水平条形图',\n },\n ],\n disabled: (_: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n if (groupByInfosLenght >= 1) {\n return false\n }\n return true\n },\n },\n {\n showTypeName: 'pie',\n label: '饼图',\n coverImg: 'pie-simple.png',\n showType: 4,\n subTypeList: [\n {\n value: 'pie-simple',\n icon: 'pie-simple',\n tooltipContent: '饼图',\n },\n {\n value: 'pie-borderRadius',\n icon: 'pie-borderRadius',\n tooltipContent: '环形图',\n },\n ],\n baseConfig: {\n tooltip: {\n confine: true,\n formatter: '{a}<br>{b}: {c}({d}%)',\n trigger: 'item',\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n },\n },\n legend: {\n type: 'scroll',\n top: '25px',\n },\n },\n disabled: (selectInfos: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n const selectInfosLength = selectInfos?.length\n if (selectInfosLength <= 4 && groupByInfosLenght > 0 && groupByInfosLenght <= 1) {\n return false\n }\n return true\n },\n },\n {\n showTypeName: 'area',\n label: '地图',\n coverImg: 'area.png',\n showType: 5,\n subTypeList: [],\n baseConfig: {\n tooltip: {\n confine: true,\n trigger: 'item',\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n },\n },\n visualMap: {\n text: ['高', '低'],\n realtime: false,\n calculable: true,\n inRange: {\n color: ['#E8F4FD', '#B8D4F7', '#7BA4F0', '#4A7BE8', '#3562e1']\n },\n },\n },\n disabled: (_: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n const flag = groupByInfos?.some(({ colDesc }) => (colDesc.includes('省') || colDesc.includes('市')))\n if (flag && groupByInfosLenght > 0) {\n return false\n }\n return true\n },\n },\n {\n showTypeName: 'funnel',\n label: '漏斗图',\n coverImg: 'funnel.png',\n showType: 6,\n subTypeList: [],\n baseConfig: {\n tooltip: {\n confine: true,\n trigger: 'item',\n formatter: '{a} <br/>{b} : {c}',\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n },\n },\n legend: {\n type: 'scroll',\n top: 20,\n },\n },\n disabled: (selectInfos: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n const selectInfosLength = selectInfos?.length\n if (selectInfosLength <= 5 && groupByInfosLenght > 0 && groupByInfosLenght <= 1) {\n return false\n }\n return true\n },\n },\n\n // { label: 'scatter', value: 7 },\n {\n showTypeName: 'card',\n label: '卡片',\n coverImg: 'card.png',\n showType: 9,\n subTypeList: [],\n baseConfig: {},\n disabled: (selectInfos: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n const selectInfosLength = selectInfos?.length\n if (selectInfosLength > 0 && groupByInfosLenght <= 1) {\n return false\n }\n return true\n },\n },\n {\n showTypeName: 'radar',\n label: '雷达图',\n coverImg: 'radar.png',\n showType: 10,\n subTypeList: [],\n baseConfig: {\n legend: {\n type: 'scroll',\n orient: 'vertical',\n left: 'left',\n top: '25px',\n },\n tooltip: {\n confine: true,\n trigger: 'item',\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n },\n },\n radar: {\n // shape: 'circle',\n center: ['50%', '55%'],\n },\n },\n disabled: (selectInfos: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n if (groupByInfosLenght === 1 && selectInfos.length === 1) {\n return false\n }\n return true\n },\n },\n {\n showTypeName: 'scatter-simple',\n label: '散点图',\n coverImg: '',\n showType: 11,\n subTypeList: [],\n disabled: () => false,\n baseConfig: {\n grid: {\n left: '0',\n bottom: '10px',\n containLabel: true,\n },\n tooltip: {\n showDelay: 0,\n axisPointer: {\n show: true,\n type: 'cross',\n lineStyle: {\n type: 'dashed',\n width: 1,\n },\n },\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n },\n },\n legend: {\n type: 'scroll',\n top: '25px',\n },\n xAxis: {\n splitLine: {\n lineStyle: {\n type: 'dashed',\n },\n },\n },\n yAxis: {\n splitLine: {\n lineStyle: {\n type: 'dashed',\n },\n },\n },\n },\n },\n ],\n}\n\nexport function showTypeText(showType = 0): IconRow {\n const row = iconList.get('showType', showType)\n return row\n}\n\n// 修改默认配置\nexport function setDefaultChartOption(option: IconRow[], changeConfig: any) {\n const obj: {\n [key in IconRow['showTypeName']]: any\n } = {} as { [key in IconRow['showTypeName']]: any }\n option.forEach((item) => {\n obj[item.showTypeName] = merge(item.baseConfig, changeConfig)\n })\n return obj\n}\nexport const defaultChartOption = setDefaultChartOption(iconList.data, {\n backgroundColor: 'transparent',\n title: {\n textStyle: {\n fontSize: 14,\n lineHeight: 16,\n },\n },\n})\n// 获取地图数据(GeoJson)\n// 添加缓存对象\nconst geoJsonCache = new Map<string, GeoJson>()\n\n // 使用 ECharts 内置的中国地图数据\nconst getBuiltinChinaMap = (): GeoJson => {\n try {\n // 尝试获取 ECharts 内置的中国地图数据\n const chinaMap = echarts.getMap('china')\n if (chinaMap && chinaMap.geoJson) {\n return chinaMap.geoJson as GeoJson\n }\n }\n catch (error) {\n console.warn('Failed to get builtin China map:', error)\n }\n \n // 如果获取失败,返回空的地图数据\n return {\n type: 'FeatureCollection',\n features: [],\n } as GeoJson\n}\nexport function getGeoJsonData(options: any): Promise<GeoJson> {\n let { adcode } = options\n let baseUrl = 'https://cdnfile.yaomaitong.cn/ksh/lib/geo-data'\n\n // 如果传入的是省份名称,转换为代码\n if (typeof adcode === 'string' && !adcode.match(/^\\d{6}$/) && adcode !== '中国' && adcode !== '100000') {\n adcode = getProvinceCode(adcode)\n }\n\n // 检查缓存中是否存在对应的 GeoJSON 数据\n if (geoJsonCache.has(adcode)) {\n const cachedGeoJson = geoJsonCache.get(adcode)\n if (cachedGeoJson) {\n return Promise.resolve(cachedGeoJson)\n }\n }\n\n // 构建基础 URL\n return new Promise(async (resolve) => {\n try {\n // 方案1: 使用本地地图数据\n if (adcode === '中国' || adcode === '100000') {\n try {\n // 优先尝试本地中国地图数据\n const response = await fetch(`${baseUrl}/china.json`)\n if (response.ok) {\n const chinaData = await response.json()\n geoJsonCache.set(adcode, chinaData)\n resolve(chinaData)\n return\n }\n }\n catch (error) {\n console.warn('Failed to load local China map data:', error)\n }\n }\n\n // 方案2: 使用本地省级地图数据\n if (isProvinceCode(adcode)) {\n try {\n const response = await fetch(`${baseUrl}/${adcode}.json`)\n if (response.ok) {\n const geoJson = await response.json()\n if (geoJson && geoJson.features && geoJson.features.length > 0) {\n geoJsonCache.set(adcode, geoJson)\n resolve(geoJson)\n return\n }\n }\n }\n catch (error) {\n console.warn('Failed to load local province map data:', error)\n }\n }\n\n // 方案3: 使用内置的中国地图数据作为备用\n const builtinMap = getBuiltinChinaMap()\n geoJsonCache.set(adcode, builtinMap)\n resolve(builtinMap)\n }\n catch (error) {\n console.error('All map data sources failed, using simple fallback:', error)\n const builtinMap = getBuiltinChinaMap()\n geoJsonCache.set(adcode, builtinMap)\n resolve(builtinMap)\n }\n })\n}\n"],"names":["iconList","get","type","arguments","length","undefined","value","data","find","item","toString","showTypeName","label","coverImg","disabled","subTypeList","showType","baseConfig","icon","tooltipContent","tooltip","confine","trigger","axisPointer","toolbox","show","showTitle","feature","saveAsImage","legend","top","grid","left","bottom","containLabel","xAxis","boundaryGap","yAxis","dataZoom","_","groupByInfos","groupByInfosLenght","axisLabel","showMaxLabel","axisTick","alignWithLabel","formatter","selectInfos","selectInfosLength","visualMap","text","realtime","calculable","inRange","color","flag","some","_ref","colDesc","includes","orient","radar","center","showDelay","lineStyle","width","splitLine","setDefaultChartOption","option","changeConfig","obj","forEach","merge","defaultChartOption","backgroundColor","title","textStyle","fontSize","lineHeight","geoJsonCache","Map","getBuiltinChinaMap","chinaMap","echarts","getMap","geoJson","error","console","warn","features","options","adcode","baseUrl","match","getProvinceCode","has","cachedGeoJson","Promise","resolve","async","response","fetch","ok","chinaData","json","set","isProvinceCode","builtinMap"],"mappings":"oWAcO,MAAMA,EAGT,CACFC,IAAK,WAAgE,IAA/DC,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAsB,eAAgBG,yDAAa,QACvD,OAAON,EAASO,KAAKC,KAAKC,GAAQA,EAAKP,GAAMQ,aAAeJ,GAASG,EAAKP,KAAUI,EACtF,EACAC,KAAM,CACJ,CACEI,aAAc,QACdC,MAAO,KACPC,SAAU,YACVC,SAAUA,KAAM,EAChBC,YAAa,GACbC,SAAU,EACVC,WAAY,CAAA,GAEd,CACEN,aAAc,OACdC,MAAO,MACPC,SAAU,iBACVG,SAAU,EACVD,YAAa,CACX,CACET,MAAO,cACPY,KAAM,cACNC,eAAgB,OAElB,CACEb,MAAO,aACPY,KAAM,kBACNC,eAAgB,UAGpBF,WAAY,CACVG,QAAS,CACPC,SAAS,EACTC,QAAS,OACTC,YAAa,CACXrB,KAAM,SAGVsB,QAAS,CACPC,MAAM,EACNC,WAAW,EACXC,QAAS,CAGPC,YAAa,CAAA,IAGjBC,OAAQ,CACN3B,KAAM,SACN4B,IAAK,QAEPC,KAAM,CACJC,KAAM,IACNC,OAAQ,OACRC,cAAc,GAEhBC,MAAO,CACLjC,KAAM,WACNkC,aAAa,GAEfC,MAAO,CACLnC,KAAM,SAERoC,SAAU,CACR,CACEpC,KAAM,YAIZY,SAAUA,CAACyB,EAAmBC,KAC5B,MAAMC,EAAqBD,GAAcpC,OACzC,QAAIqC,GAAsB,GAAKA,EAAqB,KAMxD,CACE9B,aAAc,MACdC,MAAO,MACPC,SAAU,qBACVG,SAAU,EACVC,WAAY,CACVY,OAAQ,CACN3B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,CAGA,OAAO,IAAIC,QAAQE,UACjB,IAEE,GAAe,OAAXR,GAA8B,WAAXA,EACrB,IAEE,MAAMS,QAAiBC,MAAM,GAAGT,gBAChC,GAAIQ,EAASE,GAAI,CACf,MAAMC,QAAkBH,EAASI,OAGjC,OAFAzB,EAAa0B,IAAId,EAAQY,QACzBL,EAAQK,EAEV,CACF,OACOjB,GACLC,QAAQC,KAAK,uCAAwCF,EACvD,CAIF,GAAIoB,EAAAA,eAAef,GACjB,IACE,MAAMS,QAAiBC,MAAM,GAAGT,KAAWD,UAC3C,GAAIS,EAASE,GAAI,CACf,MAAMjB,QAAgBe,EAASI,OAC/B,GAAInB,GAAWA,EAAQI,UAAYJ,EAAQI,SAASrF,OAAS,EAG3D,OAFA2E,EAAa0B,IAAId,EAAQN,QACzBa,EAAQb,EAGZ,CACF,OACOC,GACLC,QAAQC,KAAK,0CAA2CF,EAC1D,CAIF,MAAMqB,EAAa1B,IACnBF,EAAa0B,IAAId,EAAQgB,GACzBT,EAAQS,EACV,OACOrB,GACLC,QAAQD,MAAM,sDAAuDA,GACrE,MAAMqB,EAAa1B,IACnBF,EAAa0B,IAAId,EAAQgB,GACzBT,EAAQS,EACV,GAEJ,0EAlHO,WAA6C,IAAvB3F,yDAAW,EAEtC,OADYhB,EAASC,IAAI,WAAYe,EAEvC"}
1
+ {"version":3,"file":"config.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/utils/config.ts"],"sourcesContent":["import type { GeoJson, IconRow, IGroupByInfos, ISelectInfos } from './types'\nimport * as echarts from 'echarts'\nimport { merge } from 'lodash-es'\nimport { getProvinceCode, isProvinceCode } from './mapData'\n\n/**\n * 禁用功能函数\n * 判断当前图表类型是否被禁用\n * 调用时机:渲染页面\n * @param {object} selectInfos 选择信息\n * @param {object} groupByInfos 分组信息\n * @param {Message[]|Message} data 数据\n * @returns Boolean 布尔值\n */\nexport const iconList: {\n data: IconRow[]\n get: (type: keyof IconRow, value: any) => IconRow\n} = {\n get: (type: keyof IconRow = 'showTypeName', value: any = 'table') => {\n return iconList.data.find(item => item[type].toString() === value || item[type] === value)!\n },\n data: [\n {\n showTypeName: 'table',\n label: '表格',\n coverImg: 'table.png',\n disabled: () => false,\n subTypeList: [],\n showType: 0,\n baseConfig: {},\n },\n {\n showTypeName: 'line',\n label: '折线图',\n coverImg: 'line-stack.png',\n showType: 1,\n subTypeList: [\n {\n value: 'line-simple',\n icon: 'line-smooth',\n tooltipContent: '折线图',\n },\n {\n value: 'area-basic',\n icon: 'chart-line-area',\n tooltipContent: '折线面积图',\n },\n ],\n baseConfig: {\n tooltip: {\n confine: false,\n trigger: 'axis',\n axisPointer: {\n type: 'line',\n },\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n },\n },\n legend: {\n type: 'scroll',\n top: '25px',\n },\n grid: {\n left: '0',\n bottom: '10px',\n containLabel: true,\n },\n xAxis: {\n type: 'category',\n boundaryGap: false,\n },\n yAxis: {\n type: 'value',\n },\n dataZoom: [\n {\n type: 'inside',\n },\n ],\n },\n disabled: (_: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n if (groupByInfosLenght >= 1 && groupByInfosLenght < 2) {\n return false\n }\n return true\n },\n },\n {\n showTypeName: 'bar',\n label: '柱状图',\n coverImg: 'bar-tick-align.png',\n showType: 2,\n baseConfig: {\n legend: {\n type: 'scroll',\n top: '25px',\n },\n tooltip: {\n confine: false,\n trigger: 'axis',\n axisPointer: {\n type: 'shadow',\n },\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n // myFull: { // 全屏\n // show: true,\n // title: '全屏',\n // icon: 'path://...',\n // }\n },\n },\n grid: {\n left: '0',\n bottom: '20px',\n containLabel: true,\n },\n xAxis: {\n axisLabel: {\n showMaxLabel: true,\n },\n axisTick: {\n alignWithLabel: true,\n },\n },\n yAxis: {},\n dataZoom: [\n {\n type: 'inside',\n },\n ],\n },\n subTypeList: [\n {\n value: 'bar-simple',\n icon: 'bar-simple',\n tooltipContent: '垂直条形图',\n },\n {\n value: 'bar-y-category',\n icon: 'bar-y-category',\n tooltipContent: '水平条形图',\n },\n ],\n disabled: (_: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n if (groupByInfosLenght >= 1) {\n return false\n }\n return true\n },\n },\n {\n showTypeName: 'pie',\n label: '饼图',\n coverImg: 'pie-simple.png',\n showType: 4,\n subTypeList: [\n {\n value: 'pie-simple',\n icon: 'pie-simple',\n tooltipContent: '饼图',\n },\n {\n value: 'pie-borderRadius',\n icon: 'pie-borderRadius',\n tooltipContent: '环形图',\n },\n ],\n baseConfig: {\n tooltip: {\n confine: true,\n formatter: '{a}<br>{b}: {c}({d}%)',\n trigger: 'item',\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n },\n },\n legend: {\n type: 'scroll',\n top: '25px',\n },\n },\n disabled: (selectInfos: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n const selectInfosLength = selectInfos?.length\n if (selectInfosLength <= 4 && groupByInfosLenght > 0 && groupByInfosLenght <= 1) {\n return false\n }\n return true\n },\n },\n {\n showTypeName: 'area',\n label: '地图',\n coverImg: 'area.png',\n showType: 5,\n subTypeList: [],\n baseConfig: {\n tooltip: {\n confine: true,\n trigger: 'item',\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n },\n },\n visualMap: {\n text: ['高', '低'],\n realtime: false,\n calculable: true,\n inRange: {\n color: ['#E8F4FD', '#B8D4F7', '#7BA4F0', '#4A7BE8', '#3562e1'],\n },\n },\n },\n disabled: (_: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n const flag = groupByInfos?.some(({ colDesc }) => (colDesc.includes('省') || colDesc.includes('市')))\n if (flag && groupByInfosLenght > 0) {\n return false\n }\n return true\n },\n },\n {\n showTypeName: 'funnel',\n label: '漏斗图',\n coverImg: 'funnel.png',\n showType: 6,\n subTypeList: [],\n baseConfig: {\n tooltip: {\n confine: true,\n trigger: 'item',\n formatter: '{a} <br/>{b} : {c}',\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n },\n },\n legend: {\n type: 'scroll',\n top: 20,\n },\n },\n disabled: (selectInfos: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n const selectInfosLength = selectInfos?.length\n if (selectInfosLength <= 5 && groupByInfosLenght > 0 && groupByInfosLenght <= 1) {\n return false\n }\n return true\n },\n },\n\n // { label: 'scatter', value: 7 },\n {\n showTypeName: 'card',\n label: '卡片',\n coverImg: 'card.png',\n showType: 9,\n subTypeList: [],\n baseConfig: {},\n disabled: (selectInfos: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n const selectInfosLength = selectInfos?.length\n if (selectInfosLength > 0 && groupByInfosLenght <= 1) {\n return false\n }\n return true\n },\n },\n {\n showTypeName: 'radar',\n label: '雷达图',\n coverImg: 'radar.png',\n showType: 10,\n subTypeList: [],\n baseConfig: {\n legend: {\n type: 'scroll',\n orient: 'vertical',\n left: 'left',\n top: '25px',\n },\n tooltip: {\n confine: true,\n trigger: 'item',\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n },\n },\n radar: {\n // shape: 'circle',\n center: ['50%', '55%'],\n },\n },\n disabled: (selectInfos: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n if (groupByInfosLenght === 1 && selectInfos.length === 1) {\n return false\n }\n return true\n },\n },\n {\n showTypeName: 'scatter-simple',\n label: '散点图',\n coverImg: '',\n showType: 11,\n subTypeList: [],\n disabled: () => false,\n baseConfig: {\n grid: {\n left: '0',\n bottom: '10px',\n containLabel: true,\n },\n tooltip: {\n showDelay: 0,\n axisPointer: {\n show: true,\n type: 'cross',\n lineStyle: {\n type: 'dashed',\n width: 1,\n },\n },\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n },\n },\n legend: {\n type: 'scroll',\n top: '25px',\n },\n xAxis: {\n splitLine: {\n lineStyle: {\n type: 'dashed',\n },\n },\n },\n yAxis: {\n splitLine: {\n lineStyle: {\n type: 'dashed',\n },\n },\n },\n },\n },\n ],\n}\n\nexport function showTypeText(showType = 0): IconRow {\n const row = iconList.get('showType', showType)\n return row\n}\n\n// 修改默认配置\nexport function setDefaultChartOption(option: IconRow[], changeConfig: any) {\n const obj: {\n [key in IconRow['showTypeName']]: any\n } = {} as { [key in IconRow['showTypeName']]: any }\n option.forEach((item) => {\n obj[item.showTypeName] = merge(item.baseConfig, changeConfig)\n })\n return obj\n}\nexport const defaultChartOption = setDefaultChartOption(iconList.data, {\n backgroundColor: 'transparent',\n title: {\n textStyle: {\n fontSize: 14,\n lineHeight: 16,\n },\n },\n})\n// 获取地图数据(GeoJson)\n// 添加缓存对象\nconst geoJsonCache = new Map<string, GeoJson>()\n\n// 使用 ECharts 内置的中国地图数据\nfunction getBuiltinChinaMap(): GeoJson {\n try {\n // 尝试获取 ECharts 内置的中国地图数据\n const chinaMap = echarts.getMap('china')\n if (chinaMap && chinaMap.geoJson) {\n return chinaMap.geoJson as GeoJson\n }\n }\n catch (error) {\n console.warn('Failed to get builtin China map:', error)\n }\n\n // 如果获取失败,返回空的地图数据\n return {\n type: 'FeatureCollection',\n features: [],\n } as GeoJson\n}\nexport function getGeoJsonData(options: any): Promise<GeoJson> {\n let { adcode } = options\n const baseUrl = 'https://cdnfile.yaomaitong.cn/ksh/lib/geo-data'\n\n // 如果传入的是省份名称,转换为代码\n if (typeof adcode === 'string' && !adcode.match(/^\\d{6}$/) && adcode !== '中国' && adcode !== '100000') {\n adcode = getProvinceCode(adcode)\n }\n\n // 检查缓存中是否存在对应的 GeoJSON 数据\n if (geoJsonCache.has(adcode)) {\n const cachedGeoJson = geoJsonCache.get(adcode)\n if (cachedGeoJson) {\n return Promise.resolve(cachedGeoJson)\n }\n }\n\n // 构建基础 URL\n return (async () => {\n try {\n // 方案1: 使用本地地图数据\n if (adcode === '中国' || adcode === '100000') {\n try {\n // 优先尝试本地中国地图数据\n const response = await fetch(`${baseUrl}/china.json`)\n if (response.ok) {\n const chinaData = await response.json()\n geoJsonCache.set(adcode, chinaData)\n return chinaData\n }\n }\n catch (error) {\n console.warn('Failed to load local China map data:', error)\n }\n }\n\n // 方案2: 使用本地省级地图数据\n if (isProvinceCode(adcode)) {\n try {\n const response = await fetch(`${baseUrl}/${adcode}.json`)\n if (response.ok) {\n const geoJson = await response.json()\n if (geoJson && geoJson.features && geoJson.features.length > 0) {\n geoJsonCache.set(adcode, geoJson)\n return geoJson\n }\n }\n }\n catch (error) {\n console.warn('Failed to load local province map data:', error)\n }\n }\n\n // 方案3: 使用内置的中国地图数据作为备用\n const builtinMap = getBuiltinChinaMap()\n geoJsonCache.set(adcode, builtinMap)\n return builtinMap\n }\n catch (error) {\n console.error('All map data sources failed, using simple fallback:', error)\n const builtinMap = getBuiltinChinaMap()\n geoJsonCache.set(adcode, builtinMap)\n return builtinMap\n }\n })()\n}\n"],"names":["iconList","get","type","arguments","length","undefined","value","data","find","item","toString","showTypeName","label","coverImg","disabled","subTypeList","showType","baseConfig","icon","tooltipContent","tooltip","confine","trigger","axisPointer","toolbox","show","showTitle","feature","saveAsImage","legend","top","grid","left","bottom","containLabel","xAxis","boundaryGap","yAxis","dataZoom","_","groupByInfos","groupByInfosLenght","axisLabel","showMaxLabel","axisTick","alignWithLabel","formatter","selectInfos","selectInfosLength","visualMap","text","realtime","calculable","inRange","color","flag","some","_ref","colDesc","includes","orient","radar","center","showDelay","lineStyle","width","splitLine","setDefaultChartOption","option","changeConfig","obj","forEach","merge","defaultChartOption","backgroundColor","title","textStyle","fontSize","lineHeight","geoJsonCache","Map","getBuiltinChinaMap","chinaMap","echarts","getMap","geoJson","error","console","warn","features","options","adcode","baseUrl","match","getProvinceCode","has","cachedGeoJson","Promise","resolve","response","fetch","ok","chinaData","json","set","isProvinceCode","builtinMap"],"mappings":"oWAcO,MAAMA,EAGT,CACFC,IAAK,WAAgE,IAA/DC,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAsB,eAAgBG,yDAAa,QACvD,OAAON,EAASO,KAAKC,KAAKC,GAAQA,EAAKP,GAAMQ,aAAeJ,GAASG,EAAKP,KAAUI,EACtF,EACAC,KAAM,CACJ,CACEI,aAAc,QACdC,MAAO,KACPC,SAAU,YACVC,SAAUA,KAAM,EAChBC,YAAa,GACbC,SAAU,EACVC,WAAY,CAAA,GAEd,CACEN,aAAc,OACdC,MAAO,MACPC,SAAU,iBACVG,SAAU,EACVD,YAAa,CACX,CACET,MAAO,cACPY,KAAM,cACNC,eAAgB,OAElB,CACEb,MAAO,aACPY,KAAM,kBACNC,eAAgB,UAGpBF,WAAY,CACVG,QAAS,CACPC,SAAS,EACTC,QAAS,OACTC,YAAa,CACXrB,KAAM,SAGVsB,QAAS,CACPC,MAAM,EACNC,WAAW,EACXC,QAAS,CAGPC,YAAa,CAAA,IAGjBC,OAAQ,CACN3B,KAAM,SACN4B,IAAK,QAEPC,KAAM,CACJC,KAAM,IACNC,OAAQ,OACRC,cAAc,GAEhBC,MAAO,CACLjC,KAAM,WACNkC,aAAa,GAEfC,MAAO,CACLnC,KAAM,SAERoC,SAAU,CACR,CACEpC,KAAM,YAIZY,SAAUA,CAACyB,EAAmBC,KAC5B,MAAMC,EAAqBD,GAAcpC,OACzC,QAAIqC,GAAsB,GAAKA,EAAqB,KAMxD,CACE9B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5B,MAAMK,EAAgBjB,EAAa9E,IAAI0F,GACvC,GAAIK,EACF,OAAOC,QAAQC,QAAQF,EAE3B,CAGA,MAAA,WACE,IAEE,GAAe,OAAXL,GAA8B,WAAXA,EACrB,IAEE,MAAMQ,QAAiBC,MAAM,GAAGR,gBAChC,GAAIO,EAASE,GAAI,CACf,MAAMC,QAAkBH,EAASI,OAEjC,OADAxB,EAAayB,IAAIb,EAAQW,GAClBA,CACT,CACF,OACOhB,GACLC,QAAQC,KAAK,uCAAwCF,EACvD,CAIF,GAAImB,EAAAA,eAAed,GACjB,IACE,MAAMQ,QAAiBC,MAAM,GAAGR,KAAWD,UAC3C,GAAIQ,EAASE,GAAI,CACf,MAAMhB,QAAgBc,EAASI,OAC/B,GAAIlB,GAAWA,EAAQI,UAAYJ,EAAQI,SAASrF,OAAS,EAE3D,OADA2E,EAAayB,IAAIb,EAAQN,GAClBA,CAEX,CACF,OACOC,GACLC,QAAQC,KAAK,0CAA2CF,EAC1D,CAIF,MAAMoB,EAAazB,IAEnB,OADAF,EAAayB,IAAIb,EAAQe,GAClBA,CACT,OACOpB,GACLC,QAAQD,MAAM,sDAAuDA,GACrE,MAAMoB,EAAazB,IAEnB,OADAF,EAAayB,IAAIb,EAAQe,GAClBA,CACT,CACF,EA9CA,EA+CF,0EAhHO,WAA6C,IAAvB1F,yDAAW,EAEtC,OADYhB,EAASC,IAAI,WAAYe,EAEvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"mapData.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/utils/mapData.ts"],"sourcesContent":["// 免费的地图数据源\nexport const FREE_MAP_SOURCES = {\n // 省级地图数据源\n PROVINCE: {\n // 使用天地图省级数据\n TIANDITU: () => `https://api.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=你的天地图token`,\n // 使用 DataV 的省级数据\n DATAV: (adcode: string) => `https://geo.datav.aliyun.com/areas_v3/bound/${adcode}_full.json`,\n },\n // 天地图行政区划数据\n TIANDITU_ADMIN: {\n // 获取行政区划边界数据\n BOUNDARY: (adcode: string) => `https://api.tianditu.gov.cn/administrative?postStr={\"searchWord\":\"${adcode}\",\"searchType\":\"11\",\"needSubInfo\":true,\"needAll\":true,\"needPolygon\":true,\"needPre\":true}&type=query&tk=你的天地图token`,\n },\n}\n\n// 中国地图数据 - 使用真实的省级边界数据\nexport const CHINA_MAP_DATA = {\n type: 'FeatureCollection',\n features: [\n // 这里应该包含所有省份的边界数据\n // 由于数据量很大,建议使用外部数据源\n ]\n}\n\n// 获取中国地图数据的函数\nexport async function getChinaMapData(): Promise<any> {\n try {\n // 优先使用 DataV 的中国地图数据\n const response = await fetch('https://geo.datav.aliyun.com/areas_v3/bound/100000_full.json')\n if (response.ok) {\n return await response.json()\n }\n }\n catch (error) {\n console.warn('Failed to fetch China map from DataV:', error)\n }\n\n // 备用方案:使用简化的地图数据\n return {\n type: 'FeatureCollection',\n features: [\n {\n type: 'Feature',\n properties: {\n name: '中国',\n adcode: '100000',\n },\n geometry: {\n type: 'Polygon',\n coordinates: [[\n [73.66, 35.42], [78.91, 35.42], [81.33, 36.08], [85.29, 36.08], \n [88.02, 35.42], [90.16, 35.42], [92.13, 34.76], [94.81, 34.76], \n [97.06, 33.44], [99.43, 32.78], [101.06, 31.46], [102.73, 30.14], \n [104.40, 28.82], [106.07, 27.50], [107.74, 26.18], [109.41, 24.86], \n [111.08, 23.54], [112.75, 22.22], [114.42, 20.90], [116.09, 19.58], \n [117.76, 18.26], [119.43, 16.94], [121.10, 15.62], [122.77, 14.30], \n [124.44, 12.98], [126.11, 11.66], [127.78, 10.34], [129.45, 9.02], \n [131.12, 7.70], [132.79, 6.38], [134.46, 5.06], [135.05, 4.40], \n [135.05, 5.06], [135.05, 6.38], [135.05, 7.70], [135.05, 9.02], \n [135.05, 10.34], [135.05, 11.66], [135.05, 12.98], [135.05, 14.30], \n [135.05, 15.62], [135.05, 16.94], [135.05, 18.26], [135.05, 19.58], \n [135.05, 20.90], [135.05, 22.22], [135.05, 23.54], [135.05, 24.86], \n [135.05, 26.18], [135.05, 27.50], [135.05, 28.82], [135.05, 30.14], \n [135.05, 31.46], [135.05, 32.78], [135.05, 34.10], [135.05, 35.42], \n [134.46, 36.08], [133.79, 36.74], [133.12, 37.40], [132.45, 38.06], \n [131.78, 38.72], [131.11, 39.38], [130.44, 40.04], [129.77, 40.70], \n [129.10, 41.36], [128.43, 42.02], [127.76, 42.68], [127.09, 43.34], \n [126.42, 44.00], [125.75, 44.66], [125.08, 45.32], [124.41, 45.98], \n [123.74, 46.64], [123.07, 47.30], [122.40, 47.96], [121.73, 48.62], \n [121.06, 49.28], [120.39, 49.94], [119.72, 50.60], [119.05, 51.26], \n [118.38, 51.92], [117.71, 52.58], [117.04, 53.24], [116.37, 53.90], \n [115.70, 54.56], [115.03, 55.22], [114.36, 55.88], [113.69, 56.54], \n [113.02, 57.20], [112.35, 57.86], [111.68, 58.52], [111.01, 59.18], \n [110.34, 59.84], [109.67, 60.50], [109.00, 61.16], [108.33, 61.82], \n [107.66, 62.48], [106.99, 63.14], [106.32, 63.80], [105.65, 64.46], \n [104.98, 65.12], [104.31, 65.78], [103.64, 66.44], [102.97, 67.10], \n [102.30, 67.76], [101.63, 68.42], [100.96, 69.08], [100.29, 69.74], \n [99.62, 70.40], [98.95, 71.06], [98.28, 71.72], [97.61, 72.38], \n [96.94, 73.04], [96.27, 73.70], [95.60, 74.36], [94.93, 75.02], \n [94.26, 75.68], [93.59, 76.34], [92.92, 77.00], [92.25, 77.66], \n [91.58, 78.32], [90.91, 78.98], [90.24, 79.64], [89.57, 80.30], \n [88.90, 80.96], [88.23, 81.62], [87.56, 82.28], [86.89, 82.94], \n [86.22, 83.60], [85.55, 84.26], [84.88, 84.92], [84.21, 85.58], \n [83.54, 86.24], [82.87, 86.90], [82.20, 87.56], [81.53, 88.22], \n [80.86, 88.88], [80.19, 89.54], [79.52, 90.20], [78.85, 90.86], \n [78.18, 91.52], [77.51, 92.18], [76.84, 92.84], [76.17, 93.50], \n [75.50, 94.16], [74.83, 94.82], [74.16, 95.48], [73.66, 96.14], \n [73.66, 95.48], [73.66, 94.82], [73.66, 94.16], [73.66, 93.50], \n [73.66, 92.84], [73.66, 92.18], [73.66, 91.52], [73.66, 90.86], \n [73.66, 90.20], [73.66, 89.54], [73.66, 88.88], [73.66, 88.22], \n [73.66, 87.56], [73.66, 86.90], [73.66, 86.24], [73.66, 85.58], \n [73.66, 84.92], [73.66, 84.26], [73.66, 83.60], [73.66, 82.94], \n [73.66, 82.28], [73.66, 81.62], [73.66, 80.96], [73.66, 80.30], \n [73.66, 79.64], [73.66, 78.98], [73.66, 78.32], [73.66, 77.66], \n [73.66, 77.00], [73.66, 76.34], [73.66, 75.68], [73.66, 75.02], \n [73.66, 74.36], [73.66, 73.70], [73.66, 73.04], [73.66, 72.38], \n [73.66, 71.72], [73.66, 71.06], [73.66, 70.40], [73.66, 69.74], \n [73.66, 69.08], [73.66, 68.42], [73.66, 67.76], [73.66, 67.10], \n [73.66, 66.44], [73.66, 65.78], [73.66, 65.12], [73.66, 64.46], \n [73.66, 63.80], [73.66, 63.14], [73.66, 62.48], [73.66, 61.82], \n [73.66, 61.16], [73.66, 60.50], [73.66, 59.84], [73.66, 59.18], \n [73.66, 58.52], [73.66, 57.86], [73.66, 57.20], [73.66, 56.54], \n [73.66, 55.88], [73.66, 55.22], [73.66, 54.56], [73.66, 53.90], \n [73.66, 53.24], [73.66, 52.58], [73.66, 51.92], [73.66, 51.26], \n [73.66, 50.60], [73.66, 49.94], [73.66, 49.28], [73.66, 48.62], \n [73.66, 47.96], [73.66, 47.30], [73.66, 46.64], [73.66, 45.98], \n [73.66, 45.32], [73.66, 44.66], [73.66, 44.00], [73.66, 43.34], \n [73.66, 42.68], [73.66, 42.02], [73.66, 41.36], [73.66, 40.70], \n [73.66, 40.04], [73.66, 39.38], [73.66, 38.72], [73.66, 38.06], \n [73.66, 37.40], [73.66, 36.74], [73.66, 36.08], [73.66, 35.42]\n ]],\n },\n },\n ],\n }\n}\n\n\n\n// 省级行政区代码映射\nexport const PROVINCE_CODES = {\n '北京市': '110000',\n '天津市': '120000',\n '河北省': '130000',\n '山西省': '140000',\n '内蒙古自治区': '150000',\n '辽宁省': '210000',\n '吉林省': '220000',\n '黑龙江省': '230000',\n '上海市': '310000',\n '江苏省': '320000',\n '浙江省': '330000',\n '安徽省': '340000',\n '福建省': '350000',\n '江西省': '360000',\n '山东省': '370000',\n '河南省': '410000',\n '湖北省': '420000',\n '湖南省': '430000',\n '广东省': '440000',\n '广西壮族自治区': '450000',\n '海南省': '460000',\n '重庆市': '500000',\n '四川省': '510000',\n '贵州省': '520000',\n '云南省': '530000',\n '西藏自治区': '540000',\n '陕西省': '610000',\n '甘肃省': '620000',\n '青海省': '630000',\n '宁夏回族自治区': '640000',\n '新疆维吾尔自治区': '650000',\n '台湾省': '710000',\n '香港特别行政区': '810000',\n '澳门特别行政区': '820000',\n}\n\n// 省级名称映射(反向查找)\nexport const PROVINCE_NAMES = Object.fromEntries(\n Object.entries(PROVINCE_CODES).map(([name, code]) => [code, name])\n)\n\n// 获取省级代码\nexport function getProvinceCode(provinceName: string): string {\n return PROVINCE_CODES[provinceName as keyof typeof PROVINCE_CODES] || '100000'\n}\n\n// 获取省级名称\nexport function getProvinceName(provinceCode: string): string {\n return PROVINCE_NAMES[provinceCode] || '中国'\n}\n\n// 判断是否为省级代码\nexport function isProvinceCode(code: string): boolean {\n return /^\\d{6}$/.test(code) && code !== '100000'\n}\n\n// 获取省级地图数据\nexport async function getProvinceMapData(provinceName: string): Promise<any> {\n const provinceCode = getProvinceCode(provinceName)\n \n try {\n const url = `https://geo.datav.aliyun.com/areas_v3/bound/${provinceCode}_full.json`\n \n const response = await fetch(url)\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n \n const data = await response.json()\n return data\n }\n catch (error) {\n console.error('Failed to fetch province map data for:', provinceName, error)\n throw error\n }\n}\n\n// 天地图配置\nexport const TIANDITU_CONFIG = {\n // 天地图 token(需要申请)\n TOKEN: '你的天地图token', // 请替换为您的天地图 token\n // 天地图 API 基础 URL\n BASE_URL: 'https://api.tianditu.gov.cn',\n}\n\n// 获取天地图行政区划数据\nexport async function fetchTiandituBoundary(adcode: string): Promise<any> {\n try {\n const url = FREE_MAP_SOURCES.TIANDITU_ADMIN.BOUNDARY(adcode).replace('你的天地图token', TIANDITU_CONFIG.TOKEN)\n const response = await fetch(url)\n \n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n \n const data = await response.json()\n return data\n }\n catch (error) {\n console.error('Failed to fetch Tianditu boundary data:', error)\n throw error\n }\n}\n\n// 获取地图数据的函数\nexport async function fetchMapData(adcode: string): Promise<any> {\n try {\n // 优先尝试从天地图获取数据\n if (TIANDITU_CONFIG.TOKEN !== '你的天地图token') {\n try {\n const tiandituData = await fetchTiandituBoundary(adcode)\n if (tiandituData && tiandituData.data && tiandituData.data.length > 0) {\n // 转换天地图数据为 GeoJSON 格式\n return convertTiandituToGeoJson(tiandituData)\n }\n }\n catch (error) {\n console.warn('Failed to fetch from Tianditu, trying DataV:', error)\n }\n }\n\n // 备用方案:从 DataV 获取数据\n const url = FREE_MAP_SOURCES.PROVINCE.DATAV(adcode)\n console.log('Fetching province map data from:', url)\n const response = await fetch(url)\n \n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n \n const data = await response.json()\n console.log('Successfully fetched province map data for:', adcode, data)\n return data\n }\n catch (error) {\n console.error('Failed to fetch map data for adcode:', adcode, error)\n throw error\n }\n}\n\n// 转换天地图数据为 GeoJSON 格式\nfunction convertTiandituToGeoJson(tiandituData: any): any {\n const features = tiandituData.data.map((item: any) => ({\n type: 'Feature',\n properties: {\n name: item.name,\n adcode: item.adcode,\n level: item.level,\n },\n geometry: {\n type: 'Polygon',\n coordinates: item.polygon ? [item.polygon] : [],\n },\n }))\n\n return {\n type: 'FeatureCollection',\n features,\n }\n} "],"names":["PROVINCE_CODES","Object","fromEntries","entries","map","_ref","name","code","provinceName","test"],"mappings":"aAyHO,MAAMA,EAAiB,CAC5B,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,SAAU,SACV,MAAO,SACP,MAAO,SACP,OAAQ,SACR,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,UAAW,SACX,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,QAAS,SACT,MAAO,SACP,MAAO,SACP,MAAO,SACP,UAAW,SACX,WAAY,SACZ,MAAO,SACP,UAAW,SACX,UAAW,UAIiBC,OAAOC,YACnCD,OAAOE,QAAQH,GAAgBI,IAAIC,IAAA,IAAEC,EAAMC,GAAIF,EAAA,MAAM,CAACE,EAAMD,uDAIvD,SAAyBE,GAC9B,OAAOR,EAAeQ,IAAgD,QACxE,yBAQO,SAAwBD,GAC7B,MAAO,UAAUE,KAAKF,IAAkB,WAATA,CACjC"}
1
+ {"version":3,"file":"mapData.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/utils/mapData.ts"],"sourcesContent":["// 免费的地图数据源\nexport const FREE_MAP_SOURCES = {\n // 省级地图数据源\n PROVINCE: {\n // 使用天地图省级数据\n TIANDITU: () => `https://api.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=你的天地图token`,\n // 使用 DataV 的省级数据\n DATAV: (adcode: string) => `https://geo.datav.aliyun.com/areas_v3/bound/${adcode}_full.json`,\n },\n // 天地图行政区划数据\n TIANDITU_ADMIN: {\n // 获取行政区划边界数据\n BOUNDARY: (adcode: string) => `https://api.tianditu.gov.cn/administrative?postStr={\"searchWord\":\"${adcode}\",\"searchType\":\"11\",\"needSubInfo\":true,\"needAll\":true,\"needPolygon\":true,\"needPre\":true}&type=query&tk=你的天地图token`,\n },\n}\n\n// 中国地图数据 - 使用真实的省级边界数据\nexport const CHINA_MAP_DATA = {\n type: 'FeatureCollection',\n features: [\n // 这里应该包含所有省份的边界数据\n // 由于数据量很大,建议使用外部数据源\n ],\n}\n\n// 获取中国地图数据的函数\nexport async function getChinaMapData(): Promise<any> {\n try {\n // 优先使用 DataV 的中国地图数据\n const response = await fetch('https://geo.datav.aliyun.com/areas_v3/bound/100000_full.json')\n if (response.ok) {\n return await response.json()\n }\n }\n catch (error) {\n console.warn('Failed to fetch China map from DataV:', error)\n }\n\n // 备用方案:使用简化的地图数据\n return {\n type: 'FeatureCollection',\n features: [\n {\n type: 'Feature',\n properties: {\n name: '中国',\n adcode: '100000',\n },\n geometry: {\n type: 'Polygon',\n coordinates: [[\n [73.66, 35.42], [78.91, 35.42], [81.33, 36.08], [85.29, 36.08],\n [88.02, 35.42], [90.16, 35.42], [92.13, 34.76], [94.81, 34.76],\n [97.06, 33.44], [99.43, 32.78], [101.06, 31.46], [102.73, 30.14],\n [104.40, 28.82], [106.07, 27.50], [107.74, 26.18], [109.41, 24.86],\n [111.08, 23.54], [112.75, 22.22], [114.42, 20.90], [116.09, 19.58],\n [117.76, 18.26], [119.43, 16.94], [121.10, 15.62], [122.77, 14.30],\n [124.44, 12.98], [126.11, 11.66], [127.78, 10.34], [129.45, 9.02],\n [131.12, 7.70], [132.79, 6.38], [134.46, 5.06], [135.05, 4.40],\n [135.05, 5.06], [135.05, 6.38], [135.05, 7.70], [135.05, 9.02],\n [135.05, 10.34], [135.05, 11.66], [135.05, 12.98], [135.05, 14.30],\n [135.05, 15.62], [135.05, 16.94], [135.05, 18.26], [135.05, 19.58],\n [135.05, 20.90], [135.05, 22.22], [135.05, 23.54], [135.05, 24.86],\n [135.05, 26.18], [135.05, 27.50], [135.05, 28.82], [135.05, 30.14],\n [135.05, 31.46], [135.05, 32.78], [135.05, 34.10], [135.05, 35.42],\n [134.46, 36.08], [133.79, 36.74], [133.12, 37.40], [132.45, 38.06],\n [131.78, 38.72], [131.11, 39.38], [130.44, 40.04], [129.77, 40.70],\n [129.10, 41.36], [128.43, 42.02], [127.76, 42.68], [127.09, 43.34],\n [126.42, 44.00], [125.75, 44.66], [125.08, 45.32], [124.41, 45.98],\n [123.74, 46.64], [123.07, 47.30], [122.40, 47.96], [121.73, 48.62],\n [121.06, 49.28], [120.39, 49.94], [119.72, 50.60], [119.05, 51.26],\n [118.38, 51.92], [117.71, 52.58], [117.04, 53.24], [116.37, 53.90],\n [115.70, 54.56], [115.03, 55.22], [114.36, 55.88], [113.69, 56.54],\n [113.02, 57.20], [112.35, 57.86], [111.68, 58.52], [111.01, 59.18],\n [110.34, 59.84], [109.67, 60.50], [109.00, 61.16], [108.33, 61.82],\n [107.66, 62.48], [106.99, 63.14], [106.32, 63.80], [105.65, 64.46],\n [104.98, 65.12], [104.31, 65.78], [103.64, 66.44], [102.97, 67.10],\n [102.30, 67.76], [101.63, 68.42], [100.96, 69.08], [100.29, 69.74],\n [99.62, 70.40], [98.95, 71.06], [98.28, 71.72], [97.61, 72.38],\n [96.94, 73.04], [96.27, 73.70], [95.60, 74.36], [94.93, 75.02],\n [94.26, 75.68], [93.59, 76.34], [92.92, 77.00], [92.25, 77.66],\n [91.58, 78.32], [90.91, 78.98], [90.24, 79.64], [89.57, 80.30],\n [88.90, 80.96], [88.23, 81.62], [87.56, 82.28], [86.89, 82.94],\n [86.22, 83.60], [85.55, 84.26], [84.88, 84.92], [84.21, 85.58],\n [83.54, 86.24], [82.87, 86.90], [82.20, 87.56], [81.53, 88.22],\n [80.86, 88.88], [80.19, 89.54], [79.52, 90.20], [78.85, 90.86],\n [78.18, 91.52], [77.51, 92.18], [76.84, 92.84], [76.17, 93.50],\n [75.50, 94.16], [74.83, 94.82], [74.16, 95.48], [73.66, 96.14],\n [73.66, 95.48], [73.66, 94.82], [73.66, 94.16], [73.66, 93.50],\n [73.66, 92.84], [73.66, 92.18], [73.66, 91.52], [73.66, 90.86],\n [73.66, 90.20], [73.66, 89.54], [73.66, 88.88], [73.66, 88.22],\n [73.66, 87.56], [73.66, 86.90], [73.66, 86.24], [73.66, 85.58],\n [73.66, 84.92], [73.66, 84.26], [73.66, 83.60], [73.66, 82.94],\n [73.66, 82.28], [73.66, 81.62], [73.66, 80.96], [73.66, 80.30],\n [73.66, 79.64], [73.66, 78.98], [73.66, 78.32], [73.66, 77.66],\n [73.66, 77.00], [73.66, 76.34], [73.66, 75.68], [73.66, 75.02],\n [73.66, 74.36], [73.66, 73.70], [73.66, 73.04], [73.66, 72.38],\n [73.66, 71.72], [73.66, 71.06], [73.66, 70.40], [73.66, 69.74],\n [73.66, 69.08], [73.66, 68.42], [73.66, 67.76], [73.66, 67.10],\n [73.66, 66.44], [73.66, 65.78], [73.66, 65.12], [73.66, 64.46],\n [73.66, 63.80], [73.66, 63.14], [73.66, 62.48], [73.66, 61.82],\n [73.66, 61.16], [73.66, 60.50], [73.66, 59.84], [73.66, 59.18],\n [73.66, 58.52], [73.66, 57.86], [73.66, 57.20], [73.66, 56.54],\n [73.66, 55.88], [73.66, 55.22], [73.66, 54.56], [73.66, 53.90],\n [73.66, 53.24], [73.66, 52.58], [73.66, 51.92], [73.66, 51.26],\n [73.66, 50.60], [73.66, 49.94], [73.66, 49.28], [73.66, 48.62],\n [73.66, 47.96], [73.66, 47.30], [73.66, 46.64], [73.66, 45.98],\n [73.66, 45.32], [73.66, 44.66], [73.66, 44.00], [73.66, 43.34],\n [73.66, 42.68], [73.66, 42.02], [73.66, 41.36], [73.66, 40.70],\n [73.66, 40.04], [73.66, 39.38], [73.66, 38.72], [73.66, 38.06],\n [73.66, 37.40], [73.66, 36.74], [73.66, 36.08], [73.66, 35.42],\n ]],\n },\n },\n ],\n }\n}\n\n// 省级行政区代码映射\nexport const PROVINCE_CODES = {\n 北京市: '110000',\n 天津市: '120000',\n 河北省: '130000',\n 山西省: '140000',\n 内蒙古自治区: '150000',\n 辽宁省: '210000',\n 吉林省: '220000',\n 黑龙江省: '230000',\n 上海市: '310000',\n 江苏省: '320000',\n 浙江省: '330000',\n 安徽省: '340000',\n 福建省: '350000',\n 江西省: '360000',\n 山东省: '370000',\n 河南省: '410000',\n 湖北省: '420000',\n 湖南省: '430000',\n 广东省: '440000',\n 广西壮族自治区: '450000',\n 海南省: '460000',\n 重庆市: '500000',\n 四川省: '510000',\n 贵州省: '520000',\n 云南省: '530000',\n 西藏自治区: '540000',\n 陕西省: '610000',\n 甘肃省: '620000',\n 青海省: '630000',\n 宁夏回族自治区: '640000',\n 新疆维吾尔自治区: '650000',\n 台湾省: '710000',\n 香港特别行政区: '810000',\n 澳门特别行政区: '820000',\n}\n\n// 省级名称映射(反向查找)\nexport const PROVINCE_NAMES = Object.fromEntries(\n Object.entries(PROVINCE_CODES).map(([name, code]) => [code, name]),\n)\n\n// 获取省级代码\nexport function getProvinceCode(provinceName: string): string {\n return PROVINCE_CODES[provinceName as keyof typeof PROVINCE_CODES] || '100000'\n}\n\n// 获取省级名称\nexport function getProvinceName(provinceCode: string): string {\n return PROVINCE_NAMES[provinceCode] || '中国'\n}\n\n// 判断是否为省级代码\nexport function isProvinceCode(code: string): boolean {\n return /^\\d{6}$/.test(code) && code !== '100000'\n}\n\n// 获取省级地图数据\nexport async function getProvinceMapData(provinceName: string): Promise<any> {\n const provinceCode = getProvinceCode(provinceName)\n\n try {\n const url = `https://geo.datav.aliyun.com/areas_v3/bound/${provinceCode}_full.json`\n\n const response = await fetch(url)\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n\n const data = await response.json()\n return data\n }\n catch (error) {\n console.error('Failed to fetch province map data for:', provinceName, error)\n throw error\n }\n}\n\n// 天地图配置\nexport const TIANDITU_CONFIG = {\n // 天地图 token(需要申请)\n TOKEN: '你的天地图token', // 请替换为您的天地图 token\n // 天地图 API 基础 URL\n BASE_URL: 'https://api.tianditu.gov.cn',\n}\n\n// 获取天地图行政区划数据\nexport async function fetchTiandituBoundary(adcode: string): Promise<any> {\n try {\n const url = FREE_MAP_SOURCES.TIANDITU_ADMIN.BOUNDARY(adcode).replace('你的天地图token', TIANDITU_CONFIG.TOKEN)\n const response = await fetch(url)\n\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n\n const data = await response.json()\n return data\n }\n catch (error) {\n console.error('Failed to fetch Tianditu boundary data:', error)\n throw error\n }\n}\n\n// 获取地图数据的函数\nexport async function fetchMapData(adcode: string): Promise<any> {\n try {\n // 优先尝试从天地图获取数据\n if (TIANDITU_CONFIG.TOKEN !== '你的天地图token') {\n try {\n const tiandituData = await fetchTiandituBoundary(adcode)\n if (tiandituData && tiandituData.data && tiandituData.data.length > 0) {\n // 转换天地图数据为 GeoJSON 格式\n return convertTiandituToGeoJson(tiandituData)\n }\n }\n catch (error) {\n console.warn('Failed to fetch from Tianditu, trying DataV:', error)\n }\n }\n\n // 备用方案:从 DataV 获取数据\n const url = FREE_MAP_SOURCES.PROVINCE.DATAV(adcode)\n console.log('Fetching province map data from:', url)\n const response = await fetch(url)\n\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n\n const data = await response.json()\n console.log('Successfully fetched province map data for:', adcode, data)\n return data\n }\n catch (error) {\n console.error('Failed to fetch map data for adcode:', adcode, error)\n throw error\n }\n}\n\n// 转换天地图数据为 GeoJSON 格式\nfunction convertTiandituToGeoJson(tiandituData: any): any {\n const features = tiandituData.data.map((item: any) => ({\n type: 'Feature',\n properties: {\n name: item.name,\n adcode: item.adcode,\n level: item.level,\n },\n geometry: {\n type: 'Polygon',\n coordinates: item.polygon ? [item.polygon] : [],\n },\n }))\n\n return {\n type: 'FeatureCollection',\n features,\n }\n}\n"],"names":["PROVINCE_CODES","北京市","天津市","河北省","山西省","内蒙古自治区","辽宁省","吉林省","黑龙江省","上海市","江苏省","浙江省","安徽省","福建省","江西省","山东省","河南省","湖北省","湖南省","广东省","广西壮族自治区","海南省","重庆市","四川省","贵州省","云南省","西藏自治区","陕西省","甘肃省","青海省","宁夏回族自治区","新疆维吾尔自治区","台湾省","香港特别行政区","澳门特别行政区","Object","fromEntries","entries","map","_ref","name","code","provinceName","test"],"mappings":"aAuHO,MAAMA,EAAiB,CAC5BC,MAAK,SACLC,MAAK,SACLC,MAAK,SACLC,MAAK,SACLC,SAAQ,SACRC,MAAK,SACLC,MAAK,SACLC,OAAM,SACNC,MAAK,SACLC,MAAK,SACLC,MAAK,SACLC,MAAK,SACLC,MAAK,SACLC,MAAK,SACLC,MAAK,SACLC,MAAK,SACLC,MAAK,SACLC,MAAK,SACLC,MAAK,SACLC,UAAS,SACTC,MAAK,SACLC,MAAK,SACLC,MAAK,SACLC,MAAK,SACLC,MAAK,SACLC,QAAO,SACPC,MAAK,SACLC,MAAK,SACLC,MAAK,SACLC,UAAS,SACTC,WAAU,SACVC,MAAK,SACLC,UAAS,SACTC,UAAS,UAImBC,OAAOC,YACnCD,OAAOE,QAAQrC,GAAgBsC,IAAIC,IAAA,IAAEC,EAAMC,GAAIF,EAAA,MAAM,CAACE,EAAMD,uDAIvD,SAAyBE,GAC9B,OAAO1C,EAAe0C,IAAgD,QACxE,yBAQO,SAAwBD,GAC7B,MAAO,UAAUE,KAAKF,IAAkB,WAATA,CACjC"}