@qxs-bns/components 0.0.54 → 0.0.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.mjs +1 -1
- package/es/index.mjs.map +1 -1
- package/es/node_modules/.pnpm/@iconify_vue@5.0.0_vue@3.5.18_typescript@5.8.3_/node_modules/@iconify/vue/dist/iconify.mjs +2 -0
- package/es/node_modules/.pnpm/{@iconify_vue@5.0.0_vue@3.5.13_typescript@5.8.2_ → @iconify_vue@5.0.0_vue@3.5.18_typescript@5.8.3_}/node_modules/@iconify/vue/dist/iconify.mjs.map +1 -1
- package/es/package.json.mjs +1 -1
- package/es/src/components.mjs +1 -1
- package/es/src/data-chart/src/analyze.mjs +1 -1
- package/es/src/data-chart/src/analyze.mjs.map +1 -1
- package/es/src/data-chart/src/components/area.vue2.mjs +1 -1
- package/es/src/data-chart/src/components/area.vue2.mjs.map +1 -1
- package/es/src/data-chart/src/components/bar.vue.mjs +1 -1
- package/es/src/data-chart/src/components/bar.vue.mjs.map +1 -1
- package/es/src/data-chart/src/components/card.vue2.mjs +1 -1
- package/es/src/data-chart/src/components/card.vue2.mjs.map +1 -1
- package/es/src/data-chart/src/components/data-chart-card-bg-left.svg.mjs.map +1 -1
- package/es/src/data-chart/src/components/data-chart-card-bg-right.svg.mjs.map +1 -1
- package/es/src/data-chart/src/components/empty.svg.mjs.map +1 -1
- package/es/src/data-chart/src/components/empty.vue.mjs.map +1 -1
- package/es/src/data-chart/src/components/funnel.vue.mjs +1 -1
- package/es/src/data-chart/src/components/funnel.vue.mjs.map +1 -1
- package/es/src/data-chart/src/components/line.vue2.mjs +1 -1
- package/es/src/data-chart/src/components/line.vue2.mjs.map +1 -1
- package/es/src/data-chart/src/components/pie.vue.mjs +1 -1
- package/es/src/data-chart/src/components/pie.vue.mjs.map +1 -1
- package/es/src/data-chart/src/components/radar.vue.mjs +1 -1
- package/es/src/data-chart/src/components/radar.vue.mjs.map +1 -1
- package/es/src/data-chart/src/components/scatter-simple.vue.mjs +1 -1
- package/es/src/data-chart/src/components/scatter-simple.vue.mjs.map +1 -1
- package/es/src/data-chart/src/components/scatter.vue.mjs +1 -1
- package/es/src/data-chart/src/components/scatter.vue.mjs.map +1 -1
- package/es/src/data-chart/src/components/table.vue.mjs +1 -1
- package/es/src/data-chart/src/components/table.vue.mjs.map +1 -1
- package/es/src/data-chart/src/data-chart.vue.mjs +1 -1
- package/es/src/data-chart/src/data-chart.vue.mjs.map +1 -1
- package/es/src/data-chart/src/utils/config.mjs +1 -1
- package/es/src/data-chart/src/utils/config.mjs.map +1 -1
- package/es/src/data-chart/src/utils/mapData.mjs +2 -0
- package/es/src/data-chart/src/utils/mapData.mjs.map +1 -0
- package/es/src/data-chart/src/utils/safe-eval.mjs.map +1 -1
- package/es/src/data-chart/src/utils/useCharts.mjs +1 -1
- package/es/src/data-chart/src/utils/useCharts.mjs.map +1 -1
- package/es/src/defaults.mjs.map +1 -1
- package/es/src/file-upload/src/file-upload.vue.mjs +1 -1
- package/es/src/file-upload/src/file-upload.vue.mjs.map +1 -1
- package/es/src/fixed-action-bar/src/fixed-action-bar.vue.mjs +1 -1
- package/es/src/fixed-action-bar/src/fixed-action-bar.vue.mjs.map +1 -1
- package/es/src/icon/index.mjs +1 -1
- package/es/src/icon/index.mjs.map +1 -1
- package/es/src/icon/src/icon.vue.mjs +1 -1
- package/es/src/icon/src/icon.vue.mjs.map +1 -1
- package/es/src/image-upload/src/image-upload.vue.mjs +1 -1
- package/es/src/image-upload/src/image-upload.vue.mjs.map +1 -1
- package/es/src/make-installer.mjs.map +1 -1
- package/es/src/photo-crop-tool/src/composables.mjs +1 -1
- package/es/src/photo-crop-tool/src/composables.mjs.map +1 -1
- package/es/src/photo-crop-tool/src/photo-crop-tool.vue.mjs +1 -1
- package/es/src/photo-crop-tool/src/photo-crop-tool.vue.mjs.map +1 -1
- package/es/src/subject-action/src/subject-action.vue.mjs +1 -1
- package/es/src/subject-action/src/subject-action.vue.mjs.map +1 -1
- package/es/src/subject-layout/src/subject-layout.vue.mjs.map +1 -1
- package/es/src/subject-list/src/components/SubjectPageEnd.vue.mjs +1 -1
- package/es/src/subject-list/src/components/SubjectPageEnd.vue.mjs.map +1 -1
- package/es/src/subject-list/src/components/SubjectRichText.vue.mjs +1 -1
- package/es/src/subject-list/src/components/SubjectRichText.vue.mjs.map +1 -1
- package/es/src/subject-list/src/components/subject-blank-fill.vue.mjs +1 -1
- package/es/src/subject-list/src/components/subject-blank-fill.vue.mjs.map +1 -1
- package/es/src/subject-list/src/components/subject-scale.vue.mjs +1 -1
- package/es/src/subject-list/src/components/subject-scale.vue.mjs.map +1 -1
- package/es/src/subject-list/src/components/subject-single.vue.mjs +1 -1
- package/es/src/subject-list/src/components/subject-single.vue.mjs.map +1 -1
- package/es/src/subject-list/src/components/subject-text-fill.vue.mjs +1 -1
- package/es/src/subject-list/src/components/subject-text-fill.vue.mjs.map +1 -1
- package/es/src/subject-list/src/subject-list.vue.mjs +1 -1
- package/es/src/subject-list/src/subject-list.vue.mjs.map +1 -1
- package/es/src/subject-type/src/subject-type.vue.mjs +1 -1
- package/es/src/subject-type/src/subject-type.vue.mjs.map +1 -1
- package/es/src/tiny-mce-editor/src/tiny-mce-editor.vue.mjs +1 -1
- package/es/src/tiny-mce-editor/src/tiny-mce-editor.vue.mjs.map +1 -1
- package/es/src/withInstall.mjs.map +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.cjs.map +1 -1
- package/lib/node_modules/.pnpm/@iconify_vue@5.0.0_vue@3.5.18_typescript@5.8.3_/node_modules/@iconify/vue/dist/iconify.cjs +2 -0
- package/lib/node_modules/.pnpm/{@iconify_vue@5.0.0_vue@3.5.13_typescript@5.8.2_ → @iconify_vue@5.0.0_vue@3.5.18_typescript@5.8.3_}/node_modules/@iconify/vue/dist/iconify.cjs.map +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/src/components.cjs +1 -1
- package/lib/src/data-chart/index.cjs.map +1 -1
- package/lib/src/data-chart/src/analyze.cjs +1 -1
- package/lib/src/data-chart/src/analyze.cjs.map +1 -1
- package/lib/src/data-chart/src/components/area.vue2.cjs +1 -1
- package/lib/src/data-chart/src/components/area.vue2.cjs.map +1 -1
- package/lib/src/data-chart/src/components/bar.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/bar.vue.cjs.map +1 -1
- package/lib/src/data-chart/src/components/card.vue2.cjs +1 -1
- package/lib/src/data-chart/src/components/card.vue2.cjs.map +1 -1
- package/lib/src/data-chart/src/components/empty.vue.cjs.map +1 -1
- package/lib/src/data-chart/src/components/funnel.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/funnel.vue.cjs.map +1 -1
- package/lib/src/data-chart/src/components/line.vue2.cjs +1 -1
- package/lib/src/data-chart/src/components/line.vue2.cjs.map +1 -1
- package/lib/src/data-chart/src/components/pie.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/pie.vue.cjs.map +1 -1
- package/lib/src/data-chart/src/components/radar.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/radar.vue.cjs.map +1 -1
- package/lib/src/data-chart/src/components/scatter-simple.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/scatter-simple.vue.cjs.map +1 -1
- package/lib/src/data-chart/src/components/scatter.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/scatter.vue.cjs.map +1 -1
- package/lib/src/data-chart/src/components/table.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/table.vue.cjs.map +1 -1
- package/lib/src/data-chart/src/data-chart.vue.cjs +1 -1
- package/lib/src/data-chart/src/data-chart.vue.cjs.map +1 -1
- package/lib/src/data-chart/src/utils/config.cjs +1 -1
- package/lib/src/data-chart/src/utils/config.cjs.map +1 -1
- package/lib/src/data-chart/src/utils/mapData.cjs +2 -0
- package/lib/src/data-chart/src/utils/mapData.cjs.map +1 -0
- package/lib/src/data-chart/src/utils/safe-eval.cjs.map +1 -1
- package/lib/src/data-chart/src/utils/useCharts.cjs +1 -1
- package/lib/src/data-chart/src/utils/useCharts.cjs.map +1 -1
- package/lib/src/defaults.cjs.map +1 -1
- package/lib/src/file-upload/index.cjs.map +1 -1
- package/lib/src/file-upload/src/file-upload.vue.cjs +1 -1
- package/lib/src/file-upload/src/file-upload.vue.cjs.map +1 -1
- package/lib/src/fixed-action-bar/index.cjs.map +1 -1
- package/lib/src/fixed-action-bar/src/fixed-action-bar.vue.cjs +1 -1
- package/lib/src/fixed-action-bar/src/fixed-action-bar.vue.cjs.map +1 -1
- package/lib/src/icon/index.cjs +1 -1
- package/lib/src/icon/index.cjs.map +1 -1
- package/lib/src/icon/src/icon.vue.cjs +1 -1
- package/lib/src/icon/src/icon.vue.cjs.map +1 -1
- package/lib/src/image-upload/index.cjs.map +1 -1
- package/lib/src/image-upload/src/image-upload.vue.cjs +1 -1
- package/lib/src/image-upload/src/image-upload.vue.cjs.map +1 -1
- package/lib/src/make-installer.cjs.map +1 -1
- package/lib/src/photo-crop-tool/index.cjs.map +1 -1
- package/lib/src/photo-crop-tool/src/composables.cjs +1 -1
- package/lib/src/photo-crop-tool/src/composables.cjs.map +1 -1
- package/lib/src/photo-crop-tool/src/photo-crop-tool.vue.cjs +1 -1
- package/lib/src/photo-crop-tool/src/photo-crop-tool.vue.cjs.map +1 -1
- package/lib/src/subject-action/index.cjs.map +1 -1
- package/lib/src/subject-action/src/subject-action.vue.cjs +1 -1
- package/lib/src/subject-action/src/subject-action.vue.cjs.map +1 -1
- package/lib/src/subject-layout/index.cjs.map +1 -1
- package/lib/src/subject-layout/src/subject-layout.vue.cjs.map +1 -1
- package/lib/src/subject-list/index.cjs.map +1 -1
- package/lib/src/subject-list/src/components/SubjectPageEnd.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/SubjectPageEnd.vue.cjs.map +1 -1
- package/lib/src/subject-list/src/components/SubjectRichText.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/SubjectRichText.vue.cjs.map +1 -1
- package/lib/src/subject-list/src/components/subject-blank-fill.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/subject-blank-fill.vue.cjs.map +1 -1
- package/lib/src/subject-list/src/components/subject-scale.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/subject-scale.vue.cjs.map +1 -1
- package/lib/src/subject-list/src/components/subject-single.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/subject-single.vue.cjs.map +1 -1
- package/lib/src/subject-list/src/components/subject-text-fill.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/subject-text-fill.vue.cjs.map +1 -1
- package/lib/src/subject-list/src/subject-list.vue.cjs +1 -1
- package/lib/src/subject-list/src/subject-list.vue.cjs.map +1 -1
- package/lib/src/subject-type/index.cjs.map +1 -1
- package/lib/src/subject-type/src/subject-type.vue.cjs +1 -1
- package/lib/src/subject-type/src/subject-type.vue.cjs.map +1 -1
- package/lib/src/tiny-mce-editor/index.cjs.map +1 -1
- package/lib/src/tiny-mce-editor/src/tiny-mce-editor.vue.cjs +1 -1
- package/lib/src/tiny-mce-editor/src/tiny-mce-editor.vue.cjs.map +1 -1
- package/lib/src/withInstall.cjs.map +1 -1
- package/package.json +3 -3
- package/types/src/components.d.ts +1 -1
- package/types/src/components.d.ts.map +1 -1
- package/types/src/data-chart/src/components/area.vue.d.ts.map +1 -1
- package/types/src/data-chart/src/utils/config.d.ts.map +1 -1
- package/types/src/data-chart/src/utils/mapData.d.ts +64 -0
- package/types/src/data-chart/src/utils/mapData.d.ts.map +1 -0
- package/types/src/data-chart/src/utils/types.d.ts +4 -0
- package/types/src/data-chart/src/utils/types.d.ts.map +1 -1
- package/types/src/data-chart/src/utils/useCharts.d.ts +3 -4
- package/types/src/data-chart/src/utils/useCharts.d.ts.map +1 -1
- package/types/src/fixed-action-bar/index.d.ts +1 -1
- package/types/src/fixed-action-bar/src/fixed-action-bar.vue.d.ts +1 -1
- package/types/src/fixed-action-bar/src/fixed-action-bar.vue.d.ts.map +1 -1
- package/types/src/icon/index.d.ts +3 -3
- package/types/src/icon/index.d.ts.map +1 -1
- package/types/src/image-upload/index.d.ts +3 -2
- package/types/src/image-upload/index.d.ts.map +1 -1
- package/types/src/image-upload/src/image-upload.vue.d.ts +2 -80
- package/types/src/image-upload/src/image-upload.vue.d.ts.map +1 -1
- package/types/src/subject-layout/index.d.ts +5 -3
- package/types/src/subject-layout/index.d.ts.map +1 -1
- package/types/src/subject-layout/src/subject-layout.vue.d.ts +2 -24
- package/types/src/subject-layout/src/subject-layout.vue.d.ts.map +1 -1
- package/types/src/tiny-mce-editor/index.d.ts.map +1 -1
- package/types/tsconfig.tsbuildinfo +1 -1
- package/es/node_modules/.pnpm/@iconify_vue@5.0.0_vue@3.5.13_typescript@5.8.2_/node_modules/@iconify/vue/dist/iconify.mjs +0 -2
- package/lib/node_modules/.pnpm/@iconify_vue@5.0.0_vue@3.5.13_typescript@5.8.2_/node_modules/@iconify/vue/dist/iconify.cjs +0 -2
@@ -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 '../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,
|
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","_createElementBlock","class"],"mappings":"6YAkBA,MAAMA,EAAiBC,IACjBC,EAAQC,EAAOC,EAAsBC,GAAWA,GAAG,GACnDC,EAAoBC,EAAwB,KAChD,MAAMC,QAAEA,EAAAC,aAASA,EAAAC,UAAcA,EAAAC,KAAWA,GAASC,EAAAC,UAE9CJ,GAAcK,gBACjBL,EAAaK,cAAgB,IAE/BL,EAAaK,cAAgBC,EAAKJ,EAAKK,IAAKC,GACnCA,EAAKR,EAAaD,SAAW,KACnCU,OAAOb,GAAKA,IAEf,MAAMc,EAAS,CACbC,MAAO,CACLC,KAAMX,GAERY,MAAO,CACLC,UAAWd,GAAcK,eAAeE,IAAKQ,IACpC,CACLC,KAAMD,EACNE,IAAKC,KAAKD,OAAOf,EAAKK,IAAIC,GAAQW,OAAOX,EAAKT,EAAQ,WAEpD,IAERqB,OAAQ,CAAC,CACPJ,KAAMhB,GAAcD,QACpBsB,KAAM,QACNC,QAAS,CACPC,QAAS,QAEXrB,KAAMH,EAAQQ,IAAIiB,IAAA,CAChBR,KAAMQ,EACNC,MAAOzB,GAAcK,eAAeE,IAAKQ,GAC/Bb,EAAKK,IAAKmB,GACZX,IAAsBW,EAAS1B,EAAaD,SAAW,IAClD2B,EAASF,GAEX,MACNf,UAAYb,GAAI+B,OAAO,CAACC,EAAKC,IAAQV,OAAOS,GAAO,GAAKT,OAAOU,GAAO,GAAI,UAMrF,OAAOpC,EAAMiB,EAAQP,EAAA2B,uBAEvBC,EAAU,CAAEC,SAAUzC,EAAgBuC,aAAcjC,EAAmBO,UAAWN,EAAS,IAAMK,EAAAC,yBAI/F6B,EAGE,MAAA,SAFI,iBAAJzC,IAAID,EACJ2C,MAAM"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{defineComponent as t,ref as e,inject as a,computed as r,createElementBlock as s,openBlock as c}from"vue";import{InjectionChartMerge as m}from"../utils/injectionKeys.mjs";import{useCharts as i}from"../utils/useCharts.mjs";var l=t({name:"DataChartScatterSimple",__name:"scatter-simple",props:{chartData:{type:Object,required:!0},chartOptions:{type:null,required:!0}},setup(t){const l=e(),o=a(m,
|
1
|
+
import{defineComponent as t,ref as e,inject as a,computed as r,createElementBlock as s,openBlock as c}from"vue";import{InjectionChartMerge as m}from"../utils/injectionKeys.mjs";import{useCharts as i}from"../utils/useCharts.mjs";var l=t({name:"DataChartScatterSimple",__name:"scatter-simple",props:{chartData:{type:Object,required:!0},chartOptions:{type:null,required:!0}},setup(t){const l=e(),o=a(m,t=>t,!0),p=r(()=>{const{colDesc:e,xGroupByDesc:a,modelName:r,data:s}=t.chartData,c={title:{text:r},tooltip:{formatter:t=>t.value.length>1?`${t.seriesName} :<br/>${t.value[0]} ${t.value[1]} `:`${t.seriesName} :<br/>${t.name} : ${t.value} `},series:e.map(t=>({symbolSize:20,name:t,data:s.map(e=>[e[t],e[a?.colDesc||""]]),type:"scatter"}))};return o(c,t.chartOptions)});return i({chartDOM:l,chartOptions:p,chartData:r(()=>t.chartData)}),(t,e)=>(c(),s("div",{ref_key:"dataChartScatterSimple",ref:l,class:"data-chart-scatter-simple"},null,512))}});export{l as default};
|
2
2
|
//# sourceMappingURL=scatter-simple.vue.mjs.map
|
@@ -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 '../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,
|
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","_createElementBlock","class"],"mappings":"6XAeA,MAAMA,EAAyBC,IACzBC,EAAQC,EAAOC,EAAsBC,GAAWA,GAAG,GAEnDC,EAAsBC,EAAwB,KAClD,MAAMC,QAAEA,EAAAC,aAASA,EAAAC,UAAcA,EAAAC,KAAWA,GAASC,EAAAC,UAC7CC,EAAS,CACbC,MAAO,CACLC,KAAMN,GAERO,QAAS,CACPC,UAAUC,GACJA,EAAOC,MAAMC,OAAS,EAEtB,GAAGF,EAAOG,oBACAH,EAAOC,MAAM,MACnBD,EAAOC,MAAM,MAMjB,GAAGD,EAAOG,oBACAH,EAAOI,UACXJ,EAAOC,UAMrBI,OAAQhB,EAAQiB,IAAKC,IACZ,CACLC,WAAY,GACZJ,KAAMG,EACNf,KAAMA,EAAKc,IAAKG,GACP,CAACA,EAASF,GAAcE,EAASnB,GAAcD,SAAW,MAEnEqB,KAAM,cAIZ,OAAO3B,EAAMY,EAAQF,EAAAkB,uBAEvBC,EAAU,CAAEC,SAAUhC,EAAwB8B,aAAcxB,EAAqBO,UAAWN,EAAS,IAAMK,EAAAC,yBAIzGoB,EAGE,MAAA,SAFI,yBAAJhC,IAAID,EACJkC,MAAM"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{defineComponent as t,ref as a,inject as r,computed as e,createElementBlock as s,openBlock as c}from"vue";import{InjectionChartMerge as i}from"../utils/injectionKeys.mjs";import{useCharts as o}from"../utils/useCharts.mjs";var p=t({name:"DataChartScatter",__name:"scatter",props:{chartData:{type:Object,required:!0},chartOptions:{type:null,required:!0}},setup(t){const p=a(),h=r(i,
|
1
|
+
import{defineComponent as t,ref as a,inject as r,computed as e,createElementBlock as s,openBlock as c}from"vue";import{InjectionChartMerge as i}from"../utils/injectionKeys.mjs";import{useCharts as o}from"../utils/useCharts.mjs";var p=t({name:"DataChartScatter",__name:"scatter",props:{chartData:{type:Object,required:!0},chartOptions:{type:null,required:!0}},setup(t){const p=a(),h=r(i,t=>t,!0),m=e(()=>h({xAxis:{},yAxis:{},series:[{symbolSize:20,data:[[10,8.04],[8.07,6.95],[13,7.58],[9.05,8.81],[11,8.33],[14,7.66],[13.4,6.81],[10,6.33],[14,8.96],[12.5,6.82],[9.15,7.2],[11.5,7.2],[3.03,4.23],[12.2,7.83],[2.02,4.47],[1.05,3.33],[4.05,4.96],[6.03,7.24],[12,6.26],[12,8.84],[7.08,5.82],[5.02,5.68]],type:"scatter"}]},t.chartOptions));return o({chartDOM:p,chartOptions:m,chartData:e(()=>t.chartData)}),(t,a)=>(c(),s("div",{ref_key:"dataChartScatter",ref:p,class:"data-chart-scatter"},null,512))}});export{p as default};
|
2
2
|
//# sourceMappingURL=scatter.vue.mjs.map
|
@@ -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 '../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,
|
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","_createElementBlock","class"],"mappings":"gXAiBA,MAAMA,EAAmBC,IACnBC,EAAQC,EAAOC,EAAsBC,GAAWA,GAAG,GAEnDC,EAAsBC,EAAwB,IAoC3CL,EAnCQ,CACbM,MAAO,CAAA,EACPC,MAAO,CAAA,EACPC,OAAQ,CACN,CACEC,WAAY,GACZC,KAAM,CACJ,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,GAAM,MACP,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,GAAM,MACP,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,KACP,CAAC,KAAM,KACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,GAAM,MACP,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,OAETC,KAAM,aAKSC,EAAAC,sBAEvBC,EAAU,CAAEC,SAAUjB,EAAkBe,aAAcT,EAAqBY,UAAWX,EAAS,IAAMO,EAAAI,yBAInGC,EAGE,MAAA,SAFI,mBAAJlB,IAAID,EACJoB,MAAM"}
|
@@ -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 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((
|
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 '../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,
|
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","_createElementBlock","class","_normalizeClass","_unref","e","modelName","_openBlock","_hoisted_1","_createElementVNode","_toDisplayString","_createVNode","_component_el_table","data","stripe","height","empty","Empty","_Fragment","index","_createBlock","_component_el_table_column","key","colDesc","align","sortable","prop","header","_createTextVNode","default","_withCtx","scoped","row","label"],"mappings":"qwBAUA,MAAMA,EAAQC,EAYRC,EAAKC,EAAa,cAElBC,EAAeC,EAAS,IAChBL,EAAMM,UAAUC,YAAYC,KAAKC,IAASA,EAAKC,QAI7D,SAASC,EAAUC,GACjB,IAAKA,EACH,OAAO,IAET,MAAMC,EAAwB,GAAbD,EAAIE,OAAc,GAAK,GACxC,OAAOD,EAAW,IAAM,IAAMA,CAChC,wCAIEE,EA+CM,MAAA,CA/CAC,MAAKC,EAAA,CAAGC,EAAAhB,GAAGiB,EAAC,aAERlB,EAAAK,UAAUc,WADlBC,IAAAN,EAKI,IALJO,EAKI,CADFC,EAAsC,OAAA,KAAAC,EAA7BvB,EAAAK,UAAUc,WAAS,mBAE9BK,EAuCWC,EAAA,CAtCTV,MAAM,kBACLW,KAAM1B,EAAAK,UAAUqB,KACjBC,OAAA,GACAC,OAAO,SAgCIC,QACT,IAAS,CAATL,EAASM,eA9BT,IAA8C,EADhDV,GAAA,GAAAN,EAekBiB,SAdQ/B,EAAAK,UAAUC,YAAW,CAArCE,EAAMwB,SADhBC,EAekBC,EAAA,CAbfC,IAAG,GAAK3B,EAAK4B,UAAU5B,EAAKF,cAAc0B,IAC3CK,MAAM,SACN,wBAAA,GACAC,SAAA,GACC,YAAS,GAAK5B,EAAUF,EAAK4B,aAC7BG,KAAM/B,EAAK4B,SAAO,KAERI,SACT,IAAkB,CAAfC,EAAAlB,EAAAf,EAAK4B,SAAO,KAENM,QAAOC,EACuHC,GAD/G,MACpB3B,EAAAd,KAAgBc,KAAamB,QAAY5B,EAAK4B,SAAUQ,EAAOC,IAAIrC,EAAK4B,SAAO,KAAiC,OAAA,8CAGxHhB,GAAA,GAAAN,EAakBiB,SAZQ/B,EAAAK,UAAU+B,QAAO,CAAjC5B,EAAMwB,SADhBC,EAakBC,EAAA,CAXfC,IAAK3B,EAAOwB,EACbK,MAAM,SACL,YAAS,GAAK3B,EAAUF,OACxBsC,MAAOtC,EACR,wBAAA,GACA8B,SAAA,GACCC,KAAM/B,IAEIgC,SACT,IAAU,KAAPhC,GAAI"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{defineComponent as e,computed as o,provide as t,createBlock as s,openBlock as r,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*as l from"./analyze.mjs";import d from"./components/area.vue.mjs";import f from"./components/bar.vue.mjs";import y from"./components/card.vue.mjs";import h from"./components/funnel.vue.mjs";import j from"./components/line.vue.mjs";import g 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 x from"./components/table.vue.mjs";import*as D from"./utils/config.mjs";import{defaultChartOption as S}from"./utils/config.mjs";import{InjectionChartMerge as T}from"./utils/injectionKeys.mjs";import{safeEvalConfig as q}from"./utils/safe-eval.mjs";import*as C from"./utils/types.mjs";import{useDataToExcelJson as N}from"./utils/useCharts.mjs";var B=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:B}){const O=n("data-chart"),k={analyze:l,config:D,types:C},z={table:x,bar:f,line:j,pie:g,radar:v,scatter:w,funnel:h,area:d,card:y,"scatter-simple":b},A=o((
|
1
|
+
import{defineComponent as e,computed as o,provide as t,createBlock as s,openBlock as r,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*as l from"./analyze.mjs";import d from"./components/area.vue.mjs";import f from"./components/bar.vue.mjs";import y from"./components/card.vue.mjs";import h from"./components/funnel.vue.mjs";import j from"./components/line.vue.mjs";import g 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 x from"./components/table.vue.mjs";import*as D from"./utils/config.mjs";import{defaultChartOption as S}from"./utils/config.mjs";import{InjectionChartMerge as T}from"./utils/injectionKeys.mjs";import{safeEvalConfig as q}from"./utils/safe-eval.mjs";import*as C from"./utils/types.mjs";import{useDataToExcelJson as N}from"./utils/useCharts.mjs";var B=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:B}){const O=n("data-chart"),k={analyze:l,config:D,types:C},z={table:x,bar:f,line:j,pie:g,radar:v,scatter:w,funnel:h,area:d,card:y,"scatter-simple":b},A=o(()=>c(S[e.showTypeName])),Q=o(()=>{const{desc:{colDesc:o=[],groupByDesc:t=[]}={},data:s=[]}=e.data;let r=[],a=null;r=t?.map(e=>(e.xAxis&&(a=e),e));const m=a?s.filter(e=>e&&e[a.colDesc]):s;return{colDesc:o||[],modelName:e.modelName,subShowType:e.subShowType,xGroupByDesc:a||{colDesc:"",groupByDesc:"",groupByValues:[],xAxis:!1},groupByDesc:r,data:m}});return B({exportExal:function(){if(0===e.data.data.length)return void console.log("暂无数据");const o=N(e.data);i(e.modelName,o)},QxsDataChartConfig:k}),t(T,function(o,t){let s=u({},A.value,o,t)||{};if(e.jsCodeSnippet)try{s=q(e.jsCodeSnippet,s)}catch(e){console.error("代码执行失败:",e)}return s}),(e,o)=>(r(),s(a(z[e.showTypeName]),{key:e.showTypeName,class:p([m(O).e("wrapper")]),"sub-show-type":e.subShowType,"chart-data":m(Q),"chart-options":e.chartOptions},null,8,["class","sub-show-type","chart-data","chart-options"]))}});export{B 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, IconRow, IFormatPublicData } from './utils/types'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { JsonToExcel } from '@qxs-bns/utils'\nimport { cloneDeep, merge as lodashMerge } from 'lodash-es'\nimport * as analyze from './analyze'\nimport Area from './components/area.vue'\nimport Bar from './components/bar.vue'\nimport Card from './components/card.vue'\nimport Funnel from './components/funnel.vue'\nimport Line from './components/line.vue'\nimport Pie from './components/pie.vue'\nimport Radar from './components/radar.vue'\nimport ScatterSimple from './components/scatter-simple.vue'\nimport Scatter from './components/scatter.vue'\nimport Table from './components/table.vue'\nimport * as config from './utils/config'\nimport { defaultChartOption } from './utils/config'\nimport { InjectionChartMerge } from './utils/injectionKeys'\nimport { safeEvalConfig } from './utils/safe-eval'\nimport * as types from './utils/types'\nimport { useDataToExcelJson } from './utils/useCharts'\n\ndefineOptions({\n name: 'QxsDataChart',\n})\nconst {\n showTypeName = 'table',\n subShowType,\n modelName = '',\n data: propData = {\n data: [],\n desc: {\n colDesc: [],\n showDesc: {\n showType: 0,\n chartOptions: '{}',\n jsCodeSnippet: '',\n },\n groupByDesc: [],\n },\n },\n chartOptions = {},\n jsCodeSnippet = '',\n} = 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 QxsDataChartConfig = {\n analyze,\n config,\n types,\n}\nconst coms: {\n [key: string]: any\n} = {\n 'table': Table,\n 'bar': Bar,\n 'line': Line,\n 'pie': Pie,\n 'radar': Radar,\n 'scatter': Scatter,\n 'funnel': Funnel,\n 'area': Area,\n 'card': Card,\n 'scatter-simple': ScatterSimple,\n}\n\nconst defaultChartOptionCopy = computed(() => {\n return cloneDeep(defaultChartOption[showTypeName])\n})\n\nconst formatPublicData = computed<IFormatPublicData>(() => {\n const { desc: { colDesc = [], groupByDesc = [] } = {}, data = [] } = propData\n\n // 处理 X 轴数据\n let xValue = []\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 QxsDataChartConfig,\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","QxsDataChartConfig","analyze","config","types","coms","table","Table","bar","Bar","line","Line","pie","Pie","radar","Radar","scatter","Scatter","funnel","Funnel","area","Area","card","Card","ScatterSimple","defaultChartOptionCopy","computed","cloneDeep","defaultChartOption","__props","formatPublicData","desc","colDesc","groupByDesc","data","xValue","xGroupByDesc","map","groupByDescItem","xAxis","dataValue","filter","item","modelName","subShowType","groupByValues","__expose","exportExal","length","console","log","arr","useDataToExcelJson","JsonToExcel","provide","InjectionChartMerge","defaultConfig","conf","lodashMerge","value","jsCodeSnippet","safeEvalConfig","error"],"mappings":"w/
|
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, IconRow, IFormatPublicData } from './utils/types'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { JsonToExcel } from '@qxs-bns/utils'\nimport { cloneDeep, merge as lodashMerge } from 'lodash-es'\nimport * as analyze from './analyze'\nimport Area from './components/area.vue'\nimport Bar from './components/bar.vue'\nimport Card from './components/card.vue'\nimport Funnel from './components/funnel.vue'\nimport Line from './components/line.vue'\nimport Pie from './components/pie.vue'\nimport Radar from './components/radar.vue'\nimport ScatterSimple from './components/scatter-simple.vue'\nimport Scatter from './components/scatter.vue'\nimport Table from './components/table.vue'\nimport * as config from './utils/config'\nimport { defaultChartOption } from './utils/config'\nimport { InjectionChartMerge } from './utils/injectionKeys'\nimport { safeEvalConfig } from './utils/safe-eval'\nimport * as types from './utils/types'\nimport { useDataToExcelJson } from './utils/useCharts'\n\ndefineOptions({\n name: 'QxsDataChart',\n})\nconst {\n showTypeName = 'table',\n subShowType,\n modelName = '',\n data: propData = {\n data: [],\n desc: {\n colDesc: [],\n showDesc: {\n showType: 0,\n chartOptions: '{}',\n jsCodeSnippet: '',\n },\n groupByDesc: [],\n },\n },\n chartOptions = {},\n jsCodeSnippet = '',\n} = 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 QxsDataChartConfig = {\n analyze,\n config,\n types,\n}\nconst coms: {\n [key: string]: any\n} = {\n 'table': Table,\n 'bar': Bar,\n 'line': Line,\n 'pie': Pie,\n 'radar': Radar,\n 'scatter': Scatter,\n 'funnel': Funnel,\n 'area': Area,\n 'card': Card,\n 'scatter-simple': ScatterSimple,\n}\n\nconst defaultChartOptionCopy = computed(() => {\n return cloneDeep(defaultChartOption[showTypeName])\n})\n\nconst formatPublicData = computed<IFormatPublicData>(() => {\n const { desc: { colDesc = [], groupByDesc = [] } = {}, data = [] } = propData\n\n // 处理 X 轴数据\n let xValue = []\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 QxsDataChartConfig,\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","QxsDataChartConfig","analyze","config","types","coms","table","Table","bar","Bar","line","Line","pie","Pie","radar","Radar","scatter","Scatter","funnel","Funnel","area","Area","card","Card","ScatterSimple","defaultChartOptionCopy","computed","cloneDeep","defaultChartOption","__props","formatPublicData","desc","colDesc","groupByDesc","data","xValue","xGroupByDesc","map","groupByDescItem","xAxis","dataValue","filter","item","modelName","subShowType","groupByValues","__expose","exportExal","length","console","log","arr","useDataToExcelJson","JsonToExcel","provide","InjectionChartMerge","defaultConfig","conf","lodashMerge","value","jsCodeSnippet","safeEvalConfig","error","_createBlock","_resolveDynamicComponent","showTypeName","key","class","_normalizeClass","_unref","e","chartOptions"],"mappings":"w/CAqDA,MAAMA,EAAKC,EAAa,cAElBC,EAAqB,CACzBC,UACAC,SACAC,SAEIC,EAEF,CACFC,MAASC,EACTC,IAAOC,EACPC,KAAQC,EACRC,I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
|
-
import{merge as e}from"lodash-es";const
|
1
|
+
import{merge as e}from"lodash-es";import*as t from"echarts";import{getProvinceCode as o,getChinaMapData as a,isProvinceCode as i,getProvinceMapData as s,getProvinceName as n,fetchMapData as l}from"./mapData.mjs";const r={get:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"showTypeName",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"table";return r.data.find(o=>o[e].toString()===t||o[e]===t)},data:[{showTypeName:"table",label:"表格",coverImg:"table.png",disabled:()=>!1,subTypeList:[],showType:0,baseConfig:{}},{showTypeName:"line",label:"折线图",coverImg:"line-stack.png",showType:1,subTypeList:[{value:"line-simple",icon:"line-smooth",tooltipContent:"折线图"},{value:"area-basic",icon:"chart-line-area",tooltipContent:"折线面积图"}],baseConfig:{tooltip:{confine:!1,trigger:"axis",axisPointer:{type:"line"}},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},legend:{type:"scroll",top:"25px"},grid:{left:"0",bottom:"10px",containLabel:!0},xAxis:{type:"category",boundaryGap:!1},yAxis:{type:"value"},dataZoom:[{type:"inside"}]},disabled:(e,t)=>{const o=t?.length;return!(o>=1&&o<2)}},{showTypeName:"bar",label:"柱状图",coverImg:"bar-tick-align.png",showType:2,baseConfig:{legend:{type:"scroll",top:"25px"},tooltip:{confine:!1,trigger:"axis",axisPointer:{type:"shadow"}},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},grid:{left:"0",bottom:"20px",containLabel:!0},xAxis:{axisLabel:{showMaxLabel:!0},axisTick:{alignWithLabel:!0}},yAxis:{},dataZoom:[{type:"inside"}]},subTypeList:[{value:"bar-simple",icon:"bar-simple",tooltipContent:"垂直条形图"},{value:"bar-y-category",icon:"bar-y-category",tooltipContent:"水平条形图"}],disabled:(e,t)=>{const o=t?.length;return!(o>=1)}},{showTypeName:"pie",label:"饼图",coverImg:"pie-simple.png",showType:4,subTypeList:[{value:"pie-simple",icon:"pie-simple",tooltipContent:"饼图"},{value:"pie-borderRadius",icon:"pie-borderRadius",tooltipContent:"环形图"}],baseConfig:{tooltip:{confine:!0,formatter:"{a}<br>{b}: {c}({d}%)",trigger:"item"},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},legend:{type:"scroll",top:"25px"}},disabled:(e,t)=>{const o=t?.length,a=e?.length;return!(a<=4&&o>0&&o<=1)}},{showTypeName:"area",label:"地图",coverImg:"area.png",showType:5,subTypeList:[],baseConfig:{tooltip:{confine:!0,trigger:"item"},toolbox:{show:!1,showTitle:!1,feature:{saveAsImage:{}}},visualMap:{text:["高","低"],realtime:!1,calculable:!0,inRange:{color:["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 p(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return r.get("showType",e)}function c(t,o){const a={};return t.forEach(t=>{a[t.showTypeName]=e(t.baseConfig,o)}),a}const g=c(r.data,{backgroundColor:"transparent",title:{textStyle:{fontSize:14,lineHeight:16}}}),h=new Map,d=()=>{try{const e=t.getMap("china");if(e&&e.geoJson)return e.geoJson}catch(e){console.warn("Failed to get builtin China map:",e)}return{type:"FeatureCollection",features:[]}};function b(e){let{adcode:t}=e;if("string"!=typeof t||t.match(/^\d{6}$/)||"中国"===t||"100000"===t||(t=o(t)),h.has(t)){const e=h.get(t);if(e)return Promise.resolve(e)}return new Promise(async e=>{try{if("中国"===t||"100000"===t)try{const o=await a();return h.set(t,o),void e(o)}catch(e){console.warn("Failed to fetch China map from DataV, using fallback:",e)}if(i(t))try{const o=await s(n(t));if(o&&o.features&&o.features.length>0)return h.set(t,o),void e(o)}catch(o){console.warn("Failed to fetch province map data with new method, trying old method:",o);try{const o=await l(t);if(o&&o.features&&o.features.length>0)return h.set(t,o),void e(o)}catch(e){console.warn("Failed to fetch province map data with old method:",e)}}const o=d();h.set(t,o),e(o)}catch(o){console.error("All map data sources failed, using simple fallback:",o);const a=d();h.set(t,a),e(a)}})}export{g as defaultChartOption,b as getGeoJsonData,r as iconList,c as setDefaultChartOption,p 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","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,KAAM,CACJ,CACEI,aAAc,QACdC,MAAO,KACPC,SAAU,YACVC,SAAUA,KAAM,EAChBC,YAAa,GACbC,SAAU,EACVC,WAAY,CAAA,GAEd,CACEN,aAAc,OACdC,MAAO,MACPC,SAAU,iBACVG,SAAU,EACVD,YAAa,CACX,CACET,MAAO,cACPY,KAAM,cACNC,eAAgB,OAElB,CACEb,MAAO,aACPY,KAAM,kBACNC,eAAgB,UAGpBF,WAAY,CACVG,QAAS,CACPC,SAAS,EACTC,QAAS,OACTC,YAAa,CACXrB,KAAM,SAGVsB,QAAS,CACPC,MAAM,EACNC,WAAW,EACXC,QAAS,CAGPC,YAAa,CAAA,IAGjBC,OAAQ,CACN3B,KAAM,SACN4B,IAAK,QAEPC,KAAM,CACJC,KAAM,IACNC,OAAQ,OACRC,cAAc,GAEhBC,MAAO,CACLjC,KAAM,WACNkC,aAAa,GAEfC,MAAO,CACLnC,KAAM,SAERoC,SAAU,CACR,CACEpC,KAAM,YAIZY,SAAUA,CAACyB,EAAmBC,KAC5B,MAAMC,EAAqBD,GAAcpC,OACrC,QAAAqC,GAAsB,GAAKA,EAAqB,EAG7C,GAGX,CACE9B,aAAc,MACdC,MAAO,MACPC,SAAU,qBACVG,SAAU,EACVC,WAAY,CACVY,OAAQ,CACN3B,KAAM,SACN4B,IAAK,QAEPV,QAAS,CACPC,SAAS,EACTC,QAAS,OACTC,YAAa,CACXrB,KAAM,WAGVsB,QAAS,CACPC,MAAM,EACNC,W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AAQC,QAAQ,CAAC7C,EAAQkE,KAGvCJ,OAAOK,OAAO,CAAC,yBAA0BC,KAEd,IAAIA,GACZC,aAAaH,EAAOI,aAAa,GAAGzB,QAAQ,CAAC0B,EAAYC,KACxE,GAAID,EAEF,YADAE,QAAQF,MAAMA,GAGhB,MAAMG,EAAmB,CACvBC,SAAU,GACVhH,KAAM,qBAGA+G,EAAAC,SAAWH,EAASI,iBAGfnC,EAAAoC,IAAIhC,EAAQ6B,GAEzBzB,EAAQyB,EAAO,GAChB,GACF,GACF,IAEFI,OAAOP,IACEE,QAAAF,MAAM,sBAAuBA,GAC7BtB,EAAA,CACN0B,SAAU,GACVhH,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'\nimport * as echarts from 'echarts'\nimport { fetchMapData, getProvinceCode, getProvinceName, isProvinceCode, getProvinceMapData, getChinaMapData } from './mapData'\n\n/**\n * 禁用功能函数\n * 判断当前图表类型是否被禁用\n * 调用时机:渲染页面\n * @param {object} selectInfos 选择信息\n * @param {object} groupByInfos 分组信息\n * @param {Message[]|Message} data 数据\n * @returns Boolean 布尔值\n */\nexport const iconList: {\n data: IconRow[]\n get: (type: keyof IconRow, value: any) => IconRow\n} = {\n get: (type: keyof IconRow = 'showTypeName', value: any = 'table') => {\n return iconList.data.find(item => item[type].toString() === value || item[type] === value)!\n },\n data: [\n {\n showTypeName: 'table',\n label: '表格',\n coverImg: 'table.png',\n disabled: () => false,\n subTypeList: [],\n showType: 0,\n baseConfig: {},\n },\n {\n showTypeName: 'line',\n label: '折线图',\n coverImg: 'line-stack.png',\n showType: 1,\n subTypeList: [\n {\n value: 'line-simple',\n icon: 'line-smooth',\n tooltipContent: '折线图',\n },\n {\n value: 'area-basic',\n icon: 'chart-line-area',\n tooltipContent: '折线面积图',\n },\n ],\n baseConfig: {\n tooltip: {\n confine: false,\n trigger: 'axis',\n axisPointer: {\n type: 'line',\n },\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n },\n },\n legend: {\n type: 'scroll',\n top: '25px',\n },\n grid: {\n left: '0',\n bottom: '10px',\n containLabel: true,\n },\n xAxis: {\n type: 'category',\n boundaryGap: false,\n },\n yAxis: {\n type: 'value',\n },\n dataZoom: [\n {\n type: 'inside',\n },\n ],\n },\n disabled: (_: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n if (groupByInfosLenght >= 1 && groupByInfosLenght < 2) {\n return false\n }\n return true\n },\n },\n {\n showTypeName: 'bar',\n label: '柱状图',\n coverImg: 'bar-tick-align.png',\n showType: 2,\n baseConfig: {\n legend: {\n type: 'scroll',\n top: '25px',\n },\n tooltip: {\n confine: false,\n trigger: 'axis',\n axisPointer: {\n type: 'shadow',\n },\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n // myFull: { // 全屏\n // show: true,\n // title: '全屏',\n // icon: 'path://...',\n // }\n },\n },\n grid: {\n left: '0',\n bottom: '20px',\n containLabel: true,\n },\n xAxis: {\n axisLabel: {\n showMaxLabel: true,\n },\n axisTick: {\n alignWithLabel: true,\n },\n },\n yAxis: {},\n dataZoom: [\n {\n type: 'inside',\n },\n ],\n },\n subTypeList: [\n {\n value: 'bar-simple',\n icon: 'bar-simple',\n tooltipContent: '垂直条形图',\n },\n {\n value: 'bar-y-category',\n icon: 'bar-y-category',\n tooltipContent: '水平条形图',\n },\n ],\n disabled: (_: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n if (groupByInfosLenght >= 1) {\n return false\n }\n return true\n },\n },\n {\n showTypeName: 'pie',\n label: '饼图',\n coverImg: 'pie-simple.png',\n showType: 4,\n subTypeList: [\n {\n value: 'pie-simple',\n icon: 'pie-simple',\n tooltipContent: '饼图',\n },\n {\n value: 'pie-borderRadius',\n icon: 'pie-borderRadius',\n tooltipContent: '环形图',\n },\n ],\n baseConfig: {\n tooltip: {\n confine: true,\n formatter: '{a}<br>{b}: {c}({d}%)',\n trigger: 'item',\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n },\n },\n legend: {\n type: 'scroll',\n top: '25px',\n },\n },\n disabled: (selectInfos: ISelectInfos[], groupByInfos: IGroupByInfos[]) => {\n const groupByInfosLenght = groupByInfos?.length\n const selectInfosLength = selectInfos?.length\n if (selectInfosLength <= 4 && groupByInfosLenght > 0 && groupByInfosLenght <= 1) {\n return false\n }\n return true\n },\n },\n {\n showTypeName: 'area',\n label: '地图',\n coverImg: 'area.png',\n showType: 5,\n subTypeList: [],\n baseConfig: {\n tooltip: {\n confine: true,\n trigger: 'item',\n },\n toolbox: {\n show: false,\n showTitle: false,\n feature: {\n // dataView: { readOnly: true },\n // restore: {},\n saveAsImage: {},\n },\n },\n visualMap: {\n text: ['高', '低'],\n realtime: false,\n calculable: true,\n inRange: {\n color: ['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>()\n\n // 使用 ECharts 内置的中国地图数据\nconst getBuiltinChinaMap = (): GeoJson => {\n try {\n // 尝试获取 ECharts 内置的中国地图数据\n const chinaMap = echarts.getMap('china')\n if (chinaMap && chinaMap.geoJson) {\n return chinaMap.geoJson as GeoJson\n }\n }\n catch (error) {\n console.warn('Failed to get builtin China map:', error)\n }\n \n // 如果获取失败,返回空的地图数据\n return {\n type: 'FeatureCollection',\n features: [],\n } as GeoJson\n}\nexport function getGeoJsonData(options: any): Promise<GeoJson> {\n let { adcode } = options\n\n // 如果传入的是省份名称,转换为代码\n if (typeof adcode === 'string' && !adcode.match(/^\\d{6}$/) && adcode !== '中国' && adcode !== '100000') {\n adcode = getProvinceCode(adcode)\n }\n\n // 检查缓存中是否存在对应的 GeoJSON 数据\n if (geoJsonCache.has(adcode)) {\n const cachedGeoJson = geoJsonCache.get(adcode)\n if (cachedGeoJson) {\n return Promise.resolve(cachedGeoJson)\n }\n }\n\n // 使用免费的替代方案\n return new Promise(async (resolve) => {\n try {\n // 方案1: 优先使用 DataV 的真实地图数据\n if (adcode === '中国' || adcode === '100000') {\n try {\n const chinaData = await getChinaMapData()\n geoJsonCache.set(adcode, chinaData)\n resolve(chinaData)\n return\n }\n catch (error) {\n console.warn('Failed to fetch China map from DataV, using fallback:', error)\n }\n }\n\n // 方案2: 尝试从免费数据源获取省级地图数据\n if (isProvinceCode(adcode)) {\n try {\n // 尝试使用新的省级地图数据获取函数\n const geoJson = await getProvinceMapData(getProvinceName(adcode))\n if (geoJson && geoJson.features && geoJson.features.length > 0) {\n geoJsonCache.set(adcode, geoJson)\n resolve(geoJson)\n return\n }\n }\n catch (error) {\n console.warn('Failed to fetch province map data with new method, trying old method:', error)\n try {\n const geoJson = await fetchMapData(adcode)\n if (geoJson && geoJson.features && geoJson.features.length > 0) {\n geoJsonCache.set(adcode, geoJson)\n resolve(geoJson)\n return\n }\n }\n catch (secondError) {\n console.warn('Failed to fetch province map data with old method:', secondError)\n }\n }\n }\n\n // 方案3: 使用内置的中国地图数据作为备用\n const builtinMap = getBuiltinChinaMap()\n geoJsonCache.set(adcode, builtinMap)\n resolve(builtinMap)\n }\n catch (error) {\n console.error('All map data sources failed, using simple fallback:', error)\n const builtinMap = getBuiltinChinaMap()\n geoJsonCache.set(adcode, builtinMap)\n resolve(builtinMap)\n }\n })\n}\n"],"names":["iconList","get","type","arguments","length","undefined","value","data","find","item","toString","showTypeName","label","coverImg","disabled","subTypeList","showType","baseConfig","icon","tooltipContent","tooltip","confine","trigger","axisPointer","toolbox","show","showTitle","feature","saveAsImage","legend","top","grid","left","bottom","containLabel","xAxis","boundaryGap","yAxis","dataZoom","_","groupByInfos","groupByInfosLenght","axisLabel","showMaxLabel","axisTick","alignWithLabel","formatter","selectInfos","selectInfosLength","visualMap","text","realtime","calculable","inRange","color","flag","some","_ref","colDesc","includes","orient","radar","center","showDelay","lineStyle","width","splitLine","showTypeText","setDefaultChartOption","option","changeConfig","obj","forEach","merge","defaultChartOption","backgroundColor","title","textStyle","fontSize","lineHeight","geoJsonCache","Map","getBuiltinChinaMap","chinaMap","echarts","getMap","geoJson","error","console","warn","features","getGeoJsonData","options","adcode","match","getProvinceCode","has","cachedGeoJson","Promise","resolve","async","chinaData","getChinaMapData","set","isProvinceCode","getProvinceMapData","getProvinceName","fetchMapData","secondError","builtinMap"],"mappings":"oNAcO,MAAMA,EAGT,CACFC,IAAK,WAAgE,IAA/DC,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAsB,eAAgBG,yDAAa,QACvD,OAAON,EAASO,KAAKC,KAAKC,GAAQA,EAAKP,GAAMQ,aAAeJ,GAASG,EAAKP,KAAUI,EACtF,EACAC,KAAM,CACJ,CACEI,aAAc,QACdC,MAAO,KACPC,SAAU,YACVC,SAAUA,KAAM,EAChBC,YAAa,GACbC,SAAU,EACVC,WAAY,CAAA,GAEd,CACEN,aAAc,OACdC,MAAO,MACPC,SAAU,iBACVG,SAAU,EACVD,YAAa,CACX,CACET,MAAO,cACPY,KAAM,cACNC,eAAgB,OAElB,CACEb,MAAO,aACPY,KAAM,kBACNC,eAAgB,UAGpBF,WAAY,CACVG,QAAS,CACPC,SAAS,EACTC,QAAS,OACTC,YAAa,CACXrB,KAAM,SAGVsB,QAAS,CACPC,MAAM,EACNC,WAAW,EACXC,QAAS,CAGPC,YAAa,CAAA,IAGjBC,OAAQ,CACN3B,KAAM,SACN4B,IAAK,QAEPC,KAAM,CACJC,KAAM,IACNC,OAAQ,OACRC,cAAc,GAEhBC,MAAO,CACLjC,KAAM,WACNkC,aAAa,GAEfC,MAAO,CACLnC,KAAM,SAERoC,SAAU,CACR,CACEpC,KAAM,YAIZY,SAAUA,CAACyB,EAAmBC,KAC5B,MAAMC,EAAqBD,GAAcpC,OACzC,QAAIqC,GAAsB,GAAKA,EAAqB,KAMxD,CACE9B,aAAc,MACdC,MAAO,MACPC,SAAU,qBACVG,SAAU,EACVC,WAAY,CACVY,OAAQ,CACN3B,KAAM,SACN4B,IAAK,QAEPV,QAAS,CACPC,SAAS,EACTC,QAAS,OACTC,YAAa,CACXrB,KAAM,WAGVsB,QAAS,CACPC,MAAM,EACNC,WAAW,EACXC,QA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kBC,IAGxB,OAFAtB,EAAauB,IAAIV,EAAQQ,QACzBF,EAAQE,EAEV,OACOd,GACLC,QAAQC,KAAK,wDAAyDF,EACxE,CAIF,GAAIiB,EAAeX,GACjB,IAEE,MAAMP,QAAgBmB,EAAmBC,EAAgBb,IACzD,GAAIP,GAAWA,EAAQI,UAAYJ,EAAQI,SAAStF,OAAS,EAG3D,OAFA4E,EAAauB,IAAIV,EAAQP,QACzBa,EAAQb,EAGZ,OACOC,GACLC,QAAQC,KAAK,wEAAyEF,GACtF,IACE,MAAMD,QAAgBqB,EAAad,GACnC,GAAIP,GAAWA,EAAQI,UAAYJ,EAAQI,SAAStF,OAAS,EAG3D,OAFA4E,EAAauB,IAAIV,EAAQP,QACzBa,EAAQb,EAGZ,OACOsB,GACLpB,QAAQC,KAAK,qDAAsDmB,EACrE,CACF,CAIF,MAAMC,EAAa3B,IACnBF,EAAauB,IAAIV,EAAQgB,GACzBV,EAAQU,EACV,OACOtB,GACLC,QAAQD,MAAM,sDAAuDA,GACrE,MAAMsB,EAAa3B,IACnBF,EAAauB,IAAIV,EAAQgB,GACzBV,EAAQU,EACV,GAEJ"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
const t={PROVINCE:{TIANDITU:()=>"https://api.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=你的天地图token",DATAV:t=>`https://geo.datav.aliyun.com/areas_v3/bound/${t}_full.json`},TIANDITU_ADMIN:{BOUNDARY:t=>`https://api.tianditu.gov.cn/administrative?postStr={"searchWord":"${t}","searchType":"11","needSubInfo":true,"needAll":true,"needPolygon":true,"needPre":true}&type=query&tk=你的天地图token`}};async function e(){try{const t=await fetch("https://geo.datav.aliyun.com/areas_v3/bound/100000_full.json");if(t.ok)return await t.json()}catch(t){console.warn("Failed to fetch China map from DataV:",t)}return{type:"FeatureCollection",features:[{type:"Feature",properties:{name:"中国",adcode:"100000"},geometry:{type:"Polygon",coordinates:[[[73.66,35.42],[78.91,35.42],[81.33,36.08],[85.29,36.08],[88.02,35.42],[90.16,35.42],[92.13,34.76],[94.81,34.76],[97.06,33.44],[99.43,32.78],[101.06,31.46],[102.73,30.14],[104.4,28.82],[106.07,27.5],[107.74,26.18],[109.41,24.86],[111.08,23.54],[112.75,22.22],[114.42,20.9],[116.09,19.58],[117.76,18.26],[119.43,16.94],[121.1,15.62],[122.77,14.3],[124.44,12.98],[126.11,11.66],[127.78,10.34],[129.45,9.02],[131.12,7.7],[132.79,6.38],[134.46,5.06],[135.05,4.4],[135.05,5.06],[135.05,6.38],[135.05,7.7],[135.05,9.02],[135.05,10.34],[135.05,11.66],[135.05,12.98],[135.05,14.3],[135.05,15.62],[135.05,16.94],[135.05,18.26],[135.05,19.58],[135.05,20.9],[135.05,22.22],[135.05,23.54],[135.05,24.86],[135.05,26.18],[135.05,27.5],[135.05,28.82],[135.05,30.14],[135.05,31.46],[135.05,32.78],[135.05,34.1],[135.05,35.42],[134.46,36.08],[133.79,36.74],[133.12,37.4],[132.45,38.06],[131.78,38.72],[131.11,39.38],[130.44,40.04],[129.77,40.7],[129.1,41.36],[128.43,42.02],[127.76,42.68],[127.09,43.34],[126.42,44],[125.75,44.66],[125.08,45.32],[124.41,45.98],[123.74,46.64],[123.07,47.3],[122.4,47.96],[121.73,48.62],[121.06,49.28],[120.39,49.94],[119.72,50.6],[119.05,51.26],[118.38,51.92],[117.71,52.58],[117.04,53.24],[116.37,53.9],[115.7,54.56],[115.03,55.22],[114.36,55.88],[113.69,56.54],[113.02,57.2],[112.35,57.86],[111.68,58.52],[111.01,59.18],[110.34,59.84],[109.67,60.5],[109,61.16],[108.33,61.82],[107.66,62.48],[106.99,63.14],[106.32,63.8],[105.65,64.46],[104.98,65.12],[104.31,65.78],[103.64,66.44],[102.97,67.1],[102.3,67.76],[101.63,68.42],[100.96,69.08],[100.29,69.74],[99.62,70.4],[98.95,71.06],[98.28,71.72],[97.61,72.38],[96.94,73.04],[96.27,73.7],[95.6,74.36],[94.93,75.02],[94.26,75.68],[93.59,76.34],[92.92,77],[92.25,77.66],[91.58,78.32],[90.91,78.98],[90.24,79.64],[89.57,80.3],[88.9,80.96],[88.23,81.62],[87.56,82.28],[86.89,82.94],[86.22,83.6],[85.55,84.26],[84.88,84.92],[84.21,85.58],[83.54,86.24],[82.87,86.9],[82.2,87.56],[81.53,88.22],[80.86,88.88],[80.19,89.54],[79.52,90.2],[78.85,90.86],[78.18,91.52],[77.51,92.18],[76.84,92.84],[76.17,93.5],[75.5,94.16],[74.83,94.82],[74.16,95.48],[73.66,96.14],[73.66,95.48],[73.66,94.82],[73.66,94.16],[73.66,93.5],[73.66,92.84],[73.66,92.18],[73.66,91.52],[73.66,90.86],[73.66,90.2],[73.66,89.54],[73.66,88.88],[73.66,88.22],[73.66,87.56],[73.66,86.9],[73.66,86.24],[73.66,85.58],[73.66,84.92],[73.66,84.26],[73.66,83.6],[73.66,82.94],[73.66,82.28],[73.66,81.62],[73.66,80.96],[73.66,80.3],[73.66,79.64],[73.66,78.98],[73.66,78.32],[73.66,77.66],[73.66,77],[73.66,76.34],[73.66,75.68],[73.66,75.02],[73.66,74.36],[73.66,73.7],[73.66,73.04],[73.66,72.38],[73.66,71.72],[73.66,71.06],[73.66,70.4],[73.66,69.74],[73.66,69.08],[73.66,68.42],[73.66,67.76],[73.66,67.1],[73.66,66.44],[73.66,65.78],[73.66,65.12],[73.66,64.46],[73.66,63.8],[73.66,63.14],[73.66,62.48],[73.66,61.82],[73.66,61.16],[73.66,60.5],[73.66,59.84],[73.66,59.18],[73.66,58.52],[73.66,57.86],[73.66,57.2],[73.66,56.54],[73.66,55.88],[73.66,55.22],[73.66,54.56],[73.66,53.9],[73.66,53.24],[73.66,52.58],[73.66,51.92],[73.66,51.26],[73.66,50.6],[73.66,49.94],[73.66,49.28],[73.66,48.62],[73.66,47.96],[73.66,47.3],[73.66,46.64],[73.66,45.98],[73.66,45.32],[73.66,44.66],[73.66,44],[73.66,43.34],[73.66,42.68],[73.66,42.02],[73.66,41.36],[73.66,40.7],[73.66,40.04],[73.66,39.38],[73.66,38.72],[73.66,38.06],[73.66,37.4],[73.66,36.74],[73.66,36.08],[73.66,35.42]]]}}]}}const o={"北京市":"110000","天津市":"120000","河北省":"130000","山西省":"140000","内蒙古自治区":"150000","辽宁省":"210000","吉林省":"220000","黑龙江省":"230000","上海市":"310000","江苏省":"320000","浙江省":"330000","安徽省":"340000","福建省":"350000","江西省":"360000","山东省":"370000","河南省":"410000","湖北省":"420000","湖南省":"430000","广东省":"440000","广西壮族自治区":"450000","海南省":"460000","重庆市":"500000","四川省":"510000","贵州省":"520000","云南省":"530000","西藏自治区":"540000","陕西省":"610000","甘肃省":"620000","青海省":"630000","宁夏回族自治区":"640000","新疆维吾尔自治区":"650000","台湾省":"710000","香港特别行政区":"810000","澳门特别行政区":"820000"},r=Object.fromEntries(Object.entries(o).map(t=>{let[e,o]=t;return[o,e]}));function a(t){return o[t]||"100000"}function n(t){return r[t]||"中国"}function c(t){return/^\d{6}$/.test(t)&&"100000"!==t}async function s(t){const e=a(t);try{const t=`https://geo.datav.aliyun.com/areas_v3/bound/${e}_full.json`,o=await fetch(t);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return await o.json()}catch(e){throw console.error("Failed to fetch province map data for:",t,e),e}}const i={TOKEN:"你的天地图token",BASE_URL:"https://api.tianditu.gov.cn"};async function u(e){try{const o=t.TIANDITU_ADMIN.BOUNDARY(e).replace("你的天地图token",i.TOKEN),r=await fetch(o);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return await r.json()}catch(t){throw console.error("Failed to fetch Tianditu boundary data:",t),t}}async function d(e){try{const o=t.PROVINCE.DATAV(e);console.log("Fetching province map data from:",o);const r=await fetch(o);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const a=await r.json();return console.log("Successfully fetched province map data for:",e,a),a}catch(t){throw console.error("Failed to fetch map data for adcode:",e,t),t}}export{t as FREE_MAP_SOURCES,o as PROVINCE_CODES,r as PROVINCE_NAMES,i as TIANDITU_CONFIG,d as fetchMapData,u as fetchTiandituBoundary,e as getChinaMapData,a as getProvinceCode,s as getProvinceMapData,n as getProvinceName,c as isProvinceCode};
|
2
|
+
//# sourceMappingURL=mapData.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mapData.mjs","sources":["../../../../../../../packages/components/src/data-chart/src/utils/mapData.ts"],"sourcesContent":["// 免费的地图数据源\nexport const FREE_MAP_SOURCES = {\n // 省级地图数据源\n PROVINCE: {\n // 使用天地图省级数据\n TIANDITU: () => `https://api.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=你的天地图token`,\n // 使用 DataV 的省级数据\n DATAV: (adcode: string) => `https://geo.datav.aliyun.com/areas_v3/bound/${adcode}_full.json`,\n },\n // 天地图行政区划数据\n TIANDITU_ADMIN: {\n // 获取行政区划边界数据\n BOUNDARY: (adcode: string) => `https://api.tianditu.gov.cn/administrative?postStr={\"searchWord\":\"${adcode}\",\"searchType\":\"11\",\"needSubInfo\":true,\"needAll\":true,\"needPolygon\":true,\"needPre\":true}&type=query&tk=你的天地图token`,\n },\n}\n\n// 中国地图数据 - 使用真实的省级边界数据\nexport const CHINA_MAP_DATA = {\n type: 'FeatureCollection',\n features: [\n // 这里应该包含所有省份的边界数据\n // 由于数据量很大,建议使用外部数据源\n ]\n}\n\n// 获取中国地图数据的函数\nexport async function getChinaMapData(): Promise<any> {\n try {\n // 优先使用 DataV 的中国地图数据\n const response = await fetch('https://geo.datav.aliyun.com/areas_v3/bound/100000_full.json')\n if (response.ok) {\n return await response.json()\n }\n }\n catch (error) {\n console.warn('Failed to fetch China map from DataV:', error)\n }\n\n // 备用方案:使用简化的地图数据\n return {\n type: 'FeatureCollection',\n features: [\n {\n type: 'Feature',\n properties: {\n name: '中国',\n adcode: '100000',\n },\n geometry: {\n type: 'Polygon',\n coordinates: [[\n [73.66, 35.42], [78.91, 35.42], [81.33, 36.08], [85.29, 36.08], \n [88.02, 35.42], [90.16, 35.42], [92.13, 34.76], [94.81, 34.76], \n [97.06, 33.44], [99.43, 32.78], [101.06, 31.46], [102.73, 30.14], \n [104.40, 28.82], [106.07, 27.50], [107.74, 26.18], [109.41, 24.86], \n [111.08, 23.54], [112.75, 22.22], [114.42, 20.90], [116.09, 19.58], \n [117.76, 18.26], [119.43, 16.94], [121.10, 15.62], [122.77, 14.30], \n [124.44, 12.98], [126.11, 11.66], [127.78, 10.34], [129.45, 9.02], \n [131.12, 7.70], [132.79, 6.38], [134.46, 5.06], [135.05, 4.40], \n [135.05, 5.06], [135.05, 6.38], [135.05, 7.70], [135.05, 9.02], \n [135.05, 10.34], [135.05, 11.66], [135.05, 12.98], [135.05, 14.30], \n [135.05, 15.62], [135.05, 16.94], [135.05, 18.26], [135.05, 19.58], \n [135.05, 20.90], [135.05, 22.22], [135.05, 23.54], [135.05, 24.86], \n [135.05, 26.18], [135.05, 27.50], [135.05, 28.82], [135.05, 30.14], \n [135.05, 31.46], [135.05, 32.78], [135.05, 34.10], [135.05, 35.42], \n [134.46, 36.08], [133.79, 36.74], [133.12, 37.40], [132.45, 38.06], \n [131.78, 38.72], [131.11, 39.38], [130.44, 40.04], [129.77, 40.70], \n [129.10, 41.36], [128.43, 42.02], [127.76, 42.68], [127.09, 43.34], \n [126.42, 44.00], [125.75, 44.66], [125.08, 45.32], [124.41, 45.98], \n [123.74, 46.64], [123.07, 47.30], [122.40, 47.96], [121.73, 48.62], \n [121.06, 49.28], [120.39, 49.94], [119.72, 50.60], [119.05, 51.26], \n [118.38, 51.92], [117.71, 52.58], [117.04, 53.24], [116.37, 53.90], \n [115.70, 54.56], [115.03, 55.22], [114.36, 55.88], [113.69, 56.54], \n [113.02, 57.20], [112.35, 57.86], [111.68, 58.52], [111.01, 59.18], \n [110.34, 59.84], [109.67, 60.50], [109.00, 61.16], [108.33, 61.82], \n [107.66, 62.48], [106.99, 63.14], [106.32, 63.80], [105.65, 64.46], \n [104.98, 65.12], [104.31, 65.78], [103.64, 66.44], [102.97, 67.10], \n [102.30, 67.76], [101.63, 68.42], [100.96, 69.08], [100.29, 69.74], \n [99.62, 70.40], [98.95, 71.06], [98.28, 71.72], [97.61, 72.38], \n [96.94, 73.04], [96.27, 73.70], [95.60, 74.36], [94.93, 75.02], \n [94.26, 75.68], [93.59, 76.34], [92.92, 77.00], [92.25, 77.66], \n [91.58, 78.32], [90.91, 78.98], [90.24, 79.64], [89.57, 80.30], \n [88.90, 80.96], [88.23, 81.62], [87.56, 82.28], [86.89, 82.94], \n [86.22, 83.60], [85.55, 84.26], [84.88, 84.92], [84.21, 85.58], \n [83.54, 86.24], [82.87, 86.90], [82.20, 87.56], [81.53, 88.22], \n [80.86, 88.88], [80.19, 89.54], [79.52, 90.20], [78.85, 90.86], \n [78.18, 91.52], [77.51, 92.18], [76.84, 92.84], [76.17, 93.50], \n [75.50, 94.16], [74.83, 94.82], [74.16, 95.48], [73.66, 96.14], \n [73.66, 95.48], [73.66, 94.82], [73.66, 94.16], [73.66, 93.50], \n [73.66, 92.84], [73.66, 92.18], [73.66, 91.52], [73.66, 90.86], \n [73.66, 90.20], [73.66, 89.54], [73.66, 88.88], [73.66, 88.22], \n [73.66, 87.56], [73.66, 86.90], [73.66, 86.24], [73.66, 85.58], \n [73.66, 84.92], [73.66, 84.26], [73.66, 83.60], [73.66, 82.94], \n [73.66, 82.28], [73.66, 81.62], [73.66, 80.96], [73.66, 80.30], \n [73.66, 79.64], [73.66, 78.98], [73.66, 78.32], [73.66, 77.66], \n [73.66, 77.00], [73.66, 76.34], [73.66, 75.68], [73.66, 75.02], \n [73.66, 74.36], [73.66, 73.70], [73.66, 73.04], [73.66, 72.38], \n [73.66, 71.72], [73.66, 71.06], [73.66, 70.40], [73.66, 69.74], \n [73.66, 69.08], [73.66, 68.42], [73.66, 67.76], [73.66, 67.10], \n [73.66, 66.44], [73.66, 65.78], [73.66, 65.12], [73.66, 64.46], \n [73.66, 63.80], [73.66, 63.14], [73.66, 62.48], [73.66, 61.82], \n [73.66, 61.16], [73.66, 60.50], [73.66, 59.84], [73.66, 59.18], \n [73.66, 58.52], [73.66, 57.86], [73.66, 57.20], [73.66, 56.54], \n [73.66, 55.88], [73.66, 55.22], [73.66, 54.56], [73.66, 53.90], \n [73.66, 53.24], [73.66, 52.58], [73.66, 51.92], [73.66, 51.26], \n [73.66, 50.60], [73.66, 49.94], [73.66, 49.28], [73.66, 48.62], \n [73.66, 47.96], [73.66, 47.30], [73.66, 46.64], [73.66, 45.98], \n [73.66, 45.32], [73.66, 44.66], [73.66, 44.00], [73.66, 43.34], \n [73.66, 42.68], [73.66, 42.02], [73.66, 41.36], [73.66, 40.70], \n [73.66, 40.04], [73.66, 39.38], [73.66, 38.72], [73.66, 38.06], \n [73.66, 37.40], [73.66, 36.74], [73.66, 36.08], [73.66, 35.42]\n ]],\n },\n },\n ],\n }\n}\n\n\n\n// 省级行政区代码映射\nexport const PROVINCE_CODES = {\n '北京市': '110000',\n '天津市': '120000',\n '河北省': '130000',\n '山西省': '140000',\n '内蒙古自治区': '150000',\n '辽宁省': '210000',\n '吉林省': '220000',\n '黑龙江省': '230000',\n '上海市': '310000',\n '江苏省': '320000',\n '浙江省': '330000',\n '安徽省': '340000',\n '福建省': '350000',\n '江西省': '360000',\n '山东省': '370000',\n '河南省': '410000',\n '湖北省': '420000',\n '湖南省': '430000',\n '广东省': '440000',\n '广西壮族自治区': '450000',\n '海南省': '460000',\n '重庆市': '500000',\n '四川省': '510000',\n '贵州省': '520000',\n '云南省': '530000',\n '西藏自治区': '540000',\n '陕西省': '610000',\n '甘肃省': '620000',\n '青海省': '630000',\n '宁夏回族自治区': '640000',\n '新疆维吾尔自治区': '650000',\n '台湾省': '710000',\n '香港特别行政区': '810000',\n '澳门特别行政区': '820000',\n}\n\n// 省级名称映射(反向查找)\nexport const PROVINCE_NAMES = Object.fromEntries(\n Object.entries(PROVINCE_CODES).map(([name, code]) => [code, name])\n)\n\n// 获取省级代码\nexport function getProvinceCode(provinceName: string): string {\n return PROVINCE_CODES[provinceName as keyof typeof PROVINCE_CODES] || '100000'\n}\n\n// 获取省级名称\nexport function getProvinceName(provinceCode: string): string {\n return PROVINCE_NAMES[provinceCode] || '中国'\n}\n\n// 判断是否为省级代码\nexport function isProvinceCode(code: string): boolean {\n return /^\\d{6}$/.test(code) && code !== '100000'\n}\n\n// 获取省级地图数据\nexport async function getProvinceMapData(provinceName: string): Promise<any> {\n const provinceCode = getProvinceCode(provinceName)\n \n try {\n const url = `https://geo.datav.aliyun.com/areas_v3/bound/${provinceCode}_full.json`\n \n const response = await fetch(url)\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n \n const data = await response.json()\n return data\n }\n catch (error) {\n console.error('Failed to fetch province map data for:', provinceName, error)\n throw error\n }\n}\n\n// 天地图配置\nexport const TIANDITU_CONFIG = {\n // 天地图 token(需要申请)\n TOKEN: '你的天地图token', // 请替换为您的天地图 token\n // 天地图 API 基础 URL\n BASE_URL: 'https://api.tianditu.gov.cn',\n}\n\n// 获取天地图行政区划数据\nexport async function fetchTiandituBoundary(adcode: string): Promise<any> {\n try {\n const url = FREE_MAP_SOURCES.TIANDITU_ADMIN.BOUNDARY(adcode).replace('你的天地图token', TIANDITU_CONFIG.TOKEN)\n const response = await fetch(url)\n \n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n \n const data = await response.json()\n return data\n }\n catch (error) {\n console.error('Failed to fetch Tianditu boundary data:', error)\n throw error\n }\n}\n\n// 获取地图数据的函数\nexport async function fetchMapData(adcode: string): Promise<any> {\n try {\n // 优先尝试从天地图获取数据\n if (TIANDITU_CONFIG.TOKEN !== '你的天地图token') {\n try {\n const tiandituData = await fetchTiandituBoundary(adcode)\n if (tiandituData && tiandituData.data && tiandituData.data.length > 0) {\n // 转换天地图数据为 GeoJSON 格式\n return convertTiandituToGeoJson(tiandituData)\n }\n }\n catch (error) {\n console.warn('Failed to fetch from Tianditu, trying DataV:', error)\n }\n }\n\n // 备用方案:从 DataV 获取数据\n const url = FREE_MAP_SOURCES.PROVINCE.DATAV(adcode)\n console.log('Fetching province map data from:', url)\n const response = await fetch(url)\n \n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n \n const data = await response.json()\n console.log('Successfully fetched province map data for:', adcode, data)\n return data\n }\n catch (error) {\n console.error('Failed to fetch map data for adcode:', adcode, error)\n throw error\n }\n}\n\n// 转换天地图数据为 GeoJSON 格式\nfunction convertTiandituToGeoJson(tiandituData: any): any {\n const features = tiandituData.data.map((item: any) => ({\n type: 'Feature',\n properties: {\n name: item.name,\n adcode: item.adcode,\n level: item.level,\n },\n geometry: {\n type: 'Polygon',\n coordinates: item.polygon ? [item.polygon] : [],\n },\n }))\n\n return {\n type: 'FeatureCollection',\n features,\n }\n} "],"names":["FREE_MAP_SOURCES","PROVINCE","TIANDITU","DATAV","adcode","TIANDITU_ADMIN","BOUNDARY","async","getChinaMapData","response","fetch","ok","json","error","console","warn","type","features","properties","name","geometry","coordinates","PROVINCE_CODES","PROVINCE_NAMES","Object","fromEntries","entries","map","_ref","code","getProvinceCode","provinceName","getProvinceName","provinceCode","isProvinceCode","test","getProvinceMapData","url","Error","status","TIANDITU_CONFIG","TOKEN","BASE_URL","fetchTiandituBoundary","replace","fetchMapData","log","data"],"mappings":"AACO,MAAMA,EAAmB,CAE9BC,SAAU,CAERC,SAAUA,IAAM,8LAEhBC,MAAQC,GAAmB,+CAA+CA,eAG5EC,eAAgB,CAEdC,SAAWF,GAAmB,qEAAqEA,uHAcvGG,eAAsBC,IACpB,IAEE,MAAMC,QAAiBC,MAAM,gEAC7B,GAAID,EAASE,GACX,aAAaF,EAASG,MAE1B,OACOC,GACL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F,CAGAN,eAAsBsC,EAAazC,GACjC,IAgBE,MAAMiC,EAAMrC,EAAiBC,SAASE,MAAMC,GAC5CU,QAAQgC,IAAI,mCAAoCT,GAChD,MAAM5B,QAAiBC,MAAM2B,GAE7B,IAAK5B,EAASE,GACZ,MAAM,IAAI2B,MAAM,uBAAuB7B,EAAS8B,UAGlD,MAAMQ,QAAatC,EAASG,OAE5B,OADAE,QAAQgC,IAAI,8CAA+C1C,EAAQ2C,GAC5DA,CACT,OACOlC,GAEL,MADAC,QAAQD,MAAM,uCAAwCT,EAAQS,GACxDA,CACR,CACF"}
|
@@ -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":"
|
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":"AAQO,SAASA,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,KAEZ,GAAmB,iBAARA,EAAkB,CAC3B,GAAIA,IAAQC,OAAOC,YACjB,OAEF,OAAOC,QAAQL,IAAIC,EAAQC,EAC7B,CACA,OAAOD,EAAOC,MAMlB,IAEE,MAAMI,EAAO,oBAAoBvB,MAKjC,OAHW,IAAIwB,SAAS,UAAWD,EACnCE,CAAGb,GAEIA,EAAeX,MACxB,OACOyB,GAEL,OADAhB,QAAQgB,MAAM,UAAWA,GAClBzB,CACT,CACF"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import*as e from"echarts";import t from"
|
1
|
+
import*as e from"echarts";import{onMounted as t,onUnmounted as o}from"vue";import{useMouseInElement as i,watchDebounced as r,useElementSize as n}from"@vueuse/core";import s from"../components/empty.svg.mjs";function a(n){let{chartDOM:a,chartData:l,chartOptions:u,initBefore:d,initAfter:p}=n,f=null,h=!1;const g=window.devicePixelRatio||1;function m(){if(f&&!f.isDisposed()){try{f.dispose()}catch(e){console.warn("Error disposing chart:",e)}f=null}}function w(){return f&&!f.isDisposed()||(f=e.init(a.value,null,{devicePixelRatio:g,renderer:"svg"})),f}function y(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"暂无数据";return new Promise(t=>{const o=new Image;o.src=s,o.onload=()=>{const i=o.width/o.height,r={title:[{text:l.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/i,width:100,backgroundColor:{image:s}}}}}]};h=!0,t([r,{notMerge:!0,replaceMerge:["xAxis","yAxis","series"],lazyUpdate:!1}])}})}const{isOutside:v}=i(a);return r(v,e=>{"boolean"==typeof e&&f&&!f.isDisposed()&&function(e){if(f&&!f.isDisposed())try{f.setOption({toolbox:{show:e}})}catch(e){console.warn("Error toggling toolbox:",e)}}(!e)},{debounce:200}),r(()=>u.value,async()=>{f&&!f.isDisposed()&&await async function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];try{f?.showLoading(),l.value?.data?.length?(!0===h&&(t[1]||(t[1]={}),t[1].notMerge=!0),h=!1):t=await y(),f?.setOption(...t)}catch(e){f&&!f.isDisposed()&&m(),w(),t=await y("配置项错误"),f?.setOption(...t)}finally{f?.hideLoading()}}(u.value)},{debounce:500,deep:!0,immediate:!0}),t(async()=>{d&&await d(),w(),p&&await p(f),f&&!f.isDisposed()&&c(f,a)}),o(()=>{if(f&&!f.isDisposed())try{f.getZr()?.off("mousemove"),f.getZr()?.off("mouseout"),f.getZr()?.off("click"),f.off("click"),m()}catch(e){console.warn("Error during chart cleanup:",e)}}),{myChart:f}}function c(e,t){const{width:o,height:i}=n(t);r([o,i],()=>{if(e&&!e.isDisposed())try{e.resize()}catch(e){console.warn("Error during chart resize:",e)}})}function l(e){const{desc:{colDesc:t=[],groupByDesc:o=[]}={},data:i=[]}=e,r=[...o.map(e=>e.colDesc),...t].filter(e=>e),n=i.map(e=>r.map(t=>e[t]||""));return[r,...n]}export{a as useCharts,l as useDataToExcelJson,c 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,
|
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'\nimport { onMounted, onUnmounted } from 'vue'\nimport { useMouseInElement, useElementSize, watchDebounced } from '@vueuse/core'\n\n// 使用别名路径导入 SVG\nimport emptyImg from '../components/empty.svg'\n\nexport function useCharts({ chartDOM, chartData, chartOptions, initBefore, initAfter }: {\n chartDOM: Ref<HTMLElement | null>\n chartData: Ref<IFormatPublicData>\n chartOptions: Ref<EChartsOption>\n initBefore?: () => Promise<void>\n initAfter?: (e: ECharts | null) => void\n}) {\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 try {\n myChart.dispose()\n }\n catch (error) {\n console.warn('Error disposing chart:', error)\n }\n myChart = null\n }\n }\n\n function initChart() {\n if (!(myChart && !myChart.isDisposed())) {\n // 如果实例已被销毁,重新创建\n myChart = echarts.init(chartDOM.value, null, {\n devicePixelRatio: dpr,\n renderer: 'svg',\n })\n }\n return myChart\n }\n\n async function renderChart(...opt: [EChartsOption, SetOptionOpts?]) {\n try {\n myChart?.showLoading()\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 }\n else {\n // 数据为空时保持原有配置\n opt = await setEmpty()\n }\n myChart?.setOption(...opt)\n }\n catch (error) {\n if (myChart && !myChart.isDisposed()) {\n disposeChart()\n }\n // 如果实例已被销毁,重新创建\n initChart()\n opt = await setEmpty('配置项错误')\n myChart?.setOption(...opt)\n } finally {\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 // 修改条件判断,移除 isDisposed 检查\n if (myChart && !myChart.isDisposed()) {\n try {\n myChart.setOption({\n toolbox: {\n show,\n },\n })\n }\n catch (error) {\n console.warn('Error toggling toolbox:', error)\n }\n }\n }\n\n const { isOutside: mouseInChart } = useMouseInElement(chartDOM)\n watchDebounced(mouseInChart, (newVal) => {\n // 修改条件判断\n if (typeof newVal !== 'boolean' || (!myChart || myChart.isDisposed())) {\n return\n }\n toggleToolbox(!newVal)\n }, { debounce: 200 })\n\n watchDebounced(\n () => chartOptions.value,\n async () => {\n // 修改条件判断\n if (myChart && !myChart.isDisposed()) {\n await renderChart(chartOptions.value)\n }\n },\n { debounce: 500, deep: true, immediate: true },\n )\n\n onMounted(async () => {\n if (initBefore) {\n await initBefore()\n }\n initChart()\n if (initAfter) {\n await initAfter(myChart)\n }\n // 修改条件判断\n if (myChart && !myChart.isDisposed()) {\n useResize(myChart, chartDOM)\n }\n })\n\n onUnmounted(() => {\n if (myChart && !myChart.isDisposed()) {\n try {\n // 清理所有事件监听器\n myChart.getZr()?.off('mousemove')\n myChart.getZr()?.off('mouseout')\n myChart.getZr()?.off('click')\n myChart.off('click')\n disposeChart()\n }\n catch (error) {\n console.warn('Error during chart cleanup:', error)\n }\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 && !myChart.isDisposed()) {\n try {\n myChart.resize()\n }\n catch (error) {\n console.warn('Error during chart resize:', error)\n }\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","chartDOM","chartData","chartOptions","initBefore","initAfter","_ref","myChart","isEmpty","dpr","window","devicePixelRatio","disposeChart","isDisposed","dispose","error","console","warn","initChart","echarts","init","value","renderer","setEmpty","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","notMerge","replaceMerge","lazyUpdate","isOutside","mouseInChart","useMouseInElement","watchDebounced","newVal","show","setOption","toolbox","toggleToolbox","debounce","async","_len","arguments","length","opt","Array","_key","showLoading","data","hideLoading","renderChart","deep","immediate","onMounted","useResize","onUnmounted","getZr","off","useElementSize","resize","useDataToExcelJson","dataSource","desc","colDesc","groupByDesc","header","map","item","filter","v","json","headerItem"],"mappings":"+MAUO,SAASA,KAMb,IANuBC,SAAEA,EAAAC,UAAUA,eAAWC,EAAAC,WAAcA,EAAAC,UAAYA,GAAUC,EAQ/EC,EAA0B,KAC1BC,GAAU,EAGd,MAAMC,EAAMC,OAAOC,kBAAoB,EAEvC,SAASC,IACP,GAAIL,IAAYA,EAAQM,aAAc,CACpC,IACEN,EAAQO,SACV,OACOC,GACLC,QAAQC,KAAK,yBAA0BF,EACzC,CACAR,EAAU,IACZ,CACF,CAEA,SAASW,IAQP,OAPMX,IAAYA,EAAQM,eAExBN,EAAUY,EAAQC,KAAKnB,EAASoB,MAAO,KAAM,CAC3CV,iBAAkBF,EAClBa,SAAU,SAGPf,CACT,CAiCA,SAASgB,IAAoE,IAA3DC,yDAA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AAYA,EAAQM,cACtBD,IAGFM,IACAiD,QAAY5C,EAAS,SACrBhB,GAASoD,aAAaQ,EACxB,CAAA,QACE5D,GAASiE,aACX,CACF,CA6EYC,CAAYtE,EAAakB,QAGnC,CAAEyC,SAAU,IAAKY,MAAM,EAAMC,WAAW,IAG1CC,EAAUb,UACJ3D,SACIA,IAERc,IACIb,SACIA,EAAUE,GAGdA,IAAYA,EAAQM,cACtBgE,EAAUtE,EAASN,KAIvB6E,EAAY,KACV,GAAIvE,IAAYA,EAAQM,aACtB,IAEEN,EAAQwE,SAASC,IAAI,aACrBzE,EAAQwE,SAASC,IAAI,YACrBzE,EAAQwE,SAASC,IAAI,SACrBzE,EAAQyE,IAAI,SACZpE,GACF,OACOG,GACLC,QAAQC,KAAK,8BAA+BF,EAC9C,IAIG,CACLR,UAEJ,CAEO,SAASsE,EAAUtE,EAAkBN,GAC1C,MAAMgC,MAAEA,EAAAC,OAAOA,GAAW+C,EAAehF,GACzCuD,EAAe,CAACvB,EAAOC,GAAS,KAC9B,GAAI3B,IAAYA,EAAQM,aACtB,IACEN,EAAQ2E,QACV,OACOnE,GACLC,QAAQC,KAAK,6BAA8BF,EAC7C,GAGN,CAEO,SAASoE,EAAmBC,GACjC,MAAQC,MAAMC,QAAEA,EAAU,GAACC,YAAGA,EAAc,IAAO,CAAA,EAAChB,KAAGA,EAAO,IAAOa,EAC/DI,EAAS,IAAID,EAAYE,IAAIC,GAAQA,EAAKJ,YAAaA,GAASK,UAAYC,GAC5EC,EAAOtB,EAAKkB,IAAKC,GACdF,EAAOC,IAAKK,GACVJ,EAAKI,IAAoC,KAGpD,MAAO,CAACN,KAAWK,EACrB"}
|
package/es/src/defaults.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"defaults.mjs","sources":["../../../../packages/components/src/defaults.ts"],"sourcesContent":["import * as components from './components'\nimport { makeInstaller } from './make-installer'\n\nexport default makeInstaller(components)\n"],"names":["makeInstaller","components"],"mappings":"wFAGA,
|
1
|
+
{"version":3,"file":"defaults.mjs","sources":["../../../../packages/components/src/defaults.ts"],"sourcesContent":["import * as components from './components'\nimport { makeInstaller } from './make-installer'\n\nexport default makeInstaller(components)\n"],"names":["installer","makeInstaller","components"],"mappings":"wFAGA,IAAAA,EAAeC,EAAcC"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{ElUpload as e,ElIcon as t,ElAlert as s,ElMessage as l}from"element-plus/es";import"element-plus/es/components/base/style/index";import"element-plus/es/components/upload/style/index";import"element-plus/es/components/alert/style/index";import"element-plus/es/components/icon/style/index";import{defineComponent as a,computed as i,createBlock as n,openBlock as o,normalizeClass as r,unref as p,withCtx as u,createElementVNode as m,createVNode as d,createTextVNode as c,createElementBlock as f,createCommentVNode as y}from"vue";import{UploadFilled as x}from"@element-plus/icons-vue";import{useNamespace as v}from"@qxs-bns/hooks";import{useNamespace as q}from"element-plus";import"element-plus/es/components/message/style/index";const $={class:"slot"},_={style:{display:"inline-block"}};var b=a({name:"QxsFileUpload",__name:"file-upload",props:{action:{type:String,required:!0},headers:{type:null,required:!1},data:{type:null,required:!1},name:{type:String,required:!1,default:"file"},size:{type:Number,required:!1,default:20},max:{type:Number,required:!1,default:3},accept:{type:String,required:!1,default:"zip,rar"},files:{type:Array,required:!1,default:()=>[]},notip:{type:Boolean,required:!1,default:!1},ext:{type:Array,required:!1}},emits:["onSuccess"],setup(a,{emit:b}){const g=b,h=v("file-upload"),z=q("file-upload"),S=i((
|
1
|
+
import{ElUpload as e,ElIcon as t,ElAlert as s,ElMessage as l}from"element-plus/es";import"element-plus/es/components/base/style/index";import"element-plus/es/components/upload/style/index";import"element-plus/es/components/alert/style/index";import"element-plus/es/components/icon/style/index";import{defineComponent as a,computed as i,createBlock as n,openBlock as o,normalizeClass as r,unref as p,withCtx as u,createElementVNode as m,createVNode as d,createTextVNode as c,createElementBlock as f,createCommentVNode as y}from"vue";import{UploadFilled as x}from"@element-plus/icons-vue";import{useNamespace as v}from"@qxs-bns/hooks";import{useNamespace as q}from"element-plus";import"element-plus/es/components/message/style/index";const $={class:"slot"},_={style:{display:"inline-block"}};var b=a({name:"QxsFileUpload",__name:"file-upload",props:{action:{type:String,required:!0},headers:{type:null,required:!1},data:{type:null,required:!1},name:{type:String,required:!1,default:"file"},size:{type:Number,required:!1,default:20},max:{type:Number,required:!1,default:3},accept:{type:String,required:!1,default:"zip,rar"},files:{type:Array,required:!1,default:()=>[]},notip:{type:Boolean,required:!1,default:!1},ext:{type:Array,required:!1}},emits:["onSuccess"],setup(a,{emit:b}){const g=b,h=v("file-upload"),z=q("file-upload"),S=i(()=>a.accept.split(",")),k=e=>{const t=e.name.split(".").at(-1)??"",s=S.value.includes(t),i=e.size/1024/1024<a.size;return s||l.error(`上传文件只支持 ${S.value.join(" / ")} 格式!`),i||l.error(`上传文件大小不能超过 ${a.size}MB!`),s&&i},B=()=>{l.warning("文件上传超过限制")},N=(e,t,s)=>{g("onSuccess",e,t,s)};return(l,a)=>{const i=t,v=s,q=e;return o(),n(q,{headers:l.headers,action:l.action,data:l.data,name:l.name,"before-upload":k,"on-exceed":B,"on-success":N,"file-list":l.files,limit:l.max,drag:"",class:r(p(h).e("control"))},{tip:u(()=>[l.notip?y("v-if",!0):(o(),f("div",{key:0,class:r(`${p(z).namespace.value}-upload__tip`)},[m("div",_,[d(v,{title:`上传文件支持 ${p(S).join(" / ")} 格式,单个文件大小不超过 ${l.size}MB,且文件数量不超过 ${l.max} 个`,type:"info","show-icon":"",closable:!1},null,8,["title"])])],2))]),default:u(()=>[m("div",$,[d(i,{class:r(`${p(z).namespace.value}-icon--upload`)},{default:u(()=>[d(p(x))]),_:1},8,["class"]),m("div",{class:r(`${p(z).namespace.value}-upload__text`)},a[0]||(a[0]=[c(" 将文件拖到此处,或",-1),m("em",null,"点击上传",-1)]),2)])]),_:1},8,["headers","action","data","name","file-list","limit","class"])}}});export{b as default};
|
2
2
|
//# sourceMappingURL=file-upload.vue.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file-upload.vue.mjs","sources":["../../../../../../packages/components/src/file-upload/src/file-upload.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { UploadProps, UploadUserFile } from 'element-plus'\nimport { UploadFilled } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { useNamespace as useElNamespace } from 'element-plus'\n\ndefineOptions({\n name: 'QxsFileUpload',\n})\n\nconst {\n name = 'file',\n size = 20,\n max = 3,\n files = [],\n notip = false,\n accept = 'zip,rar',\n} = defineProps<{\n action: UploadProps['action']\n headers?: UploadProps['headers']\n data?: UploadProps['data']\n name?: UploadProps['name']\n size?: number\n max?: number\n accept?: string\n files?: UploadUserFile[]\n notip?: boolean\n ext?: string[]\n}>()\n\nconst emit = defineEmits(['onSuccess'])\n\nconst ns = useNamespace('file-upload')\nconst nsEl = useElNamespace('file-upload')\n\nconst exts = computed(() => {\n return accept.split(',')\n})\nconst beforeUpload: UploadProps['beforeUpload'] = (file) => {\n const fileName = file.name.split('.')\n const fileExt = fileName.at(-1) ?? ''\n const isTypeOk = exts.value.includes(fileExt)\n const isSizeOk = file.size / 1024 / 1024 < size\n if (!isTypeOk) {\n ElMessage.error(`上传文件只支持 ${exts.value.join(' / ')} 格式!`)\n }\n if (!isSizeOk) {\n ElMessage.error(`上传文件大小不能超过 ${size}MB!`)\n }\n return isTypeOk && isSizeOk\n}\n\nconst onExceed: UploadProps['onExceed'] = () => {\n ElMessage.warning('文件上传超过限制')\n}\n\nconst onSuccess: UploadProps['onSuccess'] = (res, file, fileList) => {\n emit('onSuccess', res, file, fileList)\n}\n</script>\n\n<template>\n <el-upload\n :headers=\"headers\"\n :action=\"action\"\n :data=\"data\"\n :name=\"name\"\n :before-upload=\"beforeUpload\"\n :on-exceed=\"onExceed\"\n :on-success=\"onSuccess\"\n :file-list=\"files\"\n :limit=\"max\"\n drag\n :class=\"ns.e('control')\"\n >\n <div class=\"slot\">\n <el-icon :class=\"`${nsEl.namespace.value}-icon--upload`\">\n <UploadFilled />\n </el-icon>\n <div :class=\"`${nsEl.namespace.value}-upload__text`\">\n 将文件拖到此处,或<em>点击上传</em>\n </div>\n </div>\n <template #tip>\n <div\n v-if=\"!notip\"\n :class=\"`${nsEl.namespace.value}-upload__tip`\"\n >\n <div style=\"display: inline-block;\">\n <el-alert\n :title=\"`上传文件支持 ${exts.join(\n ' / ',\n )} 格式,单个文件大小不超过 ${size}MB,且文件数量不超过 ${max} 个`\"\n type=\"info\"\n show-icon\n :closable=\"false\"\n />\n </div>\n </div>\n </template>\n </el-upload>\n</template>\n"],"names":["emit","__emit","ns","useNamespace","nsEl","useElNamespace","exts","computed","__props","accept","split","beforeUpload","file","fileExt","name","at","isTypeOk","value","includes","isSizeOk","size","ElMessage","error","join","onExceed","warning","onSuccess","res","fileList"],"mappings":"+vCA8BA,MAAMA,EAAOC,EAEPC,EAAKC,EAAa,eAClBC,EAAOC,EAAe,eAEtBC,EAAOC,
|
1
|
+
{"version":3,"file":"file-upload.vue.mjs","sources":["../../../../../../packages/components/src/file-upload/src/file-upload.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { UploadProps, UploadUserFile } from 'element-plus'\nimport { UploadFilled } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { useNamespace as useElNamespace } from 'element-plus'\n\ndefineOptions({\n name: 'QxsFileUpload',\n})\n\nconst {\n name = 'file',\n size = 20,\n max = 3,\n files = [],\n notip = false,\n accept = 'zip,rar',\n} = defineProps<{\n action: UploadProps['action']\n headers?: UploadProps['headers']\n data?: UploadProps['data']\n name?: UploadProps['name']\n size?: number\n max?: number\n accept?: string\n files?: UploadUserFile[]\n notip?: boolean\n ext?: string[]\n}>()\n\nconst emit = defineEmits(['onSuccess'])\n\nconst ns = useNamespace('file-upload')\nconst nsEl = useElNamespace('file-upload')\n\nconst exts = computed(() => {\n return accept.split(',')\n})\nconst beforeUpload: UploadProps['beforeUpload'] = (file) => {\n const fileName = file.name.split('.')\n const fileExt = fileName.at(-1) ?? ''\n const isTypeOk = exts.value.includes(fileExt)\n const isSizeOk = file.size / 1024 / 1024 < size\n if (!isTypeOk) {\n ElMessage.error(`上传文件只支持 ${exts.value.join(' / ')} 格式!`)\n }\n if (!isSizeOk) {\n ElMessage.error(`上传文件大小不能超过 ${size}MB!`)\n }\n return isTypeOk && isSizeOk\n}\n\nconst onExceed: UploadProps['onExceed'] = () => {\n ElMessage.warning('文件上传超过限制')\n}\n\nconst onSuccess: UploadProps['onSuccess'] = (res, file, fileList) => {\n emit('onSuccess', res, file, fileList)\n}\n</script>\n\n<template>\n <el-upload\n :headers=\"headers\"\n :action=\"action\"\n :data=\"data\"\n :name=\"name\"\n :before-upload=\"beforeUpload\"\n :on-exceed=\"onExceed\"\n :on-success=\"onSuccess\"\n :file-list=\"files\"\n :limit=\"max\"\n drag\n :class=\"ns.e('control')\"\n >\n <div class=\"slot\">\n <el-icon :class=\"`${nsEl.namespace.value}-icon--upload`\">\n <UploadFilled />\n </el-icon>\n <div :class=\"`${nsEl.namespace.value}-upload__text`\">\n 将文件拖到此处,或<em>点击上传</em>\n </div>\n </div>\n <template #tip>\n <div\n v-if=\"!notip\"\n :class=\"`${nsEl.namespace.value}-upload__tip`\"\n >\n <div style=\"display: inline-block;\">\n <el-alert\n :title=\"`上传文件支持 ${exts.join(\n ' / ',\n )} 格式,单个文件大小不超过 ${size}MB,且文件数量不超过 ${max} 个`\"\n type=\"info\"\n show-icon\n :closable=\"false\"\n />\n </div>\n </div>\n </template>\n </el-upload>\n</template>\n"],"names":["emit","__emit","ns","useNamespace","nsEl","useElNamespace","exts","computed","__props","accept","split","beforeUpload","file","fileExt","name","at","isTypeOk","value","includes","isSizeOk","size","ElMessage","error","join","onExceed","warning","onSuccess","res","fileList","_createBlock","_component_el_upload","headers","action","data","files","limit","max","drag","class","_normalizeClass","_unref","e","tip","notip","_createElementBlock","namespace","_createElementVNode","_hoisted_2","_createVNode","_component_el_alert","title","type","closable","_hoisted_1","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C,EAAApC,GAAKyC,UAAU5B,sCAAsB,cAC1C,GAAA6B,EAAa,UAAT,QAAI"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{defineComponent as e,ref as t,computed as a,onMounted as n,onUnmounted as i,createElementBlock as o,openBlock as r,normalizeStyle as l,unref as s,createElementVNode as d,normalizeClass as c,renderSlot as u}from"vue";import{useNamespace as p}from"@qxs-bns/hooks";import{getDeviceType as h}from"@qxs-bns/utils";import{debounce as m}from"lodash-es";var f=e({name:"QxsFixedActionBar",props:{padding:{type:Number,default:8},className:{type:String,default:""}},setup(e){const f=e,g=p("fixed-action-bar"),v=t(!1),b=t(null),x=t(null),w=t({width:0,height:0}),y=t(0),N=t(0),F={resize:null,parent:null};function R(e,t,a){const n=new ResizeObserver(
|
1
|
+
import{defineComponent as e,ref as t,computed as a,onMounted as n,onUnmounted as i,createElementBlock as o,openBlock as r,normalizeStyle as l,unref as s,createElementVNode as d,normalizeClass as c,renderSlot as u}from"vue";import{useNamespace as p}from"@qxs-bns/hooks";import{getDeviceType as h}from"@qxs-bns/utils";import{debounce as m}from"lodash-es";var f=e({name:"QxsFixedActionBar",props:{padding:{type:Number,default:8},className:{type:String,default:""}},setup(e){const f=e,g=p("fixed-action-bar"),v=t(!1),b=t(null),x=t(null),w=t({width:0,height:0}),y=t(0),N=t(0),F={resize:null,parent:null};function R(e,t,a){const n=new ResizeObserver(e=>{e.forEach(e=>requestAnimationFrame(()=>t(e)))});return n.observe(e,a),n}function $(){if(!b.value||!x.value)return;F.resize=R(b.value,e=>{const t=function(e){const t=getComputedStyle(e);return{x:Number.parseFloat(t.paddingLeft)+Number.parseFloat(t.paddingRight),y:Number.parseFloat(t.paddingTop)+Number.parseFloat(t.paddingBottom)}}(e.target);w.value={width:e.contentRect.width+t.x,height:e.contentRect.height+t.y}},{box:"border-box"});const e=x.value.parentElement;e&&(F.parent=R(e,()=>{const t=e.getBoundingClientRect();y.value=t.width,N.value=t.left}))}const E=m(()=>{const{scrollY:e}=window,{clientHeight:t,scrollHeight:a}=document.documentElement;v.value=Math.ceil(e+t)>=a},100),k=a(()=>v.value?"":g.is("shadow")),z=a(()=>"Android"===h()?Math.max(f.padding,20):f.padding),B=a(()=>({width:`${y.value}px`,left:`${N.value}px`,...g.cssVarBlock({"actionbar-padding":`${f.padding}px`,"actionbar-padding-bottom":`${z.value}px`})}));return n(()=>{$(),window.addEventListener("scroll",E,{passive:!0})}),i(()=>{F.resize?.disconnect(),F.parent?.disconnect(),window.removeEventListener("scroll",E)}),(t,a)=>(r(),o("div",{ref_key:"placeholderRef",ref:x,style:l({width:"100%",height:`${s(w).height}px`})},[d("div",{ref_key:"actionbar",ref:b,style:l(s(B)),class:c([s(g).e("actionbar"),s(k),e.className]),"data-fixed-calc-width":""},[u(t.$slots,"default")],6)],4))}});export{f as default};
|
2
2
|
//# sourceMappingURL=fixed-action-bar.vue.mjs.map
|