@qxs-bns/components 0.0.49 → 0.0.51

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 (119) hide show
  1. package/es/index.css +17 -18
  2. package/es/index.mjs +1 -1
  3. package/es/index.mjs.map +1 -1
  4. package/es/package.json.mjs +1 -1
  5. package/es/src/components.mjs +1 -1
  6. package/es/src/data-chart/index.mjs +1 -1
  7. package/es/src/data-chart/index.mjs.map +1 -1
  8. package/es/src/data-chart/src/analyze.mjs +2 -0
  9. package/es/src/data-chart/src/analyze.mjs.map +1 -0
  10. package/es/src/data-chart/src/components/area.vue2.mjs.map +1 -1
  11. package/es/src/data-chart/src/components/bar.vue.mjs +1 -1
  12. package/es/src/data-chart/src/components/bar.vue.mjs.map +1 -1
  13. package/es/src/data-chart/src/components/card.vue2.mjs +1 -1
  14. package/es/src/data-chart/src/components/card.vue2.mjs.map +1 -1
  15. package/es/src/data-chart/src/components/data-chart-card-bg-left.svg.mjs +2 -0
  16. package/es/src/data-chart/src/components/data-chart-card-bg-left.svg.mjs.map +1 -0
  17. package/es/src/data-chart/src/components/data-chart-card-bg-right.svg.mjs +2 -0
  18. package/es/src/data-chart/src/components/data-chart-card-bg-right.svg.mjs.map +1 -0
  19. package/es/src/data-chart/src/components/empty.vue.mjs +1 -1
  20. package/es/src/data-chart/src/components/empty.vue.mjs.map +1 -1
  21. package/es/src/data-chart/src/components/funnel.vue.mjs.map +1 -1
  22. package/es/src/data-chart/src/components/line.vue2.mjs +1 -1
  23. package/es/src/data-chart/src/components/line.vue2.mjs.map +1 -1
  24. package/es/src/data-chart/src/components/pie.vue.mjs.map +1 -1
  25. package/es/src/data-chart/src/components/radar.vue.mjs +1 -1
  26. package/es/src/data-chart/src/components/radar.vue.mjs.map +1 -1
  27. package/es/src/data-chart/src/components/scatter-simple.vue.mjs.map +1 -1
  28. package/es/src/data-chart/src/components/scatter.vue.mjs.map +1 -1
  29. package/es/src/data-chart/src/components/table.vue.mjs +1 -1
  30. package/es/src/data-chart/src/components/table.vue.mjs.map +1 -1
  31. package/es/src/data-chart/src/data-chart.vue.mjs +1 -1
  32. package/es/src/data-chart/src/data-chart.vue.mjs.map +1 -1
  33. package/es/src/data-chart/src/utils/config.mjs +1 -1
  34. package/es/src/data-chart/src/utils/config.mjs.map +1 -1
  35. package/es/src/data-chart/src/utils/safe-eval.mjs.map +1 -1
  36. package/es/src/data-chart/src/utils/useCharts.mjs +1 -1
  37. package/es/src/data-chart/src/utils/useCharts.mjs.map +1 -1
  38. package/lib/index.cjs +1 -1
  39. package/lib/index.cjs.map +1 -1
  40. package/lib/index.css +17 -18
  41. package/lib/package.json.cjs +1 -1
  42. package/lib/src/components.cjs +1 -1
  43. package/lib/src/data-chart/index.cjs +1 -1
  44. package/lib/src/data-chart/index.cjs.map +1 -1
  45. package/lib/src/data-chart/src/analyze.cjs +2 -0
  46. package/lib/src/data-chart/src/analyze.cjs.map +1 -0
  47. package/lib/src/data-chart/src/components/area.vue2.cjs.map +1 -1
  48. package/lib/src/data-chart/src/components/bar.vue.cjs +1 -1
  49. package/lib/src/data-chart/src/components/bar.vue.cjs.map +1 -1
  50. package/lib/src/data-chart/src/components/card.vue2.cjs +1 -1
  51. package/lib/src/data-chart/src/components/card.vue2.cjs.map +1 -1
  52. package/lib/src/data-chart/src/components/data-chart-card-bg-left.svg.cjs +2 -0
  53. package/lib/src/data-chart/src/components/data-chart-card-bg-left.svg.cjs.map +1 -0
  54. package/lib/src/data-chart/src/components/data-chart-card-bg-right.svg.cjs +2 -0
  55. package/lib/src/data-chart/src/components/data-chart-card-bg-right.svg.cjs.map +1 -0
  56. package/lib/src/data-chart/src/components/empty.vue.cjs +1 -1
  57. package/lib/src/data-chart/src/components/empty.vue.cjs.map +1 -1
  58. package/lib/src/data-chart/src/components/funnel.vue.cjs.map +1 -1
  59. package/lib/src/data-chart/src/components/line.vue2.cjs +1 -1
  60. package/lib/src/data-chart/src/components/line.vue2.cjs.map +1 -1
  61. package/lib/src/data-chart/src/components/pie.vue.cjs.map +1 -1
  62. package/lib/src/data-chart/src/components/radar.vue.cjs +1 -1
  63. package/lib/src/data-chart/src/components/radar.vue.cjs.map +1 -1
  64. package/lib/src/data-chart/src/components/scatter-simple.vue.cjs.map +1 -1
  65. package/lib/src/data-chart/src/components/scatter.vue.cjs.map +1 -1
  66. package/lib/src/data-chart/src/components/table.vue.cjs +1 -1
  67. package/lib/src/data-chart/src/components/table.vue.cjs.map +1 -1
  68. package/lib/src/data-chart/src/data-chart.vue.cjs +1 -1
  69. package/lib/src/data-chart/src/data-chart.vue.cjs.map +1 -1
  70. package/lib/src/data-chart/src/utils/config.cjs +1 -1
  71. package/lib/src/data-chart/src/utils/config.cjs.map +1 -1
  72. package/lib/src/data-chart/src/utils/safe-eval.cjs.map +1 -1
  73. package/lib/src/data-chart/src/utils/useCharts.cjs +1 -1
  74. package/lib/src/data-chart/src/utils/useCharts.cjs.map +1 -1
  75. package/package.json +7 -5
  76. package/theme-chalk/index.css +1 -1
  77. package/theme-chalk/src/common/element-plus.css +1 -1
  78. package/theme-chalk/src/common/element-plus.scss +1 -1
  79. package/theme-chalk/src/data-chart/empty.css +1 -1
  80. package/theme-chalk/src/data-chart/empty.scss +3 -3
  81. package/theme-chalk/src/data-chart/index.css +1 -1
  82. package/theme-chalk/src/data-chart/table.css +1 -1
  83. package/theme-chalk/src/data-chart/table.scss +8 -4
  84. package/types/src/data-chart/index.d.ts +7 -4
  85. package/types/src/data-chart/index.d.ts.map +1 -1
  86. package/types/src/data-chart/src/analyze.d.ts +1 -1
  87. package/types/src/data-chart/src/analyze.d.ts.map +1 -1
  88. package/types/src/data-chart/src/components/area.vue.d.ts +1 -1
  89. package/types/src/data-chart/src/components/area.vue.d.ts.map +1 -1
  90. package/types/src/data-chart/src/components/bar.vue.d.ts +1 -1
  91. package/types/src/data-chart/src/components/bar.vue.d.ts.map +1 -1
  92. package/types/src/data-chart/src/components/card.vue.d.ts +1 -1
  93. package/types/src/data-chart/src/components/card.vue.d.ts.map +1 -1
  94. package/types/src/data-chart/src/components/empty.vue.d.ts.map +1 -1
  95. package/types/src/data-chart/src/components/funnel.vue.d.ts +1 -1
  96. package/types/src/data-chart/src/components/funnel.vue.d.ts.map +1 -1
  97. package/types/src/data-chart/src/components/line.vue.d.ts +1 -1
  98. package/types/src/data-chart/src/components/line.vue.d.ts.map +1 -1
  99. package/types/src/data-chart/src/components/pie.vue.d.ts +1 -1
  100. package/types/src/data-chart/src/components/pie.vue.d.ts.map +1 -1
  101. package/types/src/data-chart/src/components/radar.vue.d.ts +1 -1
  102. package/types/src/data-chart/src/components/radar.vue.d.ts.map +1 -1
  103. package/types/src/data-chart/src/components/scatter-simple.vue.d.ts +1 -1
  104. package/types/src/data-chart/src/components/scatter-simple.vue.d.ts.map +1 -1
  105. package/types/src/data-chart/src/components/scatter.vue.d.ts +1 -1
  106. package/types/src/data-chart/src/components/scatter.vue.d.ts.map +1 -1
  107. package/types/src/data-chart/src/components/table.vue.d.ts +1 -1
  108. package/types/src/data-chart/src/components/table.vue.d.ts.map +1 -1
  109. package/types/src/data-chart/src/data-chart.vue.d.ts +2 -2
  110. package/types/src/data-chart/src/data-chart.vue.d.ts.map +1 -1
  111. package/types/src/data-chart/src/utils/config.d.ts +1 -1
  112. package/types/src/data-chart/src/utils/config.d.ts.map +1 -1
  113. package/types/src/data-chart/src/utils/safe-eval.d.ts +1 -1
  114. package/types/src/data-chart/src/utils/safe-eval.d.ts.map +1 -1
  115. package/types/src/data-chart/src/utils/types.d.ts +68 -0
  116. package/types/src/data-chart/src/utils/types.d.ts.map +1 -0
  117. package/types/src/data-chart/src/utils/useCharts.d.ts +1 -1
  118. package/types/src/data-chart/src/utils/useCharts.d.ts.map +1 -1
  119. package/types/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"radar.vue.mjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/radar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartsOption, IFormatPublicData } from '../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} = defineProps<{\n chartData: IFormatPublicData\n chartOptions: EChartsOption\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})\nuseCharts({ chartDOM: dataChartRadar, chartOptions: radarChartOptions, chartData: computed(() => chartData) })\n</script>\n\n<template>\n <div\n ref=\"dataChartRadar\"\n class=\"data-chart-radar\"\n />\n</template>\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","useCharts","chartDOM"],"mappings":"6YAkBA,MAAMA,EAAiBC,IACjBC,EAAQC,EAAOC,GAAsBC,GAAWA,IAAG,GACnDC,EAAoBC,GAAwB,KAChD,MAAMC,QAAEA,EAASC,aAAAA,EAAAC,UAAcA,EAAWC,KAAAA,GAASC,EAAAC,UAE/CJ,GAAcK,gBAChBL,EAAaK,cAAgB,IAE/BL,EAAaK,cAAgBC,EAAKJ,EAAKK,KAAKC,GACnCA,EAAKR,EAAaD,SAAW,MACnCU,QAAOb,GAAKA,KAEf,MAAMc,EAAS,CACbC,MAAO,CACLC,KAAMX,GAERY,MAAO,CACLC,UAAWd,GAAcK,eAAeE,KAAKQ,IACpC,CACLC,KAAMD,EACNE,IAAKC,KAAKD,OAAOf,EAAKK,KAAIC,GAAQW,OAAOX,EAAKT,EAAQ,aAEpD,IAERqB,OAAQ,CAAC,CACPJ,KAAMhB,GAAcD,QACpBsB,KAAM,QACNC,QAAS,CACPC,QAAS,QAEXrB,KAAMH,EAAQQ,KAAoBiB,IAAA,CAChCR,KAAMQ,EACNC,MAAOzB,GAAcK,eAAeE,KAAKQ,GAC/Bb,EAAKK,KAAKmB,GACZX,IAAsBW,EAAS1B,EAAaD,SAAW,IAClD2B,EAASF,GAEX,OACNf,WAAYb,IAAI+B,QAAO,CAACC,EAAKC,IAAQV,OAAOS,GAAO,GAAKT,OAAOU,GAAO,IAAI,YAM9E,OAAApC,EAAMiB,EAAQP,EAAY2B,aAAA,WAEzBC,EAAA,CAAEC,SAAUzC,EAAgBuC,aAAcjC,EAAmBO,UAAWN,GAAS,IAAMK,EAAAC"}
1
+ {"version":3,"file":"radar.vue.mjs","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} = defineProps<{\n chartData: IFormatPublicData\n chartOptions: EChartsOption\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})\nuseCharts({ chartDOM: dataChartRadar, chartOptions: radarChartOptions, chartData: computed(() => chartData) })\n</script>\n\n<template>\n <div\n ref=\"dataChartRadar\"\n class=\"data-chart-radar\"\n />\n</template>\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","useCharts","chartDOM"],"mappings":"6YAkBA,MAAMA,EAAiBC,IACjBC,EAAQC,EAAOC,GAAsBC,GAAWA,IAAG,GACnDC,EAAoBC,GAAwB,KAChD,MAAMC,QAAEA,EAASC,aAAAA,EAAAC,UAAcA,EAAWC,KAAAA,GAASC,EAAAC,UAE9CJ,GAAcK,gBACjBL,EAAaK,cAAgB,IAE/BL,EAAaK,cAAgBC,EAAKJ,EAAKK,KAAKC,GACnCA,EAAKR,EAAaD,SAAW,MACnCU,QAAOb,GAAKA,KAEf,MAAMc,EAAS,CACbC,MAAO,CACLC,KAAMX,GAERY,MAAO,CACLC,UAAWd,GAAcK,eAAeE,KAAKQ,IACpC,CACLC,KAAMD,EACNE,IAAKC,KAAKD,OAAOf,EAAKK,KAAIC,GAAQW,OAAOX,EAAKT,EAAQ,aAEpD,IAERqB,OAAQ,CAAC,CACPJ,KAAMhB,GAAcD,QACpBsB,KAAM,QACNC,QAAS,CACPC,QAAS,QAEXrB,KAAMH,EAAQQ,KAAoBiB,IAAA,CAChCR,KAAMQ,EACNC,MAAOzB,GAAcK,eAAeE,KAAKQ,GAC/Bb,EAAKK,KAAKmB,GACZX,IAAsBW,EAAS1B,EAAaD,SAAW,IAClD2B,EAASF,GAEX,OACNf,WAAYb,IAAI+B,QAAO,CAACC,EAAKC,IAAQV,OAAOS,GAAO,GAAKT,OAAOU,GAAO,IAAI,YAM9E,OAAApC,EAAMiB,EAAQP,EAAY2B,aAAA,WAEzBC,EAAA,CAAEC,SAAUzC,EAAgBuC,aAAcjC,EAAmBO,UAAWN,GAAS,IAAMK,EAAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"scatter-simple.vue.mjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/scatter-simple.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartsOption, IFormatPublicData } from '../types'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartScatterSimple',\n})\nconst {\n chartData,\n chartOptions,\n} = defineProps<{\n chartData: IFormatPublicData\n chartOptions: EChartsOption\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})\nuseCharts({ chartDOM: dataChartScatterSimple, chartOptions: scatterChartOptions, chartData: computed(() => chartData) })\n</script>\n\n<template>\n <div\n ref=\"dataChartScatterSimple\"\n class=\"data-chart-scatter-simple\"\n />\n</template>\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","useCharts","chartDOM"],"mappings":"6XAeA,MAAMA,EAAyBC,IACzBC,EAAQC,EAAOC,GAAsBC,GAAWA,IAAG,GAEnDC,EAAsBC,GAAwB,KAClD,MAAMC,QAAEA,EAASC,aAAAA,EAAAC,UAAcA,EAAWC,KAAAA,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,KAAKC,IACZ,CACLC,WAAY,GACZJ,KAAMG,EACNf,KAAMA,EAAKc,KAAKG,GACP,CAACA,EAASF,GAAcE,EAASnB,GAAcD,SAAW,OAEnEqB,KAAM,eAIL,OAAA3B,EAAMY,EAAQF,EAAYkB,aAAA,WAEzBC,EAAA,CAAEC,SAAUhC,EAAwB8B,aAAcxB,EAAqBO,UAAWN,GAAS,IAAMK,EAAAC"}
1
+ {"version":3,"file":"scatter-simple.vue.mjs","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} = defineProps<{\n chartData: IFormatPublicData\n chartOptions: EChartsOption\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})\nuseCharts({ chartDOM: dataChartScatterSimple, chartOptions: scatterChartOptions, chartData: computed(() => chartData) })\n</script>\n\n<template>\n <div\n ref=\"dataChartScatterSimple\"\n class=\"data-chart-scatter-simple\"\n />\n</template>\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","useCharts","chartDOM"],"mappings":"6XAeA,MAAMA,EAAyBC,IACzBC,EAAQC,EAAOC,GAAsBC,GAAWA,IAAG,GAEnDC,EAAsBC,GAAwB,KAClD,MAAMC,QAAEA,EAASC,aAAAA,EAAAC,UAAcA,EAAWC,KAAAA,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,KAAKC,IACZ,CACLC,WAAY,GACZJ,KAAMG,EACNf,KAAMA,EAAKc,KAAKG,GACP,CAACA,EAASF,GAAcE,EAASnB,GAAcD,SAAW,OAEnEqB,KAAM,eAIL,OAAA3B,EAAMY,EAAQF,EAAYkB,aAAA,WAEzBC,EAAA,CAAEC,SAAUhC,EAAwB8B,aAAcxB,EAAqBO,UAAWN,GAAS,IAAMK,EAAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"scatter.vue.mjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/scatter.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartsOption, IFormatPublicData } from '../types'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartScatter',\n})\n\nconst {\n chartData,\n chartOptions,\n} = defineProps<{\n chartData: IFormatPublicData\n chartOptions: EChartsOption\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})\nuseCharts({ chartDOM: dataChartScatter, chartOptions: scatterChartOptions, chartData: computed(() => chartData) })\n</script>\n\n<template>\n <div\n ref=\"dataChartScatter\"\n class=\"data-chart-scatter\"\n />\n</template>\n"],"names":["dataChartScatter","ref","merge","inject","InjectionChartMerge","v","scatterChartOptions","computed","xAxis","yAxis","series","symbolSize","data","type","__props","chartOptions","useCharts","chartDOM","chartData"],"mappings":"gXAiBA,MAAMA,EAAmBC,IACnBC,EAAQC,EAAOC,GAAsBC,GAAWA,IAAG,GAEnDC,EAAsBC,GAAwB,IAoC3CL,EAnCQ,CACbM,MAAO,CAAC,EACRC,MAAO,CAAC,EACRC,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,EAAYC,uBAEzBC,EAAA,CAAEC,SAAUjB,EAAkBe,aAAcT,EAAqBY,UAAWX,GAAS,IAAMO,EAAAI"}
1
+ {"version":3,"file":"scatter.vue.mjs","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} = defineProps<{\n chartData: IFormatPublicData\n chartOptions: EChartsOption\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})\nuseCharts({ chartDOM: dataChartScatter, chartOptions: scatterChartOptions, chartData: computed(() => chartData) })\n</script>\n\n<template>\n <div\n ref=\"dataChartScatter\"\n class=\"data-chart-scatter\"\n />\n</template>\n"],"names":["dataChartScatter","ref","merge","inject","InjectionChartMerge","v","scatterChartOptions","computed","xAxis","yAxis","series","symbolSize","data","type","__props","chartOptions","useCharts","chartDOM","chartData"],"mappings":"gXAiBA,MAAMA,EAAmBC,IACnBC,EAAQC,EAAOC,GAAsBC,GAAWA,IAAG,GAEnDC,EAAsBC,GAAwB,IAoC3CL,EAnCQ,CACbM,MAAO,CAAC,EACRC,MAAO,CAAC,EACRC,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,EAAYC,uBAEzBC,EAAA,CAAEC,SAAUjB,EAAkBe,aAAcT,EAAqBY,UAAWX,GAAS,IAAMO,EAAAI"}
@@ -1,2 +1,2 @@
1
- import{ElTable as e,ElTableColumn as t}from"element-plus/es";import"element-plus/es/components/base/style/index";import"element-plus/es/components/table/style/index";import"element-plus/es/components/table-column/style/index";import{defineComponent as a,computed as o,createElementBlock as l,openBlock as s,normalizeClass as r,unref as c,createCommentVNode as n,createVNode as p,createElementVNode as m,toDisplayString as i,withCtx as d,Fragment as u,renderList as h,createBlock as D,createTextVNode as b}from"vue";import{useNamespace as f}from"@qxs-bns/hooks";import y from"./empty.vue.mjs";const x={key:0,class:"title"};var w=a({name:"DataChartTable",__name:"table",props:{chartData:{type:Object,default:()=>({colDesc:[],xGroupByDesc:[],data:[],modelName:""})}},setup(a){const w=a,g=f("data-chart"),v=o((()=>w.chartData.groupByDesc.find((e=>!e.xAxis))));function $(e){if(!e)return 100;const t=14*e.length+20+30;return t<100?100:t}return(o,f)=>{const w=t,_=e;return s(),l("div",{class:r([c(g).e("data-chart-table")])},[a.chartData.modelName?(s(),l("p",x,[m("span",null,i(a.chartData.modelName),1)])):n("v-if",!0),p(_,{class:"customize-table data-chart-table-content",data:a.chartData.data,stripe:"",height:"100%"},{empty:d((()=>[p(y)])),default:d((()=>[(s(!0),l(u,null,h(a.chartData.groupByDesc,((e,t)=>(s(),D(w,{key:`${e.colDesc}${e.groupByDesc}${t}`,align:"center","show-overflow-tooltip":"",sortable:"","min-width":`${$(e.colDesc)}px`,prop:e.colDesc||""},{header:d((()=>[b(i(e.colDesc),1)])),default:d((t=>[b(i((c(v)&&(c(v).colDesc,e.colDesc),t.row[e.colDesc||""]||"--")),1)])),_:2},1032,["min-width","prop"])))),128)),(s(!0),l(u,null,h(a.chartData.colDesc,((e,t)=>(s(),D(w,{key:e+t,align:"center","min-width":`${$(e)}px`,label:e,"show-overflow-tooltip":"",sortable:"",prop:e},{header:d((()=>[b(i(e),1)])),_:2},1032,["min-width","label","prop"])))),128))])),_:1},8,["data"])],2)}}});export{w as default};
1
+ import{ElTable as e,ElTableColumn as t}from"element-plus/es";import"element-plus/es/components/base/style/index";import"element-plus/es/components/table/style/index";import"element-plus/es/components/table-column/style/index";import{defineComponent as a,computed as o,createElementBlock as l,openBlock as s,normalizeClass as r,unref as c,createCommentVNode as n,createVNode as p,createElementVNode as m,toDisplayString as i,withCtx as u,Fragment as d,renderList as h,createBlock as D,createTextVNode as f}from"vue";import{useNamespace as b}from"@qxs-bns/hooks";import y from"./empty.vue.mjs";const x={key:0,class:"title"};var w=a({name:"DataChartTable",__name:"table",props:{chartData:{type:Object,default:()=>({colDesc:[],xGroupByDesc:[],data:[],modelName:""})}},setup(a){const w=a,g=b("data-chart"),v=o((()=>w.chartData.groupByDesc.find((e=>!e.xAxis))));function $(e){if(!e)return 100;const t=14*e.length+20+30;return t<100?100:t}return(o,b)=>{const w=t,_=e;return s(),l("div",{class:r([c(g).e("table")])},[a.chartData.modelName?(s(),l("p",x,[m("span",null,i(a.chartData.modelName),1)])):n("v-if",!0),p(_,{class:"customize-table",data:a.chartData.data,stripe:"",height:"100%"},{empty:u((()=>[p(y)])),default:u((()=>[(s(!0),l(d,null,h(a.chartData.groupByDesc,((e,t)=>(s(),D(w,{key:`${e.colDesc}${e.groupByDesc}${t}`,align:"center","show-overflow-tooltip":"",sortable:"","min-width":`${$(e.colDesc)}px`,prop:e.colDesc||""},{header:u((()=>[f(i(e.colDesc),1)])),default:u((t=>[f(i((c(v)&&(c(v).colDesc,e.colDesc),t.row[e.colDesc||""]||"--")),1)])),_:2},1032,["min-width","prop"])))),128)),(s(!0),l(d,null,h(a.chartData.colDesc,((e,t)=>(s(),D(w,{key:e+t,align:"center","min-width":`${$(e)}px`,label:e,"show-overflow-tooltip":"",sortable:"",prop:e},{header:u((()=>[f(i(e),1)])),_:2},1032,["min-width","label","prop"])))),128))])),_:1},8,["data"])],2)}}});export{w as default};
2
2
  //# sourceMappingURL=table.vue.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"table.vue.mjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/table.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { IFormatPublicData } from '../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('data-chart-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 data-chart-table-content\"\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"],"mappings":"qwBAUA,MAAMA,EAAQC,EAYRC,EAAKC,EAAa,cAElBC,EAAeC,GAAS,IAChBL,EAAMM,UAAUC,YAAYC,MAAaC,IAACA,EAAKC,UAI7D,SAASC,EAAUC,GACjB,IAAKA,EACI,OAAA,IAET,MAAMC,EAAwB,GAAbD,EAAIE,OAAc,GAAK,GACjC,OAAAD,EAAW,IAAM,IAAMA,CAAA"}
1
+ {"version":3,"file":"table.vue.mjs","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"],"mappings":"qwBAUA,MAAMA,EAAQC,EAYRC,EAAKC,EAAa,cAElBC,EAAeC,GAAS,IAChBL,EAAMM,UAAUC,YAAYC,MAAaC,IAACA,EAAKC,UAI7D,SAASC,EAAUC,GACjB,IAAKA,EACI,OAAA,IAET,MAAMC,EAAwB,GAAbD,EAAIE,OAAc,GAAK,GACjC,OAAAD,EAAW,IAAM,IAAMA,CAAA"}
@@ -1,2 +1,2 @@
1
- import{defineComponent as e,computed as o,provide as t,createBlock as r,openBlock as s,resolveDynamicComponent as a,unref as m,normalizeClass as p}from"vue";import{useNamespace as n}from"@qxs-bns/hooks";import{JsonToExcel as c}from"@qxs-bns/utils";import{cloneDeep as i,merge as u}from"lodash-es";import l from"./components/area.vue.mjs";import d from"./components/bar.vue.mjs";import f from"./components/card.vue.mjs";import y from"./components/funnel.vue.mjs";import h from"./components/line.vue.mjs";import j from"./components/pie.vue.mjs";import v from"./components/radar.vue.mjs";import D from"./components/scatter-simple.vue.mjs";import b from"./components/scatter.vue.mjs";import g from"./components/table.vue.mjs";import{defaultChartOption as w}from"./utils/config.mjs";import{InjectionChartMerge as x}from"./utils/injectionKeys.mjs";import{safeEvalConfig as S}from"./utils/safe-eval.mjs";import{useDataToExcelJson as N}from"./utils/useCharts.mjs";var T=e({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:""}},setup(e,{expose:T}){const q=n("data-chart"),B={table:g,bar:d,line:h,pie:j,radar:v,scatter:b,funnel:y,area:l,card:f,"scatter-simple":D},C=o((()=>i(w[e.showTypeName]))),O=o((()=>{const{desc:{colDesc:o=[],groupByDesc:t=[]}={},data:r=[]}=e.data;let s=[],a=null;s=t?.map((e=>(e.xAxis&&(a=e),e)));const m=a?r.filter((e=>e&&e[a.colDesc])):r;return k({colDesc:[],xGroupByDesc:{colDesc:"",groupByDesc:"",groupByValues:[],xAxis:!1},groupByDesc:[],data:[],modelName:""},{colDesc:o,modelName:e.modelName,subShowType:e.subShowType,xGroupByDesc:a,groupByDesc:s,data:m})}));function k(o,t){let r=u({},C.value,o,t)||{};if(e.jsCodeSnippet)try{r=S(e.jsCodeSnippet,r)}catch(e){console.error("代码执行失败:",e)}return r}return T({exportExal:function(){if(0===e.data.data.length)return void console.log("暂无数据");const o=N(e.data);c(e.modelName,o)}}),t(x,k),(e,o)=>(s(),r(a(B[e.showTypeName]),{key:e.showTypeName,class:p([m(q).e("wrapper")]),"sub-show-type":e.subShowType,"chart-data":m(O),"chart-options":e.chartOptions},null,8,["class","sub-show-type","chart-data","chart-options"]))}});export{T as default};
1
+ import{defineComponent as e,computed as o,provide as t,createBlock as r,openBlock as s,resolveDynamicComponent as a,unref as m,normalizeClass as p}from"vue";import{useNamespace as n}from"@qxs-bns/hooks";import{JsonToExcel as i}from"@qxs-bns/utils";import{cloneDeep as c,merge as u}from"lodash-es";import l from"./components/area.vue.mjs";import d from"./components/bar.vue.mjs";import f from"./components/card.vue.mjs";import h from"./components/funnel.vue.mjs";import y from"./components/line.vue.mjs";import j from"./components/pie.vue.mjs";import v from"./components/radar.vue.mjs";import b from"./components/scatter-simple.vue.mjs";import w from"./components/scatter.vue.mjs";import g from"./components/table.vue.mjs";import{defaultChartOption as x}from"./utils/config.mjs";import{InjectionChartMerge as D}from"./utils/injectionKeys.mjs";import{safeEvalConfig as S}from"./utils/safe-eval.mjs";import{useDataToExcelJson as T}from"./utils/useCharts.mjs";var q=e({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:""}},setup(e,{expose:q}){const N=n("data-chart"),B={table:g,bar:d,line:y,pie:j,radar:v,scatter:w,funnel:h,area:l,card:f,"scatter-simple":b},C=o((()=>c(x[e.showTypeName]))),O=o((()=>{const{desc:{colDesc:o=[],groupByDesc:t=[]}={},data:r=[]}=e.data;let s=[],a=null;s=t?.map((e=>(e.xAxis&&(a=e),e)));const m=a?r.filter((e=>e&&e[a.colDesc])):r;return{colDesc:o||[],modelName:e.modelName,subShowType:e.subShowType,xGroupByDesc:a||{colDesc:"",groupByDesc:"",groupByValues:[],xAxis:!1},groupByDesc:s,data:m}}));return q({exportExal:function(){if(0===e.data.data.length)return void console.log("暂无数据");const o=T(e.data);i(e.modelName,o)}}),t(D,(function(o,t){let r=u({},C.value,o,t)||{};if(e.jsCodeSnippet)try{r=S(e.jsCodeSnippet,r)}catch(e){console.error("代码执行失败:",e)}return r})),(e,o)=>(s(),r(a(B[e.showTypeName]),{key:e.showTypeName,class:p([m(N).e("wrapper")]),"sub-show-type":e.subShowType,"chart-data":m(O),"chart-options":e.chartOptions},null,8,["class","sub-show-type","chart-data","chart-options"]))}});export{q as default};
2
2
  //# sourceMappingURL=data-chart.vue.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-chart.vue.mjs","sources":["../../../../../../packages/components/src/data-chart/src/data-chart.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartData, EChartsOption, IFormatPublicData } from './types'\nimport type { IconRow } from './types/index'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { JsonToExcel } from '@qxs-bns/utils'\nimport { cloneDeep, merge as lodashMerge } from 'lodash-es'\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 { defaultChartOption } from './utils/config'\nimport { InjectionChartMerge } from './utils/injectionKeys'\nimport { safeEvalConfig } from './utils/safe-eval'\nimport { useDataToExcelJson } from './utils/useCharts'\n\ndefineOptions({\n name: 'QxsDataChart',\n})\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} = defineProps<{\n modelName?: string\n showTypeName?: IconRow['showTypeName']\n subShowType?: string\n data?: EChartData\n chartOptions?: EChartsOption\n jsCodeSnippet?: string\n}>()\n\nconst ns = useNamespace('data-chart')\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 = []\n\n let xGroupByDesc: EChartData['desc']['groupByDesc'][0] | null = null\n xValue = groupByDesc?.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 const dataValue = xGroupByDesc ? data.filter(item => item && item[xGroupByDesc!.colDesc!]) : 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 chartDataDefault = {\n colDesc: [],\n xGroupByDesc: {\n colDesc: '',\n groupByDesc: '',\n groupByValues: [],\n xAxis: false,\n },\n groupByDesc: [],\n data: [],\n modelName: '',\n }\n\n const mergeConfig = merge(chartDataDefault, {\n colDesc,\n modelName,\n subShowType,\n xGroupByDesc,\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\ndefineExpose({\n exportExal,\n})\nprovide(InjectionChartMerge, merge)\n</script>\n\n<template>\n <component\n :is=\"coms[showTypeName]\"\n :key=\"showTypeName\"\n :class=\"[ns.e('wrapper')]\"\n :sub-show-type=\"subShowType\"\n :chart-data=\"formatPublicData\"\n :chart-options=\"chartOptions\"\n />\n</template>\n"],"names":["ns","useNamespace","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","map","groupByDescItem","xAxis","dataValue","filter","item","merge","groupByValues","modelName","subShowType","config","defaultConfig","conf","lodashMerge","value","jsCodeSnippet","safeEvalConfig","error","console","__expose","exportExal","length","log","arr","useDataToExcelJson","JsonToExcel","provide","InjectionChartMerge"],"mappings":"+4CAoDM,MAAAA,EAAKC,EAAa,cAElBC,EAEF,CACFC,MAASC,EACTC,IAAOC,EACPC,KAAQC,EACRC,IAAOC,EACPC,MAASC,EACTC,QAAWC,EACXC,OAAUC,EACVC,KAAQC,EACRC,KAAQC,EACR,iBAAkBC,GAGdC,EAAyBC,GAAS,IAC/BC,EAAUC,EAAmBC,mBAGhCC,EAAmBJ,GAA4B,KACnD,MAAQK,MAAMC,QAAEA,EAAU,eAAIC,EAAc,IAAO,CAAI,EAAAC,KAAAA,EAAO,IAAOL,EAAAK,KAGrE,IAAIC,EAAS,GAETC,EAA4D,KACvDD,EAAAF,GAAaI,KAAKC,IAQrBA,EAAgBC,QACHH,EAAAE,GAEVA,KAGH,MAAAE,EAAYJ,EAAeF,EAAKO,QAAOC,GAAQA,GAAQA,EAAKN,EAAcJ,WAAaE,EAkCtF,OARaS,EAbK,CACvBX,QAAS,GACTI,aAAc,CACZJ,QAAS,GACTC,YAAa,GACbW,cAAe,GACfL,OAAO,GAETN,YAAa,GACbC,KAAM,GACNW,UAAW,IAG+B,CAC1Cb,UACAa,UAAShB,EAAAgB,UACTC,YAAWjB,EAAAiB,YACXV,eACAH,YAAaE,EACbD,KAAMM,GAED,IAaA,SAAAG,EAAMI,EAAuBC,GAEhC,IAAAC,EADaC,EAAY,GAAIzB,EAAuB0B,MAAOJ,EAAQC,IAChD,CAAC,EAExB,GAAInB,EAAAuB,cACE,IAEKH,EAAAI,EAAexB,gBAAeoB,SAEhCK,GACGC,QAAAD,MAAM,UAAWA,EAAK,CAI3B,OAAAL,CAAA,QAGIO,EAAA,CACXC,WA3BF,WACE,GAA6B,IAAzB5B,OAASK,KAAKwB,OAGhB,YADAH,QAAQI,IAAI,QAGR,MAAAC,EAAMC,EAAmBhC,EAAQK,MAC3B4B,EAAAjC,EAAAgB,UAAWe,EAAG,IAsB5BG,EAAQC,EAAqBrB"}
1
+ {"version":3,"file":"data-chart.vue.mjs","sources":["../../../../../../packages/components/src/data-chart/src/data-chart.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartData, EChartsOption, IFormatPublicData } from './utils/types'\nimport type { IconRow } from './utils/types'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { JsonToExcel } from '@qxs-bns/utils'\nimport { cloneDeep, merge as lodashMerge } from 'lodash-es'\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 { defaultChartOption } from './utils/config'\nimport { InjectionChartMerge } from './utils/injectionKeys'\nimport { safeEvalConfig } from './utils/safe-eval'\nimport { useDataToExcelJson } from './utils/useCharts'\n\ndefineOptions({\n name: 'QxsDataChart',\n})\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} = defineProps<{\n modelName?: string\n showTypeName?: IconRow['showTypeName']\n subShowType?: string\n data?: EChartData\n chartOptions?: EChartsOption\n jsCodeSnippet?: string\n}>()\n\nconst ns = useNamespace('data-chart')\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 = []\n\n let xGroupByDesc: EChartData['desc']['groupByDesc'][0] | null = null\n xValue = groupByDesc?.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 const dataValue = xGroupByDesc ? data.filter(item => item && item[xGroupByDesc!.colDesc!]) : 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\ndefineExpose({\n exportExal,\n})\nprovide(InjectionChartMerge, merge)\n</script>\n\n<template>\n <component\n :is=\"coms[showTypeName]\"\n :key=\"showTypeName\"\n :class=\"[ns.e('wrapper')]\"\n :sub-show-type=\"subShowType\"\n :chart-data=\"formatPublicData\"\n :chart-options=\"chartOptions\"\n />\n</template>\n"],"names":["ns","useNamespace","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","map","groupByDescItem","xAxis","dataValue","filter","item","modelName","subShowType","groupByValues","__expose","exportExal","length","console","log","arr","useDataToExcelJson","JsonToExcel","provide","InjectionChartMerge","config","defaultConfig","conf","lodashMerge","value","jsCodeSnippet","safeEvalConfig","error"],"mappings":"+4CAoDM,MAAAA,EAAKC,EAAa,cAElBC,EAEF,CACFC,MAASC,EACTC,IAAOC,EACPC,KAAQC,EACRC,IAAOC,EACPC,MAASC,EACTC,QAAWC,EACXC,OAAUC,EACVC,KAAQC,EACRC,KAAQC,EACR,iBAAkBC,GAGdC,EAAyBC,GAAS,IAC/BC,EAAUC,EAAmBC,mBAGhCC,EAAmBJ,GAA4B,KACnD,MAAQK,MAAMC,QAAEA,EAAU,eAAIC,EAAc,IAAO,CAAI,EAAAC,KAAAA,EAAO,IAAOL,EAAAK,KAGrE,IAAIC,EAAS,GAETC,EAA4D,KACvDD,EAAAF,GAAaI,KAAKC,IAQrBA,EAAgBC,QACHH,EAAAE,GAEVA,KAGH,MAAAE,EAAYJ,EAAeF,EAAKO,QAAOC,GAAQA,GAAQA,EAAKN,EAAcJ,WAAaE,EA0BtF,MAba,CAClBF,QAASA,GAAW,GACpBW,UAASd,EAAAc,UACTC,YAAWf,EAAAe,YACXR,aAAcA,GAAgB,CAC5BJ,QAAS,GACTC,YAAa,GACbY,cAAe,GACfN,OAAO,GAETN,YAAaE,EACbD,KAAMM,EAED,WA8BIM,EAAA,CACXC,WA3BF,WACE,GAA6B,IAAzBlB,OAASK,KAAKc,OAGhB,YADAC,QAAQC,IAAI,QAGR,MAAAC,EAAMC,EAAmBvB,EAAQK,MAC3BmB,EAAAxB,EAAAc,UAAWQ,EAAG,IAsB5BG,EAAQC,GApBC,SAAMC,EAAuBC,GAEhC,IAAAC,EADaC,EAAY,GAAIlC,EAAuBmC,MAAOJ,EAAQC,IAChD,CAAC,EAExB,GAAI5B,EAAAgC,cACE,IAEKH,EAAAI,EAAejC,gBAAe6B,SAEhCK,GACGd,QAAAc,MAAM,UAAWA,EAAK,CAI3B,OAAAL,CAAA"}
@@ -1,2 +1,2 @@
1
- import{merge as e}from"lodash-es";const 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:["lightskyblue","yellow","orangered"]}}},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 o(t,o){const a={};return t.forEach((t=>{a[t.showTypeName]=e(t.baseConfig,o)})),a}const a=o(t.data,{backgroundColor:"transparent",title:{textStyle:{fontSize:14,lineHeight:16}}}),s=new Map;function i(e){const{adcode:t}=e;if(s.has(t)){const e=s.get(t);if(e)return Promise.resolve(e)}return new Promise((o=>{const a={showbiz:!1,extensions:"all",...e};import("@amap/amap-jsapi-loader").then((e=>{let{default:t}=e;return t.load({key:"2e820fac2a528b016a4cb95bb463e69e",version:"1.4.15",plugins:["AMap.DistrictSearch"],AMapUI:{version:"1.1",plugins:["geo/DistrictExplorer"]}})})).then((i=>{new i.DistrictSearch(a).search(e.adcode,((e,a)=>{AMapUI.loadUI(["geo/DistrictExplorer"],(e=>{(new e).loadAreaNode(a.districtList[0].adcode,((e,a)=>{if(e)return void console.error(e);const i={features:[],type:"FeatureCollection"};i.features=a.getSubFeatures(),s.set(t,i),o(i)}))}))}))})).catch((e=>{console.error("Failed to load map:",e),o({features:[],type:"FeatureCollection"})}))}))}export{a as defaultChartOption,i as getGeoJsonData,t as iconList,o as setDefaultChartOption};
1
+ import{merge as e}from"lodash-es";const t={get:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"showTypeName",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"table";return t.data.find((t=>t[e].toString()===o||t[e]===o))},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:["lightskyblue","yellow","orangered"]}}},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 o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.get("showType",e)}function a(t,o){const a={};return t.forEach((t=>{a[t.showTypeName]=e(t.baseConfig,o)})),a}const i=a(t.data,{backgroundColor:"transparent",title:{textStyle:{fontSize:14,lineHeight:16}}}),s=new Map;function l(e){const{adcode:t}=e;if(s.has(t)){const e=s.get(t);if(e)return Promise.resolve(e)}return new Promise((o=>{const a={showbiz:!1,extensions:"all",...e};import("@amap/amap-jsapi-loader").then((e=>{let{default:t}=e;return t.load({key:"2e820fac2a528b016a4cb95bb463e69e",version:"1.4.15",plugins:["AMap.DistrictSearch"],AMapUI:{version:"1.1",plugins:["geo/DistrictExplorer"]}})})).then((i=>{new i.DistrictSearch(a).search(e.adcode,((e,a)=>{AMapUI.loadUI(["geo/DistrictExplorer"],(e=>{(new e).loadAreaNode(a.districtList[0].adcode,((e,a)=>{if(e)return void console.error(e);const i={features:[],type:"FeatureCollection"};i.features=a.getSubFeatures(),s.set(t,i),o(i)}))}))}))})).catch((e=>{console.error("Failed to load map:",e),o({features:[],type:"FeatureCollection"})}))}))}export{i as defaultChartOption,l as getGeoJsonData,t as iconList,a as setDefaultChartOption,o as showTypeText};
2
2
  //# sourceMappingURL=config.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","sources":["../../../../../../../packages/components/src/data-chart/src/utils/config.ts"],"sourcesContent":["import type { GeoJson, IconRow, IGroupByInfos, ISelectInfos } from '../types'\nimport { merge } from 'lodash-es'\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: ['lightskyblue', 'yellow', 'orangered'],\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>()\nexport function getGeoJsonData(options: any): Promise<GeoJson> {\n const { adcode } = options\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 return new Promise((resolve) => {\n const opt = {\n showbiz: false,\n extensions: 'all',\n ...options,\n }\n\n import('@amap/amap-jsapi-loader')\n .then(({ default: AMapLoader }) => AMapLoader.load({\n key: '2e820fac2a528b016a4cb95bb463e69e',\n version: '1.4.15',\n plugins: ['AMap.DistrictSearch'],\n AMapUI: {\n version: '1.1',\n plugins: ['geo/DistrictExplorer'],\n },\n }))\n .then((AMap) => {\n const district = new AMap.DistrictSearch(opt)\n // 行政区查询\n district.search(options.adcode, (_: any, result: any) => {\n // eslint-disable-next-line\n // @ts-expect-error\n AMapUI.loadUI(['geo/DistrictExplorer'], (DistrictExplorer: any) => {\n // 创建一个实例\n const districtExplorer = new DistrictExplorer()\n districtExplorer.loadAreaNode(result.districtList[0].adcode, (error: any, areaNode: any) => {\n if (error) {\n console.error(error)\n return\n }\n const mapJson: GeoJson = {\n features: [],\n type: 'FeatureCollection',\n }\n // geoJson必须这种格式\n mapJson.features = areaNode.getSubFeatures()\n\n // 将获取到的 GeoJSON 数据存入缓存\n geoJsonCache.set(adcode, mapJson)\n\n resolve(mapJson)\n })\n })\n })\n })\n .catch((error) => {\n console.error('Failed to load map:', error)\n resolve({\n features: [],\n type: 'FeatureCollection',\n })\n })\n })\n}\n"],"names":["iconList","data","showTypeName","label","coverImg","disabled","subTypeList","showType","baseConfig","value","icon","tooltipContent","tooltip","confine","trigger","axisPointer","type","toolbox","show","showTitle","feature","saveAsImage","legend","top","grid","left","bottom","containLabel","xAxis","boundaryGap","yAxis","dataZoom","_","groupByInfos","groupByInfosLenght","length","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","item","merge","defaultChartOption","backgroundColor","title","textStyle","fontSize","lineHeight","geoJsonCache","Map","getGeoJsonData","options","adcode","has","cachedGeoJson","get","Promise","resolve","opt","showbiz","extensions","import","then","_ref2","default","AMapLoader","load","key","version","plugins","AMapUI","AMap","DistrictSearch","search","result","loadUI","DistrictExplorer","loadAreaNode","districtList","error","areaNode","console","mapJson","features","getSubFeatures","set","catch"],"mappings":"kCAYO,MAAMA,EAGT,CAIFC,KAAM,CACJ,CACEC,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,CACEG,MAAO,cACPC,KAAM,cACNC,eAAgB,OAElB,CACEF,MAAO,aACPC,KAAM,kBACNC,eAAgB,UAGpBH,WAAY,CACVI,QAAS,CACPC,SAAS,EACTC,QAAS,OACTC,YAAa,CACXC,KAAM,SAGVC,QAAS,CACPC,MAAM,EACNC,WAAW,EACXC,QAAS,CAGPC,YAAa,CAAA,IAGjBC,OAAQ,CACNN,KAAM,SACNO,IAAK,QAEPC,KAAM,CACJC,KAAM,IACNC,OAAQ,OACRC,cAAc,GAEhBC,MAAO,CACLZ,KAAM,WACNa,aAAa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,WAAY,SACTT,GAGEU,OAAA,2BACJC,MAAKC,IAAA,IAAGC,QAASC,GAAiBF,EAAA,OAAAE,EAAWC,KAAK,CACjDC,IAAK,mCACLC,QAAS,SACTC,QAAS,CAAC,uBACVC,OAAQ,CACNF,QAAS,MACTC,QAAS,CAAC,0BAEZ,IACDP,MAAMS,IACY,IAAIA,EAAKC,eAAed,GAEhCe,OAAOtB,EAAQC,QAAQ,CAAC9C,EAAQoE,KAGvCJ,OAAOK,OAAO,CAAC,yBAA0BC,KAEd,IAAIA,GACZC,aAAaH,EAAOI,aAAa,GAAG1B,QAAQ,CAAC2B,EAAYC,KACxE,GAAID,EAEF,YADAE,QAAQF,MAAMA,GAGhB,MAAMG,EAAmB,CACvBC,SAAU,GACV7F,KAAM,qBAGA4F,EAAAC,SAAWH,EAASI,iBAGfpC,EAAAqC,IAAIjC,EAAQ8B,GAEzBzB,EAAQyB,EAAO,GAChB,GACF,GACF,IAEFI,OAAOP,IACEE,QAAAF,MAAM,sBAAuBA,GAC7BtB,EAAA,CACN0B,SAAU,GACV7F,KAAM,qBACP,GACF,GAEP"}
1
+ {"version":3,"file":"config.mjs","sources":["../../../../../../../packages/components/src/data-chart/src/utils/config.ts"],"sourcesContent":["import type { GeoJson, IconRow, IGroupByInfos, ISelectInfos } from './types'\nimport { merge } from 'lodash-es'\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: ['lightskyblue', 'yellow', 'orangered'],\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>()\nexport function getGeoJsonData(options: any): Promise<GeoJson> {\n const { adcode } = options\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 return new Promise((resolve) => {\n const opt = {\n showbiz: false,\n extensions: 'all',\n ...options,\n }\n\n import('@amap/amap-jsapi-loader')\n .then(({ default: AMapLoader }) => AMapLoader.load({\n key: '2e820fac2a528b016a4cb95bb463e69e',\n version: '1.4.15',\n plugins: ['AMap.DistrictSearch'],\n AMapUI: {\n version: '1.1',\n plugins: ['geo/DistrictExplorer'],\n },\n }))\n .then((AMap) => {\n const district = new AMap.DistrictSearch(opt)\n // 行政区查询\n district.search(options.adcode, (_: any, result: any) => {\n // eslint-disable-next-line\n // @ts-expect-error\n AMapUI.loadUI(['geo/DistrictExplorer'], (DistrictExplorer: any) => {\n // 创建一个实例\n const districtExplorer = new DistrictExplorer()\n districtExplorer.loadAreaNode(result.districtList[0].adcode, (error: any, areaNode: any) => {\n if (error) {\n console.error(error)\n return\n }\n const mapJson: GeoJson = {\n features: [],\n type: 'FeatureCollection',\n }\n // geoJson必须这种格式\n mapJson.features = areaNode.getSubFeatures()\n\n // 将获取到的 GeoJSON 数据存入缓存\n geoJsonCache.set(adcode, mapJson)\n\n resolve(mapJson)\n })\n })\n })\n })\n .catch((error) => {\n console.error('Failed to load map:', error)\n resolve({\n features: [],\n type: 'FeatureCollection',\n })\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","showTypeText","setDefaultChartOption","option","changeConfig","obj","forEach","merge","defaultChartOption","backgroundColor","title","textStyle","fontSize","lineHeight","geoJsonCache","Map","getGeoJsonData","options","adcode","has","cachedGeoJson","Promise","resolve","opt","showbiz","extensions","import","then","_ref2","default","AMapLoader","load","key","version","plugins","AMapUI","AMap","DistrictSearch","search","result","loadUI","DistrictExplorer","loadAreaNode","districtList","error","areaNode","console","mapJson","features","getSubFeatures","set","catch"],"mappings":"kCAYO,MAAMA,EAGT,CACFC,IAAK,WAAgE,IAA/DC,EAAsBC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAA,eAAgBG,yDAAa,QACvD,OAAON,EAASO,KAAKC,MAAKC,GAAQA,EAAKP,GAAMQ,aAAeJ,GAASG,EAAKP,KAAUI,GACtF,EACAC,KAA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,GACF,IAEFI,OAAOP,IACEE,QAAAF,MAAM,sBAAuBA,GAC7BtB,EAAA,CACN0B,SAAU,GACVhH,KAAM,qBACP,GACF,GAEP"}
@@ -1 +1 @@
1
- {"version":3,"file":"safe-eval.mjs","sources":["../../../../../../../packages/components/src/data-chart/src/utils/safe-eval.ts"],"sourcesContent":["import type { EChartsOption } from '../types'\n\n/**\n * 安全的配置处理函数\n * @param jsCode - JavaScript 代码片段\n * @param config - ECharts 配置对象\n * @returns 处理后的配置对象\n */\nexport function safeEvalConfig(jsCode: string, config: EChartsOption): EChartsOption {\n // 预定义允许的操作和函数\n const allowedGlobals = {\n Math,\n Date,\n Array,\n Object,\n String,\n Number,\n Boolean,\n console,\n JSON,\n }\n\n // 创建安全的执行环境\n const sandbox = {\n ...allowedGlobals,\n config: { ...config },\n }\n\n // 使用 with 和 Proxy 创建安全的执行环境\n const handler: ProxyHandler<typeof sandbox> = {\n has: (_target, _key) => {\n return true // 使所有变量查找都在 sandbox 中\n },\n get: (target, key) => {\n // 处理 Symbol 类型的 key\n if (typeof key === 'symbol') {\n if (key === Symbol.unscopables) {\n return undefined\n }\n return Reflect.get(target, key)\n }\n return target[key as keyof typeof target]\n },\n }\n\n const proxiedSandbox = new Proxy(sandbox, handler)\n\n try {\n // 使用 with 语句创建局部作用域\n const code = `with (sandbox) { ${jsCode} }`\n // eslint-disable-next-line no-new-func\n const fn = new Function('sandbox', code)\n fn(proxiedSandbox)\n\n return proxiedSandbox.config as EChartsOption\n }\n catch (error) {\n console.error('配置处理失败:', error)\n return config\n }\n}\n"],"names":["safeEvalConfig","jsCode","config","sandbox","Math","Date","Array","Object","String","Number","Boolean","console","JSON","proxiedSandbox","Proxy","has","_target","_key","get","target","key","Symbol","unscopables","Reflect","code","Function","fn","error"],"mappings":"AAQgB,SAAAA,EAAeC,EAAgBC,GAE7C,MAaMC,EAAU,IAbO,CACrBC,UACAC,UACAC,YACAC,cACAC,cACAC,cACAC,gBACAC,gBACAC,WAMAV,OAAQ,IAAKA,IAoBTW,EAAiB,IAAIC,MAAMX,EAhBa,CAC5CY,IAAKA,CAACC,EAASC,KACN,EAETC,IAAKA,CAACC,EAAQC,KAER,GAAe,iBAARA,EAAkB,CACvB,GAAAA,IAAQC,OAAOC,YACV,OAEF,OAAAC,QAAQL,IAAIC,EAAQC,EAC7B,CACA,OAAOD,EAAOC,EAA0B,IAMxC,IAEI,MAAAI,EAAO,oBAAoBvB,MAKjC,OAHW,IAAIwB,SAAS,UAAWD,EACnCE,CAAGb,GAEIA,EAAeX,aAEjByB,GAEE,OADChB,QAAAgB,MAAM,UAAWA,GAClBzB,CACT,CACF"}
1
+ {"version":3,"file":"safe-eval.mjs","sources":["../../../../../../../packages/components/src/data-chart/src/utils/safe-eval.ts"],"sourcesContent":["import type { EChartsOption } from './types'\n\n/**\n * 安全的配置处理函数\n * @param jsCode - JavaScript 代码片段\n * @param config - ECharts 配置对象\n * @returns 处理后的配置对象\n */\nexport function safeEvalConfig(jsCode: string, config: EChartsOption): EChartsOption {\n // 预定义允许的操作和函数\n const allowedGlobals = {\n Math,\n Date,\n Array,\n Object,\n String,\n Number,\n Boolean,\n console,\n JSON,\n }\n\n // 创建安全的执行环境\n const sandbox = {\n ...allowedGlobals,\n config: { ...config },\n }\n\n // 使用 with 和 Proxy 创建安全的执行环境\n const handler: ProxyHandler<typeof sandbox> = {\n has: (_target, _key) => {\n return true // 使所有变量查找都在 sandbox 中\n },\n get: (target, key) => {\n // 处理 Symbol 类型的 key\n if (typeof key === 'symbol') {\n if (key === Symbol.unscopables) {\n return undefined\n }\n return Reflect.get(target, key)\n }\n return target[key as keyof typeof target]\n },\n }\n\n const proxiedSandbox = new Proxy(sandbox, handler)\n\n try {\n // 使用 with 语句创建局部作用域\n const code = `with (sandbox) { ${jsCode} }`\n // eslint-disable-next-line no-new-func\n const fn = new Function('sandbox', code)\n fn(proxiedSandbox)\n\n return proxiedSandbox.config as EChartsOption\n }\n catch (error) {\n console.error('配置处理失败:', error)\n return config\n }\n}\n"],"names":["safeEvalConfig","jsCode","config","sandbox","Math","Date","Array","Object","String","Number","Boolean","console","JSON","proxiedSandbox","Proxy","has","_target","_key","get","target","key","Symbol","unscopables","Reflect","code","Function","fn","error"],"mappings":"AAQgB,SAAAA,EAAeC,EAAgBC,GAE7C,MAaMC,EAAU,IAbO,CACrBC,UACAC,UACAC,YACAC,cACAC,cACAC,cACAC,gBACAC,gBACAC,WAMAV,OAAQ,IAAKA,IAoBTW,EAAiB,IAAIC,MAAMX,EAhBa,CAC5CY,IAAKA,CAACC,EAASC,KACN,EAETC,IAAKA,CAACC,EAAQC,KAER,GAAe,iBAARA,EAAkB,CACvB,GAAAA,IAAQC,OAAOC,YACV,OAEF,OAAAC,QAAQL,IAAIC,EAAQC,EAC7B,CACA,OAAOD,EAAOC,EAA0B,IAMxC,IAEI,MAAAI,EAAO,oBAAoBvB,MAKjC,OAHW,IAAIwB,SAAS,UAAWD,EACnCE,CAAGb,GAEIA,EAAeX,aAEjByB,GAEE,OADChB,QAAAgB,MAAM,UAAWA,GAClBzB,CACT,CACF"}
@@ -1,2 +1,2 @@
1
- import*as e from"echarts";import t from"../components/empty.svg.mjs";import{useMouseInElement as o,watchDebounced as i,useElementSize as n}from"@vueuse/core";import{onMounted as r,onUnmounted as a}from"vue";function s(n){let{chartDOM:s,chartData:c,chartOptions:u,mountedBefore:d,initAfter:p,callback:f}=n,m=null,v=!1;const g=window.devicePixelRatio||1;function h(){m&&!m.isDisposed()&&(m.dispose(),m=null)}function x(){for(var t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];if(s.value)try{m&&!m.isDisposed()||(m=e.init(s.value,null,{devicePixelRatio:g,renderer:"svg"})),m.showLoading(),c.value?.data?.length?(!0===v&&(o[1]||(o[1]={}),o[1].notMerge=!0),v=!1,m.setOption(...o)):o=y()}catch(t){console.log("error: ",t),m&&!m.isDisposed()&&h(),s.value&&!m&&(m=e.init(s.value,null,{devicePixelRatio:g,renderer:"svg"}),o=y("配置项错误"))}finally{m?.setOption(...o),m?.hideLoading()}}function y(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"暂无数据";const o={title:[{text:c.value?.modelName,...u.value.title},{subtext:e,top:"center",left:"center",text:" {a|}",itemGap:-20,textStyle:{align:"center",rich:{a:{color:"#000",fontSize:"16",height:80,width:160,backgroundColor:{image:t}}}},subtextStyle:{fontSize:16}}]};return v=!0,[o,{notMerge:!0,replaceMerge:["xAxis","yAxis","series"],lazyUpdate:!1}]}const{isOutside:w}=o(s);return i(w,(e=>{var t;"boolean"==typeof e&&(t=!e,m?.isDisposed()||m?.setOption({toolbox:{show:t}}))}),{debounce:200}),i((()=>u.value),(()=>x(u.value)),{debounce:500,deep:!0}),r((async()=>{d&&await d(),x(u.value),f&&f(m),p&&await p(),m&&l(m,s)})),a((()=>{m&&(m.getZr()?.off("mousemove"),m.getZr()?.off("mouseout"),h())})),{myChart:m}}function l(e,t){const{width:o,height:r}=n(t);i([o,r],(()=>{e&&e.resize()}))}function c(e){const{desc:{colDesc:t=[],groupByDesc:o=[]}={},data:i=[]}=e,n=[...o.map((e=>e.colDesc)),...t].filter((e=>e)),r=i.map((e=>n.map((t=>e[t]||""))));return[n,...r]}export{s as useCharts,c as useDataToExcelJson,l as useResize};
1
+ import*as e from"echarts";import t from"../components/empty.svg.mjs";import{useMouseInElement as o,watchDebounced as i,useElementSize as n}from"@vueuse/core";import{onMounted as a,onUnmounted as r}from"vue";function s(n){let{chartDOM:s,chartData:c,chartOptions:u,mountedBefore:d,initAfter:p,callback:m}=n,f=null,g=!1;const h=window.devicePixelRatio||1;function v(){f&&!f.isDisposed()&&(f.dispose(),f=null)}async function w(){for(var t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];if(s.value)try{f&&!f.isDisposed()||(f=e.init(s.value,null,{devicePixelRatio:h,renderer:"svg"})),f.showLoading(),c.value?.data?.length?(!0===g&&(o[1]||(o[1]={}),o[1].notMerge=!0),g=!1,f.setOption(...o)):o=await x()}catch(t){console.log("error: ",t),f&&!f.isDisposed()&&v(),s.value&&!f&&(f=e.init(s.value,null,{devicePixelRatio:h,renderer:"svg"}),o=await x("配置项错误"))}finally{f?.setOption(...o),f?.hideLoading()}}function x(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"暂无数据";return new Promise((o=>{const i=new Image;i.src=t,i.onload=()=>{const n=i.width/i.height,a={title:[{text:c.value?.modelName,...u.value.title},{subtext:e,top:"center",left:"center",text:"{a|}",itemGap:-20,subtextStyle:{fontSize:14},textStyle:{align:"center",rich:{a:{height:100/n,width:100,backgroundColor:{image:t}}}}}]};g=!0,o([a,{notMerge:!0,replaceMerge:["xAxis","yAxis","series"],lazyUpdate:!1}])}}))}const{isOutside:y}=o(s);return i(y,(e=>{var t;"boolean"==typeof e&&(t=!e,f?.isDisposed()||f?.setOption({toolbox:{show:t}}))}),{debounce:200}),i((()=>u.value),(()=>w(u.value)),{debounce:500,deep:!0}),a((async()=>{d&&await d(),w(u.value),m&&m(f),p&&await p(),f&&l(f,s)})),r((()=>{f&&(f.getZr()?.off("mousemove"),f.getZr()?.off("mouseout"),v())})),{myChart:f}}function l(e,t){const{width:o,height:a}=n(t);i([o,a],(()=>{e&&e.resize()}))}function c(e){const{desc:{colDesc:t=[],groupByDesc:o=[]}={},data:i=[]}=e,n=[...o.map((e=>e.colDesc)),...t].filter((e=>e)),a=i.map((e=>n.map((t=>e[t]||""))));return[n,...a]}export{s as useCharts,c as useDataToExcelJson,l as useResize};
2
2
  //# sourceMappingURL=useCharts.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCharts.mjs","sources":["../../../../../../../packages/components/src/data-chart/src/utils/useCharts.ts"],"sourcesContent":["import type { ECharts, SetOptionOpts } from 'echarts'\nimport type { Ref } from 'vue'\nimport type { EChartData, EChartsOption, IFormatPublicData } from '../types'\nimport * as echarts from 'echarts'\n\n// 使用别名路径导入 SVG\nimport emptyImg from '../components/empty.svg'\n\nexport function useCharts({ chartDOM, chartData, chartOptions, mountedBefore, initAfter, callback }: {\n chartDOM: Ref<HTMLElement | null>\n chartData: Ref<IFormatPublicData>\n chartOptions: Ref<EChartsOption>\n mountedBefore?: () => void\n initAfter?: () => void\n callback?: (e: ECharts | null) => void\n}) {\n let myChart: ECharts | null = null\n let isEmpty = false\n\n // 获取设备像素比\n const dpr = window.devicePixelRatio || 1\n\n function disposeChart() {\n if (myChart && !myChart.isDisposed()) {\n myChart.dispose()\n myChart = null\n }\n }\n\n function renderChart(...opt: [EChartsOption, SetOptionOpts?]) {\n if (!chartDOM.value) {\n return\n }\n try {\n if (myChart && !myChart.isDisposed()) {\n myChart.showLoading()\n }\n else {\n // 如果实例已被销毁,重新创建\n myChart = echarts.init(chartDOM.value, null, {\n devicePixelRatio: dpr,\n renderer: 'svg',\n })\n myChart.showLoading()\n }\n if (chartData.value?.data?.length) {\n if (isEmpty === true) {\n if (!opt[1]) {\n opt[1] = {}\n }\n opt[1].notMerge = true\n }\n isEmpty = false\n myChart.setOption(...opt)\n }\n else {\n opt = setEmpty()\n }\n }\n catch (error) {\n console.log('error: ', error)\n if (myChart && !myChart.isDisposed()) {\n disposeChart()\n }\n if (chartDOM.value && !myChart) {\n // 如果实例已被销毁,重新创建\n myChart = echarts.init(chartDOM.value, null, {\n devicePixelRatio: dpr,\n renderer: 'svg',\n })\n opt = setEmpty('配置项错误')\n }\n }\n finally {\n myChart?.setOption(...opt)\n myChart?.hideLoading()\n }\n }\n\n function setEmpty(subtext = '暂无数据'): [EChartsOption, SetOptionOpts] {\n const obj: EChartsOption = {\n title: [{\n text: chartData.value?.modelName,\n ...chartOptions.value.title,\n }, {\n subtext,\n top: 'center',\n left: 'center',\n text: ' {a|}',\n itemGap: -20,\n textStyle: {\n align: 'center',\n rich: {\n a: {\n color: '#000',\n fontSize: '16',\n height: 80,\n width: 160,\n backgroundColor: {\n image: emptyImg,\n },\n },\n },\n },\n subtextStyle: {\n fontSize: 16,\n },\n }],\n }\n isEmpty = true\n return [obj, {\n notMerge: true,\n replaceMerge: ['xAxis', 'yAxis', 'series'],\n lazyUpdate: false,\n }]\n }\n\n function toggleToolbox(show: boolean) {\n if (!myChart?.isDisposed()) {\n myChart?.setOption({\n toolbox: {\n show,\n },\n })\n }\n }\n\n const { isOutside: mouseInChart } = useMouseInElement(chartDOM)\n watchDebounced(mouseInChart, (newVal) => {\n if (typeof newVal !== 'boolean') {\n return\n }\n toggleToolbox(!newVal)\n }, { debounce: 200 })\n\n watchDebounced(\n () => chartOptions.value,\n () => renderChart(chartOptions.value),\n { debounce: 500, deep: true },\n )\n\n onMounted(async () => {\n if (mountedBefore) {\n await mountedBefore()\n }\n renderChart(chartOptions.value)\n if (callback) {\n callback(myChart)\n }\n if (initAfter) {\n await initAfter()\n }\n if (myChart) {\n useResize(myChart, chartDOM)\n }\n })\n\n onUnmounted(() => {\n if (myChart) {\n myChart.getZr()?.off('mousemove')\n myChart.getZr()?.off('mouseout')\n disposeChart()\n }\n })\n\n return {\n myChart,\n }\n}\n\nexport function useResize(myChart: ECharts, chartDOM: Ref<HTMLElement | null>) {\n const { width, height } = useElementSize(chartDOM)\n watchDebounced([width, height], () => {\n if (myChart) {\n myChart.resize()\n }\n })\n}\n\nexport function useDataToExcelJson(dataSource: EChartData) {\n const { desc: { colDesc = [], groupByDesc = [] } = {}, data = [] } = dataSource\n const header = [...groupByDesc.map(item => item.colDesc), ...colDesc].filter(v => v) as string[]\n const json = data.map((item) => {\n return header.map((headerItem) => {\n return item[headerItem as keyof typeof item] || ''\n })\n })\n return [header, ...json]\n}\n"],"names":["useCharts","_ref","chartDOM","chartData","chartOptions","mountedBefore","initAfter","callback","myChart","isEmpty","dpr","window","devicePixelRatio","disposeChart","isDisposed","dispose","renderChart","_len","arguments","length","opt","Array","_key","value","echarts","init","renderer","showLoading","data","notMerge","setOption","setEmpty","error","console","log","hideLoading","subtext","obj","title","text","modelName","top","left","itemGap","textStyle","align","rich","a","color","fontSize","height","width","backgroundColor","image","emptyImg","subtextStyle","replaceMerge","lazyUpdate","isOutside","mouseInChart","useMouseInElement","watchDebounced","newVal","show","toolbox","debounce","deep","onMounted","async","useResize","onUnmounted","getZr","off","useElementSize","resize","useDataToExcelJson","dataSource","desc","colDesc","groupByDesc","header","map","item","filter","v","json","headerItem"],"mappings":"+MAQgB,SAAAA,EAAAC,GAOb,IAPuBC,SAAEA,EAAUC,UAAAA,EAAAC,aAAWA,gBAAcC,EAAeC,UAAAA,EAAAC,SAAWA,GAOtFN,EACGO,EAA0B,KAC1BC,GAAU,EAGR,MAAAC,EAAMC,OAAOC,kBAAoB,EAEvC,SAASC,IACHL,IAAYA,EAAQM,eACtBN,EAAQO,UACEP,EAAA,KAEd,CAEA,SAASQ,IAAqD,IAAA,IAAAC,EAAAC,UAAAC,OAAtCC,EAAsCC,IAAAA,MAAAJ,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAAtCF,EAAsCE,GAAAJ,UAAAI,GACxD,GAACpB,EAASqB,MAGV,IACEf,IAAYA,EAAQM,eAKtBN,EAAUgB,EAAQC,KAAKvB,EAASqB,MAAO,KAAM,CAC3CX,iBAAkBF,EAClBgB,SAAU,SANZlB,EAAQmB,cAUNxB,EAAUoB,OAAOK,MAAMT,SACT,IAAZV,IACGW,EAAI,KACHA,EAAA,GAAK,CAAC,GAERA,EAAA,GAAGS,UAAW,GAEVpB,GAAA,EACFD,EAAAsB,aAAaV,IAGrBA,EAAMW,UAGHC,GACGC,QAAAC,IAAI,UAAWF,GACnBxB,IAAYA,EAAQM,cACTD,IAEXX,EAASqB,QAAUf,IAErBA,EAAUgB,EAAQC,KAAKvB,EAASqB,MAAO,KAAM,CAC3CX,iBAAkBF,EAClBgB,SAAU,QAEZN,EAAMW,EAAS,SAEnB,CACA,QACWvB,GAAAsB,aAAaV,GACtBZ,GAAS2B,aACX,CACF,CAES,SAAAJ,IAA2D,IAAlDK,yDAAU,OAC1B,MAAMC,EAAqB,CACzBC,MAAO,CAAC,CACNC,KAAMpC,EAAUoB,OAAO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dF,EAAOC,KAAKK,GACVJ,EAAKI,IAAoC,OAG7C,MAAA,CAACN,KAAWK,EACrB"}
1
+ {"version":3,"file":"useCharts.mjs","sources":["../../../../../../../packages/components/src/data-chart/src/utils/useCharts.ts"],"sourcesContent":["import type { ECharts, SetOptionOpts } from 'echarts'\nimport type { Ref } from 'vue'\nimport type { EChartData, EChartsOption, IFormatPublicData } from './types'\nimport * as echarts from 'echarts'\n\n// 使用别名路径导入 SVG\nimport emptyImg from '../components/empty.svg'\n\nexport function useCharts({ chartDOM, chartData, chartOptions, mountedBefore, initAfter, callback }: {\n chartDOM: Ref<HTMLElement | null>\n chartData: Ref<IFormatPublicData>\n chartOptions: Ref<EChartsOption>\n mountedBefore?: () => void\n initAfter?: () => void\n callback?: (e: ECharts | null) => void\n}) {\n let myChart: ECharts | null = null\n let isEmpty = false\n\n // 获取设备像素比\n const dpr = window.devicePixelRatio || 1\n\n function disposeChart() {\n if (myChart && !myChart.isDisposed()) {\n myChart.dispose()\n myChart = null\n }\n }\n\n async function renderChart(...opt: [EChartsOption, SetOptionOpts?]) {\n if (!chartDOM.value) {\n return\n }\n try {\n if (myChart && !myChart.isDisposed()) {\n myChart.showLoading()\n }\n else {\n // 如果实例已被销毁,重新创建\n myChart = echarts.init(chartDOM.value, null, {\n devicePixelRatio: dpr,\n renderer: 'svg',\n })\n myChart.showLoading()\n }\n if (chartData.value?.data?.length) {\n if (isEmpty === true) {\n if (!opt[1]) {\n opt[1] = {}\n }\n opt[1].notMerge = true\n }\n isEmpty = false\n myChart.setOption(...opt)\n }\n else {\n opt = await setEmpty()\n }\n }\n catch (error) {\n console.log('error: ', error)\n if (myChart && !myChart.isDisposed()) {\n disposeChart()\n }\n if (chartDOM.value && !myChart) {\n // 如果实例已被销毁,重新创建\n myChart = echarts.init(chartDOM.value, null, {\n devicePixelRatio: dpr,\n renderer: 'svg',\n })\n opt = await setEmpty('配置项错误')\n }\n }\n finally {\n myChart?.setOption(...opt)\n myChart?.hideLoading()\n }\n }\n\n function setEmpty(subtext = '暂无数据'): Promise<[EChartsOption, SetOptionOpts]> {\n return new Promise((resolve) => {\n const img = new Image()\n img.src = emptyImg\n\n img.onload = () => {\n const aspectRatio = img.width / img.height\n\n const obj: EChartsOption = {\n title: [{\n text: chartData.value?.modelName,\n ...chartOptions.value.title,\n }, {\n subtext,\n top: 'center', // 调整垂直位置\n left: 'center',\n text: '{a|}',\n itemGap: -20,\n subtextStyle: {\n fontSize: 14,\n },\n textStyle: {\n align: 'center',\n rich: {\n a: {\n height: 100 / aspectRatio,\n width: 100,\n backgroundColor: {\n image: emptyImg,\n },\n },\n },\n },\n }],\n }\n isEmpty = true\n resolve([obj, {\n notMerge: true,\n replaceMerge: ['xAxis', 'yAxis', 'series'],\n lazyUpdate: false,\n }])\n }\n })\n }\n\n function toggleToolbox(show: boolean) {\n if (!myChart?.isDisposed()) {\n myChart?.setOption({\n toolbox: {\n show,\n },\n })\n }\n }\n\n const { isOutside: mouseInChart } = useMouseInElement(chartDOM)\n watchDebounced(mouseInChart, (newVal) => {\n if (typeof newVal !== 'boolean') {\n return\n }\n toggleToolbox(!newVal)\n }, { debounce: 200 })\n\n watchDebounced(\n () => chartOptions.value,\n () => renderChart(chartOptions.value),\n { debounce: 500, deep: true },\n )\n\n onMounted(async () => {\n if (mountedBefore) {\n await mountedBefore()\n }\n renderChart(chartOptions.value)\n if (callback) {\n callback(myChart)\n }\n if (initAfter) {\n await initAfter()\n }\n if (myChart) {\n useResize(myChart, chartDOM)\n }\n })\n\n onUnmounted(() => {\n if (myChart) {\n myChart.getZr()?.off('mousemove')\n myChart.getZr()?.off('mouseout')\n disposeChart()\n }\n })\n\n return {\n myChart,\n }\n}\n\nexport function useResize(myChart: ECharts, chartDOM: Ref<HTMLElement | null>) {\n const { width, height } = useElementSize(chartDOM)\n watchDebounced([width, height], () => {\n if (myChart) {\n myChart.resize()\n }\n })\n}\n\nexport function useDataToExcelJson(dataSource: EChartData) {\n const { desc: { colDesc = [], groupByDesc = [] } = {}, data = [] } = dataSource\n const header = [...groupByDesc.map(item => item.colDesc), ...colDesc].filter(v => v) as string[]\n const json = data.map((item) => {\n return header.map((headerItem) => {\n return item[headerItem as keyof typeof item] || ''\n })\n })\n return [header, ...json]\n}\n"],"names":["useCharts","_ref","chartDOM","chartData","chartOptions","mountedBefore","initAfter","callback","myChart","isEmpty","dpr","window","devicePixelRatio","disposeChart","isDisposed","dispose","async","renderChart","_len","arguments","length","opt","Array","_key","value","echarts","init","renderer","showLoading","data","notMerge","setOption","setEmpty","error","console","log","hideLoading","subtext","Promise","resolve","img","Image","src","emptyImg","onload","aspectRatio","width","height","obj","title","text","modelName","top","left","itemGap","subtextStyle","fontSize","textStyle","align","rich","a","backgroundColor","image","replaceMerge","lazyUpdate","isOutside","mouseInChart","useMouseInElement","watchDebounced","newVal","show","toolbox","debounce","deep","onMounted","useResize","onUnmounted","getZr","off","useElementSize","resize","useDataToExcelJson","dataSource","desc","colDesc","groupByDesc","header","map","item","filter","v","json","headerItem"],"mappings":"+MAQgB,SAAAA,EAAAC,GAOb,IAPuBC,SAAEA,EAAUC,UAAAA,EAAAC,aAAWA,gBAAcC,EAAeC,UAAAA,EAAAC,SAAWA,GAOtFN,EACGO,EAA0B,KAC1BC,GAAU,EAGR,MAAAC,EAAMC,OAAOC,kBAAoB,EAEvC,SAASC,IACHL,IAAYA,EAAQM,eACtBN,EAAQO,UACEP,EAAA,KAEd,CAEAQ,eAAeC,IAAqD,IAAA,IAAAC,EAAAC,UAAAC,OAAtCC,EAAsCC,IAAAA,MAAAJ,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAAtCF,EAAsCE,GAAAJ,UAAAI,GAC9D,GAACrB,EAASsB,MAGV,IACEhB,IAAYA,EAAQM,eAKtBN,EAAUiB,EAAQC,KAAKxB,EAASsB,MAAO,KAAM,CAC3CZ,iBAAkBF,EAClBiB,SAAU,SANZnB,EAAQoB,cAUNzB,EAAUqB,OAAOK,MAAMT,SACT,IAAZX,IACGY,EA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ACJX,SACIA,IAERY,EAAYb,EAAaoB,OACrBjB,GACFA,EAASC,GAEPF,SACIA,IAEJE,GACFmE,EAAUnE,EAASN,EACrB,IAGF0E,GAAY,KACNpE,IACMA,EAAAqE,SAASC,IAAI,aACbtE,EAAAqE,SAASC,IAAI,YACRjE,IACf,IAGK,CACLL,UAEJ,CAEgB,SAAAmE,EAAUnE,EAAkBN,GAC1C,MAAM4C,MAAEA,EAAAC,OAAOA,GAAWgC,EAAe7E,GACzCkE,EAAe,CAACtB,EAAOC,IAAS,KAC1BvC,GACFA,EAAQwE,QACV,GAEJ,CAEO,SAASC,EAAmBC,GACjC,MAAQC,MAAMC,QAAEA,EAAU,GAAIC,YAAAA,EAAc,IAAO,CAAC,EAAAxD,KAAGA,EAAO,IAAOqD,EAC/DI,EAAS,IAAID,EAAYE,KAAYC,GAAAA,EAAKJ,aAAaA,GAASK,WAAYC,IAC5EC,EAAO9D,EAAK0D,KAAKC,GACdF,EAAOC,KAAKK,GACVJ,EAAKI,IAAoC,OAG7C,MAAA,CAACN,KAAWK,EACrB"}
package/lib/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./src/defaults.cjs"),s=require("./src/data-chart/index.cjs"),r=require("./src/file-upload/index.cjs"),t=require("./src/fixed-action-bar/index.cjs"),o=require("./src/image-upload/index.cjs"),i=require("./src/photo-crop-tool/index.cjs"),c=require("./src/subject-action/index.cjs"),x=require("./src/subject-layout/index.cjs"),u=require("./src/subject-list/index.cjs"),a=require("./src/subject-type/index.cjs"),d=require("./src/tiny-mce-editor/index.cjs");const p=e.default.install,l=e.default.version;exports.default=e.default,exports.QxsDataChart=s.QxsDataChart,exports.QxsFileUpload=r.QxsFileUpload,exports.QxsFixedActionBar=t.QxsFixedActionBar,exports.QxsImageUpload=o.QxsImageUpload,exports.QxsPhotoCropTool=i.QxsPhotoCropTool,exports.QxsSubjectAction=c.QxsSubjectAction,exports.QxsSubjectLayout=x.QxsSubjectLayout,exports.QxsSubjectList=u.QxsSubjectList,exports.QxsSubjectType=a.QxsSubjectType,exports.QxsTinyMceEditor=d.QxsTinyMceEditor,exports.install=p,exports.version=l;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./src/defaults.cjs"),t=require("./src/data-chart/index.cjs"),s=require("./src/file-upload/index.cjs"),r=require("./src/fixed-action-bar/index.cjs"),o=require("./src/image-upload/index.cjs"),c=require("./src/photo-crop-tool/index.cjs"),i=require("./src/subject-action/index.cjs"),a=require("./src/subject-layout/index.cjs"),x=require("./src/subject-list/index.cjs"),u=require("./src/subject-type/index.cjs"),p=require("./src/tiny-mce-editor/index.cjs"),n=require("./src/data-chart/src/analyze.cjs"),d=require("./src/data-chart/src/utils/config.cjs");const l=e.default.install,j=e.default.version;exports.default=e.default,exports.QxsDataChart=t.QxsDataChart,exports.QxsFileUpload=s.QxsFileUpload,exports.QxsFixedActionBar=r.QxsFixedActionBar,exports.QxsImageUpload=o.QxsImageUpload,exports.QxsPhotoCropTool=c.QxsPhotoCropTool,exports.QxsSubjectAction=i.QxsSubjectAction,exports.QxsSubjectLayout=a.QxsSubjectLayout,exports.QxsSubjectList=x.QxsSubjectList,exports.QxsSubjectType=u.QxsSubjectType,exports.QxsTinyMceEditor=p.QxsTinyMceEditor,exports.getObjectValue=n.getObjectValue,exports.keysMap=n.keysMap,exports.defaultChartOption=d.defaultChartOption,exports.getGeoJsonData=d.getGeoJsonData,exports.iconList=d.iconList,exports.setDefaultChartOption=d.setDefaultChartOption,exports.showTypeText=d.showTypeText,exports.install=l,exports.version=j;
2
2
  //# sourceMappingURL=index.cjs.map
package/lib/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../packages/components/index.ts"],"sourcesContent":["import installer from './src/defaults'\n\nexport * from './src/components'\n\nexport const install = installer.install\nexport const version = installer.version\nexport default installer\n"],"names":["install","installer","version"],"mappings":"uhBAIaA,MAAAA,EAAUC,EAAAA,QAAUD,QACpBE,EAAUD,EAAAA,QAAUC"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../packages/components/index.ts"],"sourcesContent":["import installer from './src/defaults'\n\nexport * from './src/components'\n\nexport const install = installer.install\nexport const version = installer.version\nexport default installer\n"],"names":["install","installer","version"],"mappings":"wnBAIaA,MAAAA,EAAUC,EAAAA,QAAUD,QACpBE,EAAUD,EAAAA,QAAUC"}
package/lib/index.css CHANGED
@@ -1,56 +1,55 @@
1
1
  /* unplugin-vue-components disabled */
2
- .area-vue-vue-type-style-index-0-scoped-51660d7b-lang_data-chart-area-wrap__nAnr8[data-v-51660d7b] {
2
+ .data-chart-area-wrap[data-v-51660d7b] {
3
3
  position: relative;
4
4
  }
5
- .area-vue-vue-type-style-index-0-scoped-51660d7b-lang_data-chart-area-wrap__nAnr8 .area-vue-vue-type-style-index-0-scoped-51660d7b-lang_city-select__IkwG-[data-v-51660d7b] {
5
+ .data-chart-area-wrap .city-select[data-v-51660d7b] {
6
6
  position: absolute;
7
7
  top: 10px;
8
8
  right: 100px;
9
9
  z-index: 1;
10
10
  width: 120px;
11
11
  }
12
- .area-vue-vue-type-style-index-0-scoped-51660d7b-lang_data-chart-area-wrap__nAnr8 .area-vue-vue-type-style-index-0-scoped-51660d7b-lang_data-chart-area__tbCEP[data-v-51660d7b] {
12
+ .data-chart-area-wrap .data-chart-area[data-v-51660d7b] {
13
13
  height: 100%;
14
14
  }
15
15
  /* unplugin-vue-components disabled */
16
- .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_data-chart-card__IY-jh[data-v-1c14c088] {
16
+ .data-chart-card[data-v-1c14c088] {
17
17
  display: flex;
18
18
  flex-direction: column;
19
19
  }
20
- .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_data-chart-card__IY-jh .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_title__dVPGY[data-v-1c14c088] {
20
+ .data-chart-card .title[data-v-1c14c088] {
21
+ margin: 0;
21
22
  display: flex;
22
23
  align-items: center;
23
24
  justify-content: space-between;
24
- padding: 0 5px;
25
- margin-top: 2px;
26
- margin-bottom: 7px;
25
+ padding: 0 5.5px;
26
+ line-height: 26px;
27
27
  font-family: sans-serif;
28
28
  font-size: 14px;
29
- font-weight: bolder;
29
+ font-weight: 600;
30
30
  color: #464646;
31
31
  }
32
- .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_data-chart-card__IY-jh .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_data-chart-card-grid-layout__RzZja[data-v-1c14c088] {
32
+ .data-chart-card .data-chart-card-grid-layout[data-v-1c14c088] {
33
33
  display: grid;
34
34
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
35
35
  gap: 10px;
36
36
  width: calc(100% - 3px);
37
37
  }
38
- .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_data-chart-card__IY-jh .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_data-chart-card-wrap__kvIfO[data-v-1c14c088] {
38
+ .data-chart-card .data-chart-card-wrap[data-v-1c14c088] {
39
39
  height: 100% !important;
40
40
  }
41
- .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_data-chart-card__IY-jh .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_data-chart-card-wrap__kvIfO .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_card-item__oV7pK[data-v-1c14c088] {
41
+ .data-chart-card .data-chart-card-wrap .card-item[data-v-1c14c088] {
42
42
  width: 100% !important;
43
43
  }
44
- .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_data-chart-card__IY-jh .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_card-item__oV7pK[data-v-1c14c088] {
44
+ .data-chart-card .card-item[data-v-1c14c088] {
45
45
  position: relative;
46
- background-image: url("./data-chart-card-bg-left.svg"), url("./data-chart-card-bg-right.svg");
47
46
  background-repeat: no-repeat;
48
47
  background-position: left top, right top;
49
48
  background-size: contain, contain;
50
49
  border: 2px solid #2196f3;
51
50
  border-radius: 6px;
52
51
  }
53
- .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_data-chart-card__IY-jh .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_card-item__oV7pK .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_suffix-icon__f7x6q[data-v-1c14c088] {
52
+ .data-chart-card .card-item .suffix-icon[data-v-1c14c088] {
54
53
  position: absolute;
55
54
  right: 1px;
56
55
  bottom: calc(25% - 14px);
@@ -60,7 +59,7 @@
60
59
  color: #fff;
61
60
  text-align: center;
62
61
  }
63
- .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_data-chart-card__IY-jh .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_card-item__oV7pK .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_card-title__eF2-d[data-v-1c14c088] {
62
+ .data-chart-card .card-item .card-title[data-v-1c14c088] {
64
63
  padding-left: 15px;
65
64
  margin-top: 10px;
66
65
  margin-bottom: 5px;
@@ -71,13 +70,13 @@
71
70
  text-overflow: ellipsis;
72
71
  white-space: nowrap;
73
72
  }
74
- .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_data-chart-card__IY-jh .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_card-item__oV7pK .card-vue-vue-type-style-index-0-scoped-1c14c088-lang_context__ro9I-[data-v-1c14c088] {
73
+ .data-chart-card .card-item .context[data-v-1c14c088] {
75
74
  padding: 0 30px 10px 20px;
76
75
  font-size: 14px;
77
76
  color: #464646;
78
77
  }
79
78
  /* unplugin-vue-components disabled */
80
- .line-vue-vue-type-style-index-0-scoped-397864aa-lang_data-chart-line__IKZEs[data-v-397864aa] {
79
+ .data-chart-line[data-v-397864aa] {
81
80
  width: 100%;
82
81
  height: 100%;
83
82
  }
@@ -1,2 +1,2 @@
1
- "use strict";exports.version="0.0.49";
1
+ "use strict";exports.version="0.0.51";
2
2
  //# sourceMappingURL=package.json.cjs.map
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("./data-chart/index.cjs"),t=require("./file-upload/index.cjs"),s=require("./fixed-action-bar/index.cjs"),r=require("./image-upload/index.cjs"),i=require("./photo-crop-tool/index.cjs"),o=require("./subject-action/index.cjs"),x=require("./subject-layout/index.cjs"),c=require("./subject-list/index.cjs"),u=require("./subject-type/index.cjs"),a=require("./tiny-mce-editor/index.cjs");exports.QxsDataChart=e.QxsDataChart,exports.QxsFileUpload=t.QxsFileUpload,exports.QxsFixedActionBar=s.QxsFixedActionBar,exports.QxsImageUpload=r.QxsImageUpload,exports.QxsPhotoCropTool=i.QxsPhotoCropTool,exports.QxsSubjectAction=o.QxsSubjectAction,exports.QxsSubjectLayout=x.QxsSubjectLayout,exports.QxsSubjectList=c.QxsSubjectList,exports.QxsSubjectType=u.QxsSubjectType,exports.QxsTinyMceEditor=a.QxsTinyMceEditor;
1
+ "use strict";var e=require("./data-chart/index.cjs"),t=require("./file-upload/index.cjs"),s=require("./fixed-action-bar/index.cjs"),o=require("./image-upload/index.cjs"),r=require("./photo-crop-tool/index.cjs"),i=require("./subject-action/index.cjs"),x=require("./subject-layout/index.cjs"),a=require("./subject-list/index.cjs"),c=require("./subject-type/index.cjs"),p=require("./tiny-mce-editor/index.cjs"),u=require("./data-chart/src/analyze.cjs"),n=require("./data-chart/src/utils/config.cjs");exports.QxsDataChart=e.QxsDataChart,exports.QxsFileUpload=t.QxsFileUpload,exports.QxsFixedActionBar=s.QxsFixedActionBar,exports.QxsImageUpload=o.QxsImageUpload,exports.QxsPhotoCropTool=r.QxsPhotoCropTool,exports.QxsSubjectAction=i.QxsSubjectAction,exports.QxsSubjectLayout=x.QxsSubjectLayout,exports.QxsSubjectList=a.QxsSubjectList,exports.QxsSubjectType=c.QxsSubjectType,exports.QxsTinyMceEditor=p.QxsTinyMceEditor,exports.getObjectValue=u.getObjectValue,exports.keysMap=u.keysMap,exports.defaultChartOption=n.defaultChartOption,exports.getGeoJsonData=n.getGeoJsonData,exports.iconList=n.iconList,exports.setDefaultChartOption=n.setDefaultChartOption,exports.showTypeText=n.showTypeText;
2
2
  //# sourceMappingURL=components.cjs.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../withInstall.cjs"),t=require("./src/data-chart.vue.cjs");const r=e.withInstall(t.default);exports.QxsDataChart=r,exports.default=r;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../withInstall.cjs"),e=require("./src/data-chart.vue.cjs"),s=require("./src/utils/config.cjs");const r=t.withInstall(e.default);exports.defaultChartOption=s.defaultChartOption,exports.getGeoJsonData=s.getGeoJsonData,exports.iconList=s.iconList,exports.setDefaultChartOption=s.setDefaultChartOption,exports.showTypeText=s.showTypeText,exports.QxsDataChart=r,exports.default=r;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../../../packages/components/src/data-chart/index.ts"],"sourcesContent":["import { withInstall } from '../withInstall'\nimport component from './src/data-chart.vue'\n\nconst QxsDataChart = withInstall(component)\n\nexport {\n QxsDataChart,\n}\nexport default QxsDataChart\n"],"names":["QxsDataChart","withInstall","component","default"],"mappings":"8IAGA,MAAMA,EAAeC,cAAYC,EAASC"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../../packages/components/src/data-chart/index.ts"],"sourcesContent":["import { withInstall } from '../withInstall'\nimport component from './src/data-chart.vue'\n\nexport * from './src/analyze'\nexport * from './src/utils/types'\nexport * from './src/utils/config'\n\nconst QxsDataChart = withInstall(component)\n\nexport {\n QxsDataChart,\n}\nexport default QxsDataChart\n"],"names":["QxsDataChart","withInstall","component","default"],"mappings":"kLAOA,MAAMA,EAAeC,cAAYC,EAASC"}
@@ -0,0 +1,2 @@
1
+ "use strict";const e={"描述性分析":{"平均值":{handler:e=>{let{sourceData:l,dealJson:a}=e;const{dealKey:t}=a,r=l.sort(((e,l)=>Number(l[t])-Number(e[t])));return(r.reduce(((e,l)=>e+Number(l[t])),0)/r.length).toFixed(2)||""}},"中位数":{dealOptSchema:[{label:"目标值类型",cascaderProps:{value:"label",label:"label"},select:[{label:"值"},{label:"名字"}],interactionType:"select"}],handler:e=>{let{sourceData:l,dealJson:a}=e;const{dealKey:t,source:r,dealOpt:u}=a,n=u["目标值类型"]?.keyPath,c=l.sort(((e,l)=>Number(l[t])-Number(e[t])));return c[Math.floor(c.length/2)]["值"===n?t:"名字"===n?r:""]||""}},"排序":{dealOptSchema:[{label:"排序方式",cascaderProps:{value:"label",label:"label"},select:[{label:"默认",children:[{label:"第几名",valueVerify:{type:"number",default:1}},{label:"范围",valueVerify:{type:"number[]",default:[1,2]}}]},{label:"升序",children:[{label:"第几名",valueVerify:{type:"number",default:1}},{label:"范围",valueVerify:{type:"number[]",default:[1,2]}}]},{label:"降序",children:[{label:"第几名",valueVerify:{type:"number",default:1}},{label:"范围",valueVerify:{type:"number[]",default:[1,2]}}]}],interactionType:"input"},{label:"目标值类型",cascaderProps:{value:"label",label:"label"},select:[{label:"值"},{label:"占比"},{label:"名字"}],interactionType:"select"}],handler:e=>{let{sourceData:l,dealJson:a}=e;const{dealKey:t,source:r,dealOpt:u}=a;let n="";const c=u["目标值类型"].keyPath;let s=[];if(s=u["排序方式"].keyPath.includes("默认")?l:l.sort(((e,l)=>u["排序方式"].keyPath.includes("升序")?Number(e[t])-Number(l[t]):u["排序方式"].keyPath.includes("降序")?Number(l[t])-Number(e[t]):0)),u["排序方式"].keyPath.includes("第几名")){const e=s[u["排序方式"].value-1]||{},l="值"===c?t:"名字"===c?r:"占比"===c?t:"";if(u["目标值类型"].keyPath.includes("占比")){const a=s.reduce(((e,a)=>e+Number(a[l])),0);n=e[l]?`${(Number(e[l])/a*100).toFixed(2)}%`:""}else n=e[l]||""}else if(u["排序方式"].keyPath.includes("范围")){n=s.slice(u["排序方式"].value[0]-1,u["排序方式"].value[1]).map((e=>e["值"===c?t:"名字"===c?r:""])).join("、").replace(/、([^、]+)$/,"和$1")}return n||""}}},"趋势分析":{"整体趋势":{handler:e=>{let{sourceData:l,dealJson:a}=e;const t=l.map((e=>e[a.dealKey])),r=t.length;let u=0,n=0,c=0,s=0;for(let e=0;e<r;e++)u+=e,n+=Number(t[e]),c+=e*Number(t[e]),s+=e*e;const b=(r*c-u*n)/(r*s-u*u);return b>0?"增长":b<0?"下降":"平稳"}}}};exports.getObjectValue=function(e,l){return l.reduce(((e,l)=>e?e[l]:void 0),e)},exports.keysMap=e;
2
+ //# sourceMappingURL=analyze.cjs.map