@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":"scatter-simple.vue.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/scatter-simple.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartScatterSimple',\n})\nconst {\n chartData,\n chartOptions,\n} = 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":"0UAeA,MAAMA,EAAyBC,EAAAA,MACzBC,EAAQC,EAAAA,OAAOC,EAAAA,
|
1
|
+
{"version":3,"file":"scatter-simple.vue.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/scatter-simple.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartScatterSimple',\n})\nconst {\n chartData,\n chartOptions,\n} = 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":"0UAeA,MAAMA,EAAyBC,EAAAA,MACzBC,EAAQC,EAAAA,OAAOC,EAAAA,oBAAsBC,GAAWA,GAAG,GAEnDC,EAAsBC,EAAAA,SAAwB,KAClD,MAAMC,QAAEA,EAAAC,aAASA,EAAAC,UAAcA,EAAAC,KAAWA,GAASC,EAAAC,UAC7CC,EAAS,CACbC,MAAO,CACLC,KAAMN,GAERO,QAAS,CACPC,UAAUC,GACJA,EAAOC,MAAMC,OAAS,EAEtB,GAAGF,EAAOG,oBACAH,EAAOC,MAAM,MACnBD,EAAOC,MAAM,MAMjB,GAAGD,EAAOG,oBACAH,EAAOI,UACXJ,EAAOC,UAMrBI,OAAQhB,EAAQiB,IAAKC,IACZ,CACLC,WAAY,GACZJ,KAAMG,EACNf,KAAMA,EAAKc,IAAKG,GACP,CAACA,EAASF,GAAcE,EAASnB,GAAcD,SAAW,MAEnEqB,KAAM,cAIZ,OAAO3B,EAAMY,EAAQF,EAAAkB,uBAEvBC,EAAAA,UAAU,CAAEC,SAAUhC,EAAwB8B,aAAcxB,EAAqBO,UAAWN,WAAS,IAAMK,EAAAC,mCAIzGoB,EAAAA,mBAGE,MAAA,SAFI,yBAAJhC,IAAID,EACJkC,MAAM"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("../utils/injectionKeys.cjs"),r=require("../utils/useCharts.cjs"),a=e.defineComponent({name:"DataChartScatter",__name:"scatter",props:{chartData:{type:Object,required:!0},chartOptions:{type:null,required:!0}},setup(a){const s=e.ref(),c=e.inject(t.InjectionChartMerge,
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("../utils/injectionKeys.cjs"),r=require("../utils/useCharts.cjs"),a=e.defineComponent({name:"DataChartScatter",__name:"scatter",props:{chartData:{type:Object,required:!0},chartOptions:{type:null,required:!0}},setup(a){const s=e.ref(),c=e.inject(t.InjectionChartMerge,e=>e,!0),i=e.computed(()=>c({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"}]},a.chartOptions));return r.useCharts({chartDOM:s,chartOptions:i,chartData:e.computed(()=>a.chartData)}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dataChartScatter",ref:s,class:"data-chart-scatter"},null,512))}});exports.default=a;
|
2
2
|
//# sourceMappingURL=scatter.vue.cjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scatter.vue.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/scatter.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartScatter',\n})\n\nconst {\n chartData,\n chartOptions,\n} = 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":"6TAiBA,MAAMA,EAAmBC,EAAAA,MACnBC,EAAQC,EAAAA,OAAOC,EAAAA,
|
1
|
+
{"version":3,"file":"scatter.vue.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/scatter.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartScatter',\n})\n\nconst {\n chartData,\n chartOptions,\n} = 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":"6TAiBA,MAAMA,EAAmBC,EAAAA,MACnBC,EAAQC,EAAAA,OAAOC,EAAAA,oBAAsBC,GAAWA,GAAG,GAEnDC,EAAsBC,EAAAA,SAAwB,IAoC3CL,EAnCQ,CACbM,MAAO,CAAA,EACPC,MAAO,CAAA,EACPC,OAAQ,CACN,CACEC,WAAY,GACZC,KAAM,CACJ,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,GAAM,MACP,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,GAAM,MACP,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,KACP,CAAC,KAAM,KACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,MACP,CAAC,GAAM,MACP,CAAC,GAAM,MACP,CAAC,KAAM,MACP,CAAC,KAAM,OAETC,KAAM,aAKSC,EAAAC,sBAEvBC,EAAAA,UAAU,CAAEC,SAAUjB,EAAkBe,aAAcT,EAAqBY,UAAWX,WAAS,IAAMO,EAAAI,mCAInGC,EAAAA,mBAGE,MAAA,SAFI,mBAAJlB,IAAID,EACJoB,MAAM"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("element-plus/es");require("element-plus/es/components/base/style/index"),require("element-plus/es/components/table/style/index"),require("element-plus/es/components/table-column/style/index");var t=require("vue"),a=require("@qxs-bns/hooks"),l=require("./empty.vue.cjs");const o={key:0,class:"title"};var r=t.defineComponent({name:"DataChartTable",__name:"table",props:{chartData:{type:Object,default:()=>({colDesc:[],xGroupByDesc:[],data:[],modelName:""})}},setup(r){const c=r,n=a.useNamespace("data-chart"),s=t.computed((
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("element-plus/es");require("element-plus/es/components/base/style/index"),require("element-plus/es/components/table/style/index"),require("element-plus/es/components/table-column/style/index");var t=require("vue"),a=require("@qxs-bns/hooks"),l=require("./empty.vue.cjs");const o={key:0,class:"title"};var r=t.defineComponent({name:"DataChartTable",__name:"table",props:{chartData:{type:Object,default:()=>({colDesc:[],xGroupByDesc:[],data:[],modelName:""})}},setup(r){const c=r,n=a.useNamespace("data-chart"),s=t.computed(()=>c.chartData.groupByDesc.find(e=>!e.xAxis));function i(e){if(!e)return 100;const t=14*e.length+20+30;return t<100?100:t}return(a,c)=>{const p=e.ElTableColumn,u=e.ElTable;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass([t.unref(n).e("table")])},[r.chartData.modelName?(t.openBlock(),t.createElementBlock("p",o,[t.createElementVNode("span",null,t.toDisplayString(r.chartData.modelName),1)])):t.createCommentVNode("v-if",!0),t.createVNode(u,{class:"customize-table",data:r.chartData.data,stripe:"",height:"100%"},{empty:t.withCtx(()=>[t.createVNode(l.default)]),default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.chartData.groupByDesc,(e,a)=>(t.openBlock(),t.createBlock(p,{key:`${e.colDesc}${e.groupByDesc}${a}`,align:"center","show-overflow-tooltip":"",sortable:"","min-width":`${i(e.colDesc)}px`,prop:e.colDesc||""},{header:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.colDesc),1)]),default:t.withCtx(a=>[t.createTextVNode(t.toDisplayString((t.unref(s)&&(t.unref(s).colDesc,e.colDesc),a.row[e.colDesc||""]||"--")),1)]),_:2},1032,["min-width","prop"]))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.chartData.colDesc,(e,a)=>(t.openBlock(),t.createBlock(p,{key:e+a,align:"center","min-width":`${i(e)}px`,label:e,"show-overflow-tooltip":"",sortable:"",prop:e},{header:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e),1)]),_:2},1032,["min-width","label","prop"]))),128))]),_:1},8,["data"])],2)}}});exports.default=r;
|
2
2
|
//# sourceMappingURL=table.vue.cjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"table.vue.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/table.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { IFormatPublicData } from '../utils/types'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport Empty from './empty.vue'\n\ndefineOptions({\n name: 'DataChartTable',\n})\n\nconst props = defineProps({\n chartData: {\n type: Object as PropType<IFormatPublicData>,\n default: () => ({\n colDesc: [],\n xGroupByDesc: [],\n data: [],\n modelName: '',\n }),\n },\n})\n\nconst ns = useNamespace('data-chart')\n\nconst yGroupByDesc = computed(() => {\n const row = props.chartData.groupByDesc.find(item => !item.xAxis)\n return row\n})\n\nfunction baseWidth(str: string | null) {\n if (!str) {\n return 100\n }\n const strWidth = str.length * 14 + 20 + 30\n return strWidth < 100 ? 100 : strWidth\n}\n</script>\n\n<template>\n <div :class=\"[ns.e('table')]\">\n <p\n v-if=\"chartData.modelName\"\n class=\"title\"\n >\n <span>{{ chartData.modelName }}</span>\n </p>\n <el-table\n class=\"customize-table\"\n :data=\"chartData.data\"\n stripe\n height=\"100%\"\n >\n <el-table-column\n v-for=\"(item, index) in chartData.groupByDesc\"\n :key=\"`${item.colDesc}${item.groupByDesc}${index}`\"\n align=\"center\"\n show-overflow-tooltip\n sortable\n :min-width=\"`${baseWidth(item.colDesc)}px`\"\n :prop=\"item.colDesc || ''\"\n >\n <template #header>\n {{ item.colDesc }}\n </template>\n <template #default=\"scoped\">\n {{ (yGroupByDesc && yGroupByDesc.colDesc === item.colDesc ? scoped.row[item.colDesc || ''] : scoped.row[item.colDesc || '']) || '--' }}\n </template>\n </el-table-column>\n <el-table-column\n v-for=\"(item, index) in chartData.colDesc\"\n :key=\"item + index\"\n align=\"center\"\n :min-width=\"`${baseWidth(item)}px`\"\n :label=\"item\"\n show-overflow-tooltip\n sortable\n :prop=\"item\"\n >\n <template #header>\n {{ item }}\n </template>\n </el-table-column>\n <template #empty>\n <Empty />\n </template>\n </el-table>\n </div>\n</template>\n"],"names":["props","__props","ns","useNamespace","yGroupByDesc","computed","chartData","groupByDesc","find","item","xAxis","baseWidth","str","strWidth","length"],"mappings":"siBAUA,MAAMA,EAAQC,EAYRC,EAAKC,
|
1
|
+
{"version":3,"file":"table.vue.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/table.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { IFormatPublicData } from '../utils/types'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport Empty from './empty.vue'\n\ndefineOptions({\n name: 'DataChartTable',\n})\n\nconst props = defineProps({\n chartData: {\n type: Object as PropType<IFormatPublicData>,\n default: () => ({\n colDesc: [],\n xGroupByDesc: [],\n data: [],\n modelName: '',\n }),\n },\n})\n\nconst ns = useNamespace('data-chart')\n\nconst yGroupByDesc = computed(() => {\n const row = props.chartData.groupByDesc.find(item => !item.xAxis)\n return row\n})\n\nfunction baseWidth(str: string | null) {\n if (!str) {\n return 100\n }\n const strWidth = str.length * 14 + 20 + 30\n return strWidth < 100 ? 100 : strWidth\n}\n</script>\n\n<template>\n <div :class=\"[ns.e('table')]\">\n <p\n v-if=\"chartData.modelName\"\n class=\"title\"\n >\n <span>{{ chartData.modelName }}</span>\n </p>\n <el-table\n class=\"customize-table\"\n :data=\"chartData.data\"\n stripe\n height=\"100%\"\n >\n <el-table-column\n v-for=\"(item, index) in chartData.groupByDesc\"\n :key=\"`${item.colDesc}${item.groupByDesc}${index}`\"\n align=\"center\"\n show-overflow-tooltip\n sortable\n :min-width=\"`${baseWidth(item.colDesc)}px`\"\n :prop=\"item.colDesc || ''\"\n >\n <template #header>\n {{ item.colDesc }}\n </template>\n <template #default=\"scoped\">\n {{ (yGroupByDesc && yGroupByDesc.colDesc === item.colDesc ? scoped.row[item.colDesc || ''] : scoped.row[item.colDesc || '']) || '--' }}\n </template>\n </el-table-column>\n <el-table-column\n v-for=\"(item, index) in chartData.colDesc\"\n :key=\"item + index\"\n align=\"center\"\n :min-width=\"`${baseWidth(item)}px`\"\n :label=\"item\"\n show-overflow-tooltip\n sortable\n :prop=\"item\"\n >\n <template #header>\n {{ item }}\n </template>\n </el-table-column>\n <template #empty>\n <Empty />\n </template>\n </el-table>\n </div>\n</template>\n"],"names":["props","__props","ns","useNamespace","yGroupByDesc","computed","chartData","groupByDesc","find","item","xAxis","baseWidth","str","strWidth","length","_createElementBlock","class","_normalizeClass","_unref","e","modelName","_openBlock","_hoisted_1","_createElementVNode","_toDisplayString","_createVNode","_component_el_table","data","stripe","height","empty","Empty","_Fragment","index","_createBlock","_component_el_table_column","key","colDesc","align","sortable","prop","header","_createTextVNode","default","_withCtx","scoped","row","label"],"mappings":"siBAUA,MAAMA,EAAQC,EAYRC,EAAKC,EAAAA,aAAa,cA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EAAA,CAXfC,IAAK3B,EAAOwB,EACbK,MAAM,SACL,YAAS,GAAK3B,EAAUF,OACxBsC,MAAOtC,EACR,wBAAA,GACA8B,SAAA,GACCC,KAAM/B,IAEIgC,iBACT,IAAU,qCAAPhC,GAAI"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("@qxs-bns/hooks"),r=require("@qxs-bns/utils"),s=require("lodash-es"),a=require("./analyze.cjs"),o=require("./components/area.vue.cjs"),u=require("./components/bar.vue.cjs"),c=require("./components/card.vue.cjs"),n=require("./components/funnel.vue.cjs"),l=require("./components/line.vue.cjs"),i=require("./components/pie.vue.cjs"),p=require("./components/radar.vue.cjs"),d=require("./components/scatter-simple.vue.cjs"),m=require("./components/scatter.vue.cjs"),f=require("./components/table.vue.cjs"),y=require("./utils/config.cjs"),h=require("./utils/injectionKeys.cjs"),q=require("./utils/safe-eval.cjs"),j=require("./utils/types.cjs"),v=require("./utils/useCharts.cjs"),g=e.defineComponent({name:"QxsDataChart",__name:"data-chart",props:{modelName:{type:String,required:!1,default:""},showTypeName:{type:String,required:!1,default:"table"},subShowType:{type:String,required:!1},data:{type:Object,required:!1,default:()=>({data:[],desc:{colDesc:[],showDesc:{showType:0,chartOptions:"{}",jsCodeSnippet:""},groupByDesc:[]}})},chartOptions:{type:null,required:!1,default:()=>({})},jsCodeSnippet:{type:String,required:!1,default:""}},setup(g,{expose:x}){const D=t.useNamespace("data-chart"),b={analyze:a,config:y,types:j},C={table:f.default,bar:u.default,line:l.default,pie:i.default,radar:p.default,scatter:m.default,funnel:n.default,area:o.default,card:c.default,"scatter-simple":d.default},w=e.computed((
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("@qxs-bns/hooks"),r=require("@qxs-bns/utils"),s=require("lodash-es"),a=require("./analyze.cjs"),o=require("./components/area.vue.cjs"),u=require("./components/bar.vue.cjs"),c=require("./components/card.vue.cjs"),n=require("./components/funnel.vue.cjs"),l=require("./components/line.vue.cjs"),i=require("./components/pie.vue.cjs"),p=require("./components/radar.vue.cjs"),d=require("./components/scatter-simple.vue.cjs"),m=require("./components/scatter.vue.cjs"),f=require("./components/table.vue.cjs"),y=require("./utils/config.cjs"),h=require("./utils/injectionKeys.cjs"),q=require("./utils/safe-eval.cjs"),j=require("./utils/types.cjs"),v=require("./utils/useCharts.cjs"),g=e.defineComponent({name:"QxsDataChart",__name:"data-chart",props:{modelName:{type:String,required:!1,default:""},showTypeName:{type:String,required:!1,default:"table"},subShowType:{type:String,required:!1},data:{type:Object,required:!1,default:()=>({data:[],desc:{colDesc:[],showDesc:{showType:0,chartOptions:"{}",jsCodeSnippet:""},groupByDesc:[]}})},chartOptions:{type:null,required:!1,default:()=>({})},jsCodeSnippet:{type:String,required:!1,default:""}},setup(g,{expose:x}){const D=t.useNamespace("data-chart"),b={analyze:a,config:y,types:j},C={table:f.default,bar:u.default,line:l.default,pie:i.default,radar:p.default,scatter:m.default,funnel:n.default,area:o.default,card:c.default,"scatter-simple":d.default},w=e.computed(()=>s.cloneDeep(y.defaultChartOption[g.showTypeName])),S=e.computed(()=>{const{desc:{colDesc:e=[],groupByDesc:t=[]}={},data:r=[]}=g.data;let s=[],a=null;s=t?.map(e=>(e.xAxis&&(a=e),e));const o=a?r.filter(e=>e&&e[a.colDesc]):r;return{colDesc:e||[],modelName:g.modelName,subShowType:g.subShowType,xGroupByDesc:a||{colDesc:"",groupByDesc:"",groupByValues:[],xAxis:!1},groupByDesc:s,data:o}});return x({exportExal:function(){if(0===g.data.data.length)return void console.log("暂无数据");const e=v.useDataToExcelJson(g.data);r.JsonToExcel(g.modelName,e)},QxsDataChartConfig:b}),e.provide(h.InjectionChartMerge,function(e,t){let r=s.merge({},w.value,e,t)||{};if(g.jsCodeSnippet)try{r=q.safeEvalConfig(g.jsCodeSnippet,r)}catch(e){console.error("代码执行失败:",e)}return r}),(t,r)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(C[t.showTypeName]),{key:t.showTypeName,class:e.normalizeClass([e.unref(D).e("wrapper")]),"sub-show-type":t.subShowType,"chart-data":e.unref(S),"chart-options":t.chartOptions},null,8,["class","sub-show-type","chart-data","chart-options"]))}});exports.default=g;
|
2
2
|
//# sourceMappingURL=data-chart.vue.cjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"data-chart.vue.cjs","sources":["../../../../../../packages/components/src/data-chart/src/data-chart.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartData, EChartsOption, IconRow, IFormatPublicData } from './utils/types'\nimport { 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","
|
1
|
+
{"version":3,"file":"data-chart.vue.cjs","sources":["../../../../../../packages/components/src/data-chart/src/data-chart.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartData, EChartsOption, IconRow, IFormatPublicData } from './utils/types'\nimport { 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":"muCAqDA,MAAMA,EAAKC,EAAAA,aAAa,cAEl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AAOL,CACT,yBAUEM,cAOEC,EAAAA,wBANK3D,EAAK4D,EAAAA,eAAY,CACrBC,IAAKD,EAAAA,aACLE,MAAKC,EAAAA,eAAA,CAAGC,EAAAA,MAAAtE,GAAGuE,EAAC,aACZ,gBAAe1B,EAAAA,YACf,aAAYyB,EAAAA,MAAAvC,GACZ,gBAAeyC,EAAAA"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var e=require("lodash-es");
|
1
|
+
"use strict";var e=require("lodash-es"),t=require("echarts"),o=require("./mapData.cjs");function a(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(o){if("default"!==o){var a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,a.get?a:{enumerable:!0,get:function(){return e[o]}})}}),t.default=e,Object.freeze(t)}var i=a(t);const n={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 n.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 s(t,o){const a={};return t.forEach(t=>{a[t.showTypeName]=e.merge(t.baseConfig,o)}),a}const r=s(n.data,{backgroundColor:"transparent",title:{textStyle:{fontSize:14,lineHeight:16}}}),l=new Map,p=()=>{try{const e=i.getMap("china");if(e&&e.geoJson)return e.geoJson}catch(e){console.warn("Failed to get builtin China map:",e)}return{type:"FeatureCollection",features:[]}};exports.defaultChartOption=r,exports.getGeoJsonData=function(e){let{adcode:t}=e;if("string"!=typeof t||t.match(/^\d{6}$/)||"中国"===t||"100000"===t||(t=o.getProvinceCode(t)),l.has(t)){const e=l.get(t);if(e)return Promise.resolve(e)}return new Promise(async e=>{try{if("中国"===t||"100000"===t)try{const a=await o.getChinaMapData();return l.set(t,a),void e(a)}catch(e){console.warn("Failed to fetch China map from DataV, using fallback:",e)}if(o.isProvinceCode(t))try{const a=await o.getProvinceMapData(o.getProvinceName(t));if(a&&a.features&&a.features.length>0)return l.set(t,a),void e(a)}catch(a){console.warn("Failed to fetch province map data with new method, trying old method:",a);try{const a=await o.fetchMapData(t);if(a&&a.features&&a.features.length>0)return l.set(t,a),void e(a)}catch(e){console.warn("Failed to fetch province map data with old method:",e)}}const a=p();l.set(t,a),e(a)}catch(o){console.error("All map data sources failed, using simple fallback:",o);const a=p();l.set(t,a),e(a)}})},exports.iconList=n,exports.setDefaultChartOption=s,exports.showTypeText=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return n.get("showType",e)};
|
2
2
|
//# sourceMappingURL=config.cjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"config.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/utils/config.ts"],"sourcesContent":["import type { GeoJson, IconRow, IGroupByInfos, ISelectInfos } from './types'\nimport { merge } from 'lodash-es'\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","setDefaultChartOption","option","changeConfig","obj","forEach","merge","defaultChartOption","backgroundColor","title","textStyle","fontSize","lineHeight","geoJsonCache","Map","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":"wCAYO,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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QF,EAE3B,CAEO,OAAA,IAAIC,SAASC,IAClB,MAAMC,EAAM,CACVC,SAAS,EACTC,WAAY,SACTR,GAGES,OAAA,2BACJC,MAAKC,IAAA,IAAGC,QAASC,GAAiBF,EAAA,OAAAE,EAAWC,KAAK,CACjDC,IAAK,mCACLC,QAAS,SACTC,QAAS,CAAC,uBACVC,OAAQ,CACNF,QAAS,MACTC,QAAS,CAAC,0BAEZ,IACDP,MAAMS,IACY,IAAIA,EAAKC,eAAed,GAEhCe,OAAOrB,EAAQC,QAAQ,CAAC3C,EAAQgE,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,GACV9G,KAAM,qBAGA6G,EAAAC,SAAWH,EAASI,iBAGflC,EAAAmC,IAAIhC,EAAQ6B,GAEzBzB,EAAQyB,EAAO,GAChB,GACF,GACF,IAEFI,OAAOP,IACEE,QAAAF,MAAM,sBAAuBA,GAC7BtB,EAAA,CACN0B,SAAU,GACV9G,KAAM,qBACP,GACF,GAEP,0EA5FgB,WAAoC,IAAvBc,yDAAW,EAE/B,OADKhB,EAASC,IAAI,WAAYe,EAEvC"}
|
1
|
+
{"version":3,"file":"config.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/utils/config.ts"],"sourcesContent":["import type { GeoJson, IconRow, IGroupByInfos, ISelectInfos } from './types'\nimport { 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","setDefaultChartOption","option","changeConfig","obj","forEach","merge","defaultChartOption","backgroundColor","title","textStyle","fontSize","lineHeight","geoJsonCache","Map","getBuiltinChinaMap","chinaMap","echarts","getMap","geoJson","error","console","warn","features","options","adcode","match","getProvinceCode","has","cachedGeoJson","Promise","resolve","async","chinaData","getChinaMapData","set","isProvinceCode","getProvinceMapData","getProvinceName","fetchMapData","secondError","builtinMap"],"mappings":"oWAcO,MAAMA,EAGT,CACFC,IAAK,WAAgE,IAA/DC,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAsB,eAAgBG,yDAAa,QACvD,OAAON,EAASO,KAAKC,KAAKC,GAAQA,EAAKP,GAAMQ,aAAeJ,GAASG,EAAKP,KAAUI,EACtF,EACAC,KAAM,CACJ,CACEI,aAAc,QACdC,MAAO,KACPC,SAAU,YACVC,SAAUA,KAAM,EAChBC,YAAa,GACbC,SAAU,EACVC,WAAY,CAAA,GAEd,CACEN,aAAc,OACdC,MAAO,MACPC,SAAU,iBACVG,SAAU,EACVD,YAAa,CACX,CACET,MAAO,cACPY,KAAM,cACNC,eAAgB,OAElB,CACEb,MAAO,aACPY,KAAM,kBACNC,eAAgB,UAGpBF,WAAY,CACVG,QAAS,CACPC,SAAS,EACTC,QAAS,OACTC,YAAa,CACXrB,KAAM,SAGVsB,QAAS,CACPC,MAAM,EACNC,WAAW,EACXC,QAAS,CAGPC,YAAa,CAAA,IAGjBC,OAAQ,CACN3B,KAAM,SACN4B,IAAK,QAEPC,KAAM,CACJC,KAAM,IACNC,OAAQ,OACRC,cAAc,GAEhBC,MAAO,CACLjC,KAAM,WACNkC,aAAa,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S&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`}};const e={"北京市":"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"},o=Object.fromEntries(Object.entries(e).map(t=>{let[e,o]=t;return[o,e]}));function r(t){return e[t]||"100000"}const a={TOKEN:"你的天地图token",BASE_URL:"https://api.tianditu.gov.cn"};exports.FREE_MAP_SOURCES=t,exports.PROVINCE_CODES=e,exports.PROVINCE_NAMES=o,exports.TIANDITU_CONFIG=a,exports.fetchMapData=async function(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}},exports.fetchTiandituBoundary=async function(e){try{const o=t.TIANDITU_ADMIN.BOUNDARY(e).replace("你的天地图token",a.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}},exports.getChinaMapData=async function(){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]]]}}]}},exports.getProvinceCode=r,exports.getProvinceMapData=async function(t){const e=r(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}},exports.getProvinceName=function(t){return o[t]||"中国"},exports.isProvinceCode=function(t){return/^\d{6}$/.test(t)&&"100000"!==t};
|
2
|
+
//# sourceMappingURL=mapData.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mapData.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/utils/mapData.ts"],"sourcesContent":["// 免费的地图数据源\nexport const FREE_MAP_SOURCES = {\n // 省级地图数据源\n PROVINCE: {\n // 使用天地图省级数据\n TIANDITU: () => `https://api.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=你的天地图token`,\n // 使用 DataV 的省级数据\n DATAV: (adcode: string) => `https://geo.datav.aliyun.com/areas_v3/bound/${adcode}_full.json`,\n },\n // 天地图行政区划数据\n TIANDITU_ADMIN: {\n // 获取行政区划边界数据\n BOUNDARY: (adcode: string) => `https://api.tianditu.gov.cn/administrative?postStr={\"searchWord\":\"${adcode}\",\"searchType\":\"11\",\"needSubInfo\":true,\"needAll\":true,\"needPolygon\":true,\"needPre\":true}&type=query&tk=你的天地图token`,\n },\n}\n\n// 中国地图数据 - 使用真实的省级边界数据\nexport const CHINA_MAP_DATA = {\n type: 'FeatureCollection',\n features: [\n // 这里应该包含所有省份的边界数据\n // 由于数据量很大,建议使用外部数据源\n ]\n}\n\n// 获取中国地图数据的函数\nexport async function getChinaMapData(): Promise<any> {\n try {\n // 优先使用 DataV 的中国地图数据\n const response = await fetch('https://geo.datav.aliyun.com/areas_v3/bound/100000_full.json')\n if (response.ok) {\n return await response.json()\n }\n }\n catch (error) {\n console.warn('Failed to fetch China map from DataV:', error)\n }\n\n // 备用方案:使用简化的地图数据\n return {\n type: 'FeatureCollection',\n features: [\n {\n type: 'Feature',\n properties: {\n name: '中国',\n adcode: '100000',\n },\n geometry: {\n type: 'Polygon',\n coordinates: [[\n [73.66, 35.42], [78.91, 35.42], [81.33, 36.08], [85.29, 36.08], \n [88.02, 35.42], [90.16, 35.42], [92.13, 34.76], [94.81, 34.76], \n [97.06, 33.44], [99.43, 32.78], [101.06, 31.46], [102.73, 30.14], \n [104.40, 28.82], [106.07, 27.50], [107.74, 26.18], [109.41, 24.86], \n [111.08, 23.54], [112.75, 22.22], [114.42, 20.90], [116.09, 19.58], \n [117.76, 18.26], [119.43, 16.94], [121.10, 15.62], [122.77, 14.30], \n [124.44, 12.98], [126.11, 11.66], [127.78, 10.34], [129.45, 9.02], \n [131.12, 7.70], [132.79, 6.38], [134.46, 5.06], [135.05, 4.40], \n [135.05, 5.06], [135.05, 6.38], [135.05, 7.70], [135.05, 9.02], \n [135.05, 10.34], [135.05, 11.66], [135.05, 12.98], [135.05, 14.30], \n [135.05, 15.62], [135.05, 16.94], [135.05, 18.26], [135.05, 19.58], \n [135.05, 20.90], [135.05, 22.22], [135.05, 23.54], [135.05, 24.86], \n [135.05, 26.18], [135.05, 27.50], [135.05, 28.82], [135.05, 30.14], \n [135.05, 31.46], [135.05, 32.78], [135.05, 34.10], [135.05, 35.42], \n [134.46, 36.08], [133.79, 36.74], [133.12, 37.40], [132.45, 38.06], \n [131.78, 38.72], [131.11, 39.38], [130.44, 40.04], [129.77, 40.70], \n [129.10, 41.36], [128.43, 42.02], [127.76, 42.68], [127.09, 43.34], \n [126.42, 44.00], [125.75, 44.66], [125.08, 45.32], [124.41, 45.98], \n [123.74, 46.64], [123.07, 47.30], [122.40, 47.96], [121.73, 48.62], \n [121.06, 49.28], [120.39, 49.94], [119.72, 50.60], [119.05, 51.26], \n [118.38, 51.92], [117.71, 52.58], [117.04, 53.24], [116.37, 53.90], \n [115.70, 54.56], [115.03, 55.22], [114.36, 55.88], [113.69, 56.54], \n [113.02, 57.20], [112.35, 57.86], [111.68, 58.52], [111.01, 59.18], \n [110.34, 59.84], [109.67, 60.50], [109.00, 61.16], [108.33, 61.82], \n [107.66, 62.48], [106.99, 63.14], [106.32, 63.80], [105.65, 64.46], \n [104.98, 65.12], [104.31, 65.78], [103.64, 66.44], [102.97, 67.10], \n [102.30, 67.76], [101.63, 68.42], [100.96, 69.08], [100.29, 69.74], \n [99.62, 70.40], [98.95, 71.06], [98.28, 71.72], [97.61, 72.38], \n [96.94, 73.04], [96.27, 73.70], [95.60, 74.36], [94.93, 75.02], \n [94.26, 75.68], [93.59, 76.34], [92.92, 77.00], [92.25, 77.66], \n [91.58, 78.32], [90.91, 78.98], [90.24, 79.64], [89.57, 80.30], \n [88.90, 80.96], [88.23, 81.62], [87.56, 82.28], [86.89, 82.94], \n [86.22, 83.60], [85.55, 84.26], [84.88, 84.92], [84.21, 85.58], \n [83.54, 86.24], [82.87, 86.90], [82.20, 87.56], [81.53, 88.22], \n [80.86, 88.88], [80.19, 89.54], [79.52, 90.20], [78.85, 90.86], \n [78.18, 91.52], [77.51, 92.18], [76.84, 92.84], [76.17, 93.50], \n [75.50, 94.16], [74.83, 94.82], [74.16, 95.48], [73.66, 96.14], \n [73.66, 95.48], [73.66, 94.82], [73.66, 94.16], [73.66, 93.50], \n [73.66, 92.84], [73.66, 92.18], [73.66, 91.52], [73.66, 90.86], \n [73.66, 90.20], [73.66, 89.54], [73.66, 88.88], [73.66, 88.22], \n [73.66, 87.56], [73.66, 86.90], [73.66, 86.24], [73.66, 85.58], \n [73.66, 84.92], [73.66, 84.26], [73.66, 83.60], [73.66, 82.94], \n [73.66, 82.28], [73.66, 81.62], [73.66, 80.96], [73.66, 80.30], \n [73.66, 79.64], [73.66, 78.98], [73.66, 78.32], [73.66, 77.66], \n [73.66, 77.00], [73.66, 76.34], [73.66, 75.68], [73.66, 75.02], \n [73.66, 74.36], [73.66, 73.70], [73.66, 73.04], [73.66, 72.38], \n [73.66, 71.72], [73.66, 71.06], [73.66, 70.40], [73.66, 69.74], \n [73.66, 69.08], [73.66, 68.42], [73.66, 67.76], [73.66, 67.10], \n [73.66, 66.44], [73.66, 65.78], [73.66, 65.12], [73.66, 64.46], \n [73.66, 63.80], [73.66, 63.14], [73.66, 62.48], [73.66, 61.82], \n [73.66, 61.16], [73.66, 60.50], [73.66, 59.84], [73.66, 59.18], \n [73.66, 58.52], [73.66, 57.86], [73.66, 57.20], [73.66, 56.54], \n [73.66, 55.88], [73.66, 55.22], [73.66, 54.56], [73.66, 53.90], \n [73.66, 53.24], [73.66, 52.58], [73.66, 51.92], [73.66, 51.26], \n [73.66, 50.60], [73.66, 49.94], [73.66, 49.28], [73.66, 48.62], \n [73.66, 47.96], [73.66, 47.30], [73.66, 46.64], [73.66, 45.98], \n [73.66, 45.32], [73.66, 44.66], [73.66, 44.00], [73.66, 43.34], \n [73.66, 42.68], [73.66, 42.02], [73.66, 41.36], [73.66, 40.70], \n [73.66, 40.04], [73.66, 39.38], [73.66, 38.72], [73.66, 38.06], \n [73.66, 37.40], [73.66, 36.74], [73.66, 36.08], [73.66, 35.42]\n ]],\n },\n },\n ],\n }\n}\n\n\n\n// 省级行政区代码映射\nexport const PROVINCE_CODES = {\n '北京市': '110000',\n '天津市': '120000',\n '河北省': '130000',\n '山西省': '140000',\n '内蒙古自治区': '150000',\n '辽宁省': '210000',\n '吉林省': '220000',\n '黑龙江省': '230000',\n '上海市': '310000',\n '江苏省': '320000',\n '浙江省': '330000',\n '安徽省': '340000',\n '福建省': '350000',\n '江西省': '360000',\n '山东省': '370000',\n '河南省': '410000',\n '湖北省': '420000',\n '湖南省': '430000',\n '广东省': '440000',\n '广西壮族自治区': '450000',\n '海南省': '460000',\n '重庆市': '500000',\n '四川省': '510000',\n '贵州省': '520000',\n '云南省': '530000',\n '西藏自治区': '540000',\n '陕西省': '610000',\n '甘肃省': '620000',\n '青海省': '630000',\n '宁夏回族自治区': '640000',\n '新疆维吾尔自治区': '650000',\n '台湾省': '710000',\n '香港特别行政区': '810000',\n '澳门特别行政区': '820000',\n}\n\n// 省级名称映射(反向查找)\nexport const PROVINCE_NAMES = Object.fromEntries(\n Object.entries(PROVINCE_CODES).map(([name, code]) => [code, name])\n)\n\n// 获取省级代码\nexport function getProvinceCode(provinceName: string): string {\n return PROVINCE_CODES[provinceName as keyof typeof PROVINCE_CODES] || '100000'\n}\n\n// 获取省级名称\nexport function getProvinceName(provinceCode: string): string {\n return PROVINCE_NAMES[provinceCode] || '中国'\n}\n\n// 判断是否为省级代码\nexport function isProvinceCode(code: string): boolean {\n return /^\\d{6}$/.test(code) && code !== '100000'\n}\n\n// 获取省级地图数据\nexport async function getProvinceMapData(provinceName: string): Promise<any> {\n const provinceCode = getProvinceCode(provinceName)\n \n try {\n const url = `https://geo.datav.aliyun.com/areas_v3/bound/${provinceCode}_full.json`\n \n const response = await fetch(url)\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n \n const data = await response.json()\n return data\n }\n catch (error) {\n console.error('Failed to fetch province map data for:', provinceName, error)\n throw error\n }\n}\n\n// 天地图配置\nexport const TIANDITU_CONFIG = {\n // 天地图 token(需要申请)\n TOKEN: '你的天地图token', // 请替换为您的天地图 token\n // 天地图 API 基础 URL\n BASE_URL: 'https://api.tianditu.gov.cn',\n}\n\n// 获取天地图行政区划数据\nexport async function fetchTiandituBoundary(adcode: string): Promise<any> {\n try {\n const url = FREE_MAP_SOURCES.TIANDITU_ADMIN.BOUNDARY(adcode).replace('你的天地图token', TIANDITU_CONFIG.TOKEN)\n const response = await fetch(url)\n \n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n \n const data = await response.json()\n return data\n }\n catch (error) {\n console.error('Failed to fetch Tianditu boundary data:', error)\n throw error\n }\n}\n\n// 获取地图数据的函数\nexport async function fetchMapData(adcode: string): Promise<any> {\n try {\n // 优先尝试从天地图获取数据\n if (TIANDITU_CONFIG.TOKEN !== '你的天地图token') {\n try {\n const tiandituData = await fetchTiandituBoundary(adcode)\n if (tiandituData && tiandituData.data && tiandituData.data.length > 0) {\n // 转换天地图数据为 GeoJSON 格式\n return convertTiandituToGeoJson(tiandituData)\n }\n }\n catch (error) {\n console.warn('Failed to fetch from Tianditu, trying DataV:', error)\n }\n }\n\n // 备用方案:从 DataV 获取数据\n const url = FREE_MAP_SOURCES.PROVINCE.DATAV(adcode)\n console.log('Fetching province map data from:', url)\n const response = await fetch(url)\n \n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n \n const data = await response.json()\n console.log('Successfully fetched province map data for:', adcode, data)\n return data\n }\n catch (error) {\n console.error('Failed to fetch map data for adcode:', adcode, error)\n throw error\n }\n}\n\n// 转换天地图数据为 GeoJSON 格式\nfunction convertTiandituToGeoJson(tiandituData: any): any {\n const features = tiandituData.data.map((item: any) => ({\n type: 'Feature',\n properties: {\n name: item.name,\n adcode: item.adcode,\n level: item.level,\n },\n geometry: {\n type: 'Polygon',\n coordinates: item.polygon ? [item.polygon] : [],\n },\n }))\n\n return {\n type: 'FeatureCollection',\n features,\n }\n} "],"names":["FREE_MAP_SOURCES","PROVINCE","TIANDITU","DATAV","adcode","TIANDITU_ADMIN","BOUNDARY","PROVINCE_CODES","PROVINCE_NAMES","Object","fromEntries","entries","map","_ref","name","code","getProvinceCode","provinceName","TIANDITU_CONFIG","TOKEN","BASE_URL","async","url","console","log","response","fetch","ok","Error","status","data","json","error","replace","warn","type","features","properties","geometry","coordinates","provinceCode","test"],"mappings":"aACO,MAAMA,EAAmB,CAE9BC,SAAU,CAERC,SAAUA,IAAM,8LAEhBC,MAAQC,GAAmB,+CAA+CA,eAG5EC,eAAgB,CAEdC,SAAWF,GAAmB,qEAAqEA,uHA6GhG,MAAMG,EAAiB,CAC5B,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,SAAU,SACV,MAAO,SACP,MAAO,SACP,OAAQ,SACR,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,UAAW,SACX,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,MAAO,SACP,QAAS,SACT,MAAO,SACP,MAAO,SACP,MAAO,SACP,UAAW,SACX,WAAY,SACZ,MAAO,SACP,UAAW,SACX,UAAW,UAIAC,EAAiBC,OAAOC,YACnCD,OAAOE,QAAQJ,GAAgBK,IAAIC,IAAA,IAAEC,EAAMC,GAAIF,EAAA,MAAM,CAACE,EAAMD,MAIvD,SAASE,EAAgBC,GAC9B,OAAOV,EAAeU,IAAgD,QACxE,CAkCO,MAAMC,EAAkB,CAE7BC,MAAO,aAEPC,SAAU,2JAuBZC,eAAmCjB,GACjC,IAgBE,MAAMkB,EAAMtB,EAAiBC,SAASE,MAAMC,GAC5CmB,QAAQC,IAAI,mCAAoCF,GAChD,MAAMG,QAAiBC,MAAMJ,GAE7B,IAAKG,EAASE,GACZ,MAAM,IAAIC,MAAM,uBAAuBH,EAASI,UAGlD,MAAMC,QAAaL,EAASM,OAE5B,OADAR,QAAQC,IAAI,8CAA+CpB,EAAQ0B,GAC5DA,CACT,OACOE,GAEL,MADAT,QAAQS,MAAM,uCAAwC5B,EAAQ4B,GACxDA,CACR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,OACxD,CAAC,MAAO,OAAQ,CAAC,MAAO,OAAQ,CAAC,MAAO,IAAQ,CAAC,MAAO,OACxD,CAAC,MAAO,OAAQ,CAAC,MAAO,OAAQ,CAAC,MAAO,OAAQ,CAAC,MAAO,MACxD,CAAC,MAAO,OAAQ,CAAC,MAAO,OAAQ,CAAC,MAAO,OAAQ,CAAC,MAAO,OACxD,CAAC,MAAO,MAAQ,CAAC,MAAO,OAAQ,CAAC,MAAO,OAAQ,CAAC,MAAO,YAMpE,uDA+DAlB,eAAyCJ,GACvC,MAAMuB,EAAexB,EAAgBC,GAErC,IACE,MAAMK,EAAM,+CAA+CkB,cAErDf,QAAiBC,MAAMJ,GAC7B,IAAKG,EAASE,GACZ,MAAM,IAAIC,MAAM,uBAAuBH,EAASI,UAIlD,aADmBJ,EAASM,MAE9B,OACOC,GAEL,MADAT,QAAQS,MAAM,yCAA0Cf,EAAce,GAChEA,CACR,CACF,0BA5BO,SAAyBQ,GAC9B,OAAOhC,EAAegC,IAAiB,IACzC,yBAGO,SAAwBzB,GAC7B,MAAO,UAAU0B,KAAK1B,IAAkB,WAATA,CACjC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"safe-eval.cjs","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":["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.cjs","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":["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":"oCAQO,SAAwBA,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
|
-
"use strict";var e=require("echarts"),t=require("
|
1
|
+
"use strict";var e=require("echarts"),t=require("vue"),o=require("@vueuse/core"),i=require("../components/empty.svg.cjs");function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(o){if("default"!==o){var i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:function(){return e[o]}})}}),t.default=e,Object.freeze(t)}var r=n(e);function s(e,t){const{width:i,height:n}=o.useElementSize(t);o.watchDebounced([i,n],()=>{if(e&&!e.isDisposed())try{e.resize()}catch(e){console.warn("Error during chart resize:",e)}})}exports.useCharts=function(e){let{chartDOM:n,chartData:a,chartOptions:c,initBefore:u,initAfter:l}=e,d=null,f=!1;const h=window.devicePixelRatio||1;function p(){if(d&&!d.isDisposed()){try{d.dispose()}catch(e){console.warn("Error disposing chart:",e)}d=null}}function g(){return d&&!d.isDisposed()||(d=r.init(n.value,null,{devicePixelRatio:h,renderer:"svg"})),d}function w(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"暂无数据";return new Promise(t=>{const o=new Image;o.src=i.default,o.onload=()=>{const n=o.width/o.height,r={title:[{text:a.value?.modelName,...c.value.title},{subtext:e,top:"center",left:"center",text:"{a|}",itemGap:-20,subtextStyle:{fontSize:14},textStyle:{align:"center",rich:{a:{height:100/n,width:100,backgroundColor:{image:i.default}}}}}]};f=!0,t([r,{notMerge:!0,replaceMerge:["xAxis","yAxis","series"],lazyUpdate:!1}])}})}const{isOutside:m}=o.useMouseInElement(n);return o.watchDebounced(m,e=>{"boolean"==typeof e&&d&&!d.isDisposed()&&function(e){if(d&&!d.isDisposed())try{d.setOption({toolbox:{show:e}})}catch(e){console.warn("Error toggling toolbox:",e)}}(!e)},{debounce:200}),o.watchDebounced(()=>c.value,async()=>{d&&!d.isDisposed()&&await async function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];try{d?.showLoading(),a.value?.data?.length?(!0===f&&(t[1]||(t[1]={}),t[1].notMerge=!0),f=!1):t=await w(),d?.setOption(...t)}catch(e){d&&!d.isDisposed()&&p(),g(),t=await w("配置项错误"),d?.setOption(...t)}finally{d?.hideLoading()}}(c.value)},{debounce:500,deep:!0,immediate:!0}),t.onMounted(async()=>{u&&await u(),g(),l&&await l(d),d&&!d.isDisposed()&&s(d,n)}),t.onUnmounted(()=>{if(d&&!d.isDisposed())try{d.getZr()?.off("mousemove"),d.getZr()?.off("mouseout"),d.getZr()?.off("click"),d.off("click"),p()}catch(e){console.warn("Error during chart cleanup:",e)}}),{myChart:d}},exports.useDataToExcelJson=function(e){const{desc:{colDesc:t=[],groupByDesc:o=[]}={},data:i=[]}=e,n=[...o.map(e=>e.colDesc),...t].filter(e=>e),r=i.map(e=>n.map(t=>e[t]||""));return[n,...r]},exports.useResize=s;
|
2
2
|
//# sourceMappingURL=useCharts.cjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useCharts.cjs","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.cjs","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":["useResize","myChart","chartDOM","width","height","useElementSize","watchDebounced","isDisposed","resize","error","console","warn","chartData","chartOptions","initBefore","initAfter","_ref","isEmpty","dpr","window","devicePixelRatio","disposeChart","dispose","initChart","echarts","init","value","renderer","setEmpty","subtext","Promise","resolve","img","Image","src","emptyImg","onload","aspectRatio","obj","title","text","modelName","top","left","itemGap","subtextStyle","fontSize","textStyle","align","rich","a","backgroundColor","image","notMerge","replaceMerge","lazyUpdate","isOutside","mouseInChart","useMouseInElement","newVal","show","setOption","toolbox","toggleToolbox","debounce","async","_len","arguments","length","opt","Array","_key","showLoading","data","hideLoading","renderChart","deep","immediate","onMounted","onUnmounted","getZr","off","dataSource","desc","colDesc","groupByDesc","header","map","item","filter","v","json","head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KAAK,8BAA+BF,EAC9C,IAIG,CACLR,UAEJ,6BAgBO,SAA4BiF,GACjC,MAAQC,MAAMC,QAAEA,EAAU,GAACC,YAAGA,EAAc,IAAO,CAAA,EAACZ,KAAGA,EAAO,IAAOS,EAC/DI,EAAS,IAAID,EAAYE,IAAIC,GAAQA,EAAKJ,YAAaA,GAASK,UAAYC,GAC5EC,EAAOlB,EAAKc,IAAKC,GACdF,EAAOC,IAAKK,GACVJ,EAAKI,IAAoC,KAGpD,MAAO,CAACN,KAAWK,EACrB"}
|
package/lib/src/defaults.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"defaults.cjs","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":"
|
1
|
+
{"version":3,"file":"defaults.cjs","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":"sGAGAA,kCAAeC,cAAcC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../../packages/components/src/file-upload/index.ts"],"sourcesContent":["import { withInstall } from '../withInstall'\nimport component from './src/file-upload.vue'\n\nconst QxsFileUpload = withInstall(component)\n\nexport {\n QxsFileUpload,\n}\n\nexport default QxsFileUpload\n"],"names":["QxsFileUpload","withInstall","component"
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../../packages/components/src/file-upload/index.ts"],"sourcesContent":["import { withInstall } from '../withInstall'\nimport component from './src/file-upload.vue'\n\nconst QxsFileUpload = withInstall(component)\n\nexport {\n QxsFileUpload,\n}\n\nexport default QxsFileUpload\n"],"names":["QxsFileUpload","withInstall","component"],"mappings":"+IAGA,MAAMA,EAAgBC,EAAAA,YAAYC,EAAAA"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("element-plus/es");require("element-plus/es/components/base/style/index"),require("element-plus/es/components/upload/style/index"),require("element-plus/es/components/alert/style/index"),require("element-plus/es/components/icon/style/index");var l=require("vue"),t=require("@element-plus/icons-vue"),a=require("@qxs-bns/hooks"),s=require("element-plus");require("element-plus/es/components/message/style/index");const r={class:"slot"},n={style:{display:"inline-block"}};var i=l.defineComponent({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(i,{emit:o}){const u=o,d=a.useNamespace("file-upload"),c=s.useNamespace("file-upload"),p=l.computed((
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("element-plus/es");require("element-plus/es/components/base/style/index"),require("element-plus/es/components/upload/style/index"),require("element-plus/es/components/alert/style/index"),require("element-plus/es/components/icon/style/index");var l=require("vue"),t=require("@element-plus/icons-vue"),a=require("@qxs-bns/hooks"),s=require("element-plus");require("element-plus/es/components/message/style/index");const r={class:"slot"},n={style:{display:"inline-block"}};var i=l.defineComponent({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(i,{emit:o}){const u=o,d=a.useNamespace("file-upload"),c=s.useNamespace("file-upload"),p=l.computed(()=>i.accept.split(",")),m=l=>{const t=l.name.split(".").at(-1)??"",a=p.value.includes(t),s=l.size/1024/1024<i.size;return a||e.ElMessage.error(`上传文件只支持 ${p.value.join(" / ")} 格式!`),s||e.ElMessage.error(`上传文件大小不能超过 ${i.size}MB!`),a&&s},f=()=>{e.ElMessage.warning("文件上传超过限制")},y=(e,l,t)=>{u("onSuccess",e,l,t)};return(a,s)=>{const i=e.ElIcon,o=e.ElAlert,u=e.ElUpload;return l.openBlock(),l.createBlock(u,{headers:a.headers,action:a.action,data:a.data,name:a.name,"before-upload":m,"on-exceed":f,"on-success":y,"file-list":a.files,limit:a.max,drag:"",class:l.normalizeClass(l.unref(d).e("control"))},{tip:l.withCtx(()=>[a.notip?l.createCommentVNode("v-if",!0):(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(`${l.unref(c).namespace.value}-upload__tip`)},[l.createElementVNode("div",n,[l.createVNode(o,{title:`上传文件支持 ${l.unref(p).join(" / ")} 格式,单个文件大小不超过 ${a.size}MB,且文件数量不超过 ${a.max} 个`,type:"info","show-icon":"",closable:!1},null,8,["title"])])],2))]),default:l.withCtx(()=>[l.createElementVNode("div",r,[l.createVNode(i,{class:l.normalizeClass(`${l.unref(c).namespace.value}-icon--upload`)},{default:l.withCtx(()=>[l.createVNode(l.unref(t.UploadFilled))]),_:1},8,["class"]),l.createElementVNode("div",{class:l.normalizeClass(`${l.unref(c).namespace.value}-upload__text`)},s[0]||(s[0]=[l.createTextVNode(" 将文件拖到此处,或",-1),l.createElementVNode("em",null,"点击上传",-1)]),2)])]),_:1},8,["headers","action","data","name","file-list","limit","class"])}}});exports.default=i;
|
2
2
|
//# sourceMappingURL=file-upload.vue.cjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file-upload.vue.cjs","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":"iiCA8BA,MAAMA,EAAOC,EAEPC,EAAKC,
|
1
|
+
{"version":3,"file":"file-upload.vue.cjs","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","_component_el_icon","UploadFilled"],"mappings":"iiCA8BA,MAAMA,EAAOC,EAEPC,EAAKC,EAAAA,aAAa,eAClBC,EAAOC,EAAAA,aAAe,eAEtBC,EAAOC,EAAAA,SAAS,IACbC,EAAAC,OAAOC,MAAM,MAEhBC,EAA6CC,IACjD,MACMC,EADWD,EAAKE,KAAKJ,MAAM,KACRK,IAAG,IAAO,GAC7BC,EAAWV,EA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1 @@
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../../packages/components/src/fixed-action-bar/index.ts"],"sourcesContent":["import { withInstall } from '../withInstall'\nimport component from './src/fixed-action-bar.vue'\n\nconst QxsFixedActionBar = withInstall(component)\n\nexport {\n QxsFixedActionBar,\n}\n\nexport default QxsFixedActionBar\n"],"names":["QxsFixedActionBar","withInstall","component"
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../../packages/components/src/fixed-action-bar/index.ts"],"sourcesContent":["import { withInstall } from '../withInstall'\nimport component from './src/fixed-action-bar.vue'\n\nconst QxsFixedActionBar = withInstall(component)\n\nexport {\n QxsFixedActionBar,\n}\n\nexport default QxsFixedActionBar\n"],"names":["QxsFixedActionBar","withInstall","component"],"mappings":"oJAGA,MAAMA,EAAoBC,EAAAA,YAAYC,EAAAA"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("@qxs-bns/hooks"),n=require("@qxs-bns/utils"),r=require("lodash-es");var a=e.defineComponent({name:"QxsFixedActionBar",props:{padding:{type:Number,default:8},className:{type:String,default:""}},setup(a){const o=a,i=t.useNamespace("fixed-action-bar"),l=e.ref(!1),d=e.ref(null),s=e.ref(null),u=e.ref({width:0,height:0}),c=e.ref(0),p=e.ref(0),f={resize:null,parent:null};function m(e,t,n){const r=new ResizeObserver(
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("@qxs-bns/hooks"),n=require("@qxs-bns/utils"),r=require("lodash-es");var a=e.defineComponent({name:"QxsFixedActionBar",props:{padding:{type:Number,default:8},className:{type:String,default:""}},setup(a){const o=a,i=t.useNamespace("fixed-action-bar"),l=e.ref(!1),d=e.ref(null),s=e.ref(null),u=e.ref({width:0,height:0}),c=e.ref(0),p=e.ref(0),f={resize:null,parent:null};function m(e,t,n){const r=new ResizeObserver(e=>{e.forEach(e=>requestAnimationFrame(()=>t(e)))});return r.observe(e,n),r}function h(){if(!d.value||!s.value)return;f.resize=m(d.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);u.value={width:e.contentRect.width+t.x,height:e.contentRect.height+t.y}},{box:"border-box"});const e=s.value.parentElement;e&&(f.parent=m(e,()=>{const t=e.getBoundingClientRect();c.value=t.width,p.value=t.left}))}const v=r.debounce(()=>{const{scrollY:e}=window,{clientHeight:t,scrollHeight:n}=document.documentElement;l.value=Math.ceil(e+t)>=n},100),g=e.computed(()=>l.value?"":i.is("shadow")),b=e.computed(()=>"Android"===n.getDeviceType()?Math.max(o.padding,20):o.padding),x=e.computed(()=>({width:`${c.value}px`,left:`${p.value}px`,...i.cssVarBlock({"actionbar-padding":`${o.padding}px`,"actionbar-padding-bottom":`${b.value}px`})}));return e.onMounted(()=>{h(),window.addEventListener("scroll",v,{passive:!0})}),e.onUnmounted(()=>{f.resize?.disconnect(),f.parent?.disconnect(),window.removeEventListener("scroll",v)}),(t,n)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"placeholderRef",ref:s,style:e.normalizeStyle({width:"100%",height:`${e.unref(u).height}px`})},[e.createElementVNode("div",{ref_key:"actionbar",ref:d,style:e.normalizeStyle(e.unref(x)),class:e.normalizeClass([e.unref(i).e("actionbar"),e.unref(g),a.className]),"data-fixed-calc-width":""},[e.renderSlot(t.$slots,"default")],6)],4))}});exports.default=a;
|
2
2
|
//# sourceMappingURL=fixed-action-bar.vue.cjs.map
|