@qxs-bns/components 0.0.60 → 0.0.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/es/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.mjs +2 -0
  2. package/es/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.mjs.map +1 -0
  3. package/es/package.json.mjs +1 -1
  4. package/es/src/data-chart/src/components/area.vue.mjs +1 -1
  5. package/es/src/data-chart/src/components/area.vue2.mjs +1 -1
  6. package/es/src/data-chart/src/components/area.vue2.mjs.map +1 -1
  7. package/es/src/data-chart/src/components/area.vue3.mjs +2 -0
  8. package/es/src/data-chart/src/components/area.vue3.mjs.map +1 -0
  9. package/es/src/data-chart/src/components/bar.vue.mjs +1 -1
  10. package/es/src/data-chart/src/components/bar.vue.mjs.map +1 -1
  11. package/es/src/data-chart/src/components/card.vue.mjs +1 -1
  12. package/es/src/data-chart/src/components/card.vue3.mjs +2 -0
  13. package/es/src/data-chart/src/components/card.vue3.mjs.map +1 -0
  14. package/es/src/data-chart/src/components/funnel.vue.mjs +1 -1
  15. package/es/src/data-chart/src/components/funnel.vue.mjs.map +1 -1
  16. package/es/src/data-chart/src/components/line.vue.mjs +1 -1
  17. package/es/src/data-chart/src/components/line.vue2.mjs +1 -1
  18. package/es/src/data-chart/src/components/line.vue2.mjs.map +1 -1
  19. package/es/src/data-chart/src/components/line.vue3.mjs +2 -0
  20. package/es/src/data-chart/src/components/line.vue3.mjs.map +1 -0
  21. package/es/src/data-chart/src/components/pie.vue.mjs +1 -1
  22. package/es/src/data-chart/src/components/pie.vue.mjs.map +1 -1
  23. package/es/src/data-chart/src/components/radar.vue.mjs +1 -1
  24. package/es/src/data-chart/src/components/radar.vue.mjs.map +1 -1
  25. package/es/src/data-chart/src/components/scatter-simple.vue.mjs +1 -1
  26. package/es/src/data-chart/src/components/scatter-simple.vue.mjs.map +1 -1
  27. package/es/src/data-chart/src/components/scatter.vue.mjs +1 -1
  28. package/es/src/data-chart/src/components/scatter.vue.mjs.map +1 -1
  29. package/es/src/data-chart/src/data-chart.vue.mjs +1 -1
  30. package/es/src/data-chart/src/data-chart.vue.mjs.map +1 -1
  31. package/es/src/data-chart/src/utils/useCharts.mjs +1 -1
  32. package/es/src/data-chart/src/utils/useCharts.mjs.map +1 -1
  33. package/es/src/icon/src/icon.vue.mjs +1 -1
  34. package/es/src/icon/src/icon.vue.mjs.map +1 -1
  35. package/es/src/image-upload/src/image-upload.vue.mjs +1 -1
  36. package/es/src/image-upload/src/image-upload.vue.mjs.map +1 -1
  37. package/lib/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.cjs +2 -0
  38. package/lib/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.cjs.map +1 -0
  39. package/lib/package.json.cjs +1 -1
  40. package/lib/src/data-chart/src/components/area.vue.cjs +1 -1
  41. package/lib/src/data-chart/src/components/area.vue2.cjs +1 -1
  42. package/lib/src/data-chart/src/components/area.vue2.cjs.map +1 -1
  43. package/lib/src/data-chart/src/components/area.vue3.cjs +2 -0
  44. package/lib/src/data-chart/src/components/area.vue3.cjs.map +1 -0
  45. package/lib/src/data-chart/src/components/bar.vue.cjs +1 -1
  46. package/lib/src/data-chart/src/components/bar.vue.cjs.map +1 -1
  47. package/lib/src/data-chart/src/components/card.vue.cjs +1 -1
  48. package/lib/src/data-chart/src/components/card.vue3.cjs +2 -0
  49. package/lib/src/data-chart/src/components/card.vue3.cjs.map +1 -0
  50. package/lib/src/data-chart/src/components/funnel.vue.cjs +1 -1
  51. package/lib/src/data-chart/src/components/funnel.vue.cjs.map +1 -1
  52. package/lib/src/data-chart/src/components/line.vue.cjs +1 -1
  53. package/lib/src/data-chart/src/components/line.vue2.cjs +1 -1
  54. package/lib/src/data-chart/src/components/line.vue2.cjs.map +1 -1
  55. package/lib/src/data-chart/src/components/line.vue3.cjs +2 -0
  56. package/lib/src/data-chart/src/components/line.vue3.cjs.map +1 -0
  57. package/lib/src/data-chart/src/components/pie.vue.cjs +1 -1
  58. package/lib/src/data-chart/src/components/pie.vue.cjs.map +1 -1
  59. package/lib/src/data-chart/src/components/radar.vue.cjs +1 -1
  60. package/lib/src/data-chart/src/components/radar.vue.cjs.map +1 -1
  61. package/lib/src/data-chart/src/components/scatter-simple.vue.cjs +1 -1
  62. package/lib/src/data-chart/src/components/scatter-simple.vue.cjs.map +1 -1
  63. package/lib/src/data-chart/src/components/scatter.vue.cjs +1 -1
  64. package/lib/src/data-chart/src/components/scatter.vue.cjs.map +1 -1
  65. package/lib/src/data-chart/src/data-chart.vue.cjs +1 -1
  66. package/lib/src/data-chart/src/data-chart.vue.cjs.map +1 -1
  67. package/lib/src/data-chart/src/utils/useCharts.cjs +1 -1
  68. package/lib/src/data-chart/src/utils/useCharts.cjs.map +1 -1
  69. package/lib/src/icon/src/icon.vue.cjs +1 -1
  70. package/lib/src/icon/src/icon.vue.cjs.map +1 -1
  71. package/lib/src/image-upload/src/image-upload.vue.cjs +1 -1
  72. package/lib/src/image-upload/src/image-upload.vue.cjs.map +1 -1
  73. package/package.json +2 -2
  74. package/theme-chalk/index.css +1 -1
  75. package/theme-chalk/src/icon.css +1 -1
  76. package/theme-chalk/src/icon.scss +6 -5
  77. package/types/src/data-chart/index.d.ts +93 -0
  78. package/types/src/data-chart/index.d.ts.map +1 -1
  79. package/types/src/data-chart/src/components/area.vue.d.ts +3 -1
  80. package/types/src/data-chart/src/components/area.vue.d.ts.map +1 -1
  81. package/types/src/data-chart/src/components/bar.vue.d.ts +3 -1
  82. package/types/src/data-chart/src/components/bar.vue.d.ts.map +1 -1
  83. package/types/src/data-chart/src/components/funnel.vue.d.ts +3 -1
  84. package/types/src/data-chart/src/components/funnel.vue.d.ts.map +1 -1
  85. package/types/src/data-chart/src/components/line.vue.d.ts +3 -1
  86. package/types/src/data-chart/src/components/line.vue.d.ts.map +1 -1
  87. package/types/src/data-chart/src/components/pie.vue.d.ts +3 -1
  88. package/types/src/data-chart/src/components/pie.vue.d.ts.map +1 -1
  89. package/types/src/data-chart/src/components/radar.vue.d.ts +3 -1
  90. package/types/src/data-chart/src/components/radar.vue.d.ts.map +1 -1
  91. package/types/src/data-chart/src/components/scatter-simple.vue.d.ts +3 -1
  92. package/types/src/data-chart/src/components/scatter-simple.vue.d.ts.map +1 -1
  93. package/types/src/data-chart/src/components/scatter.vue.d.ts +3 -1
  94. package/types/src/data-chart/src/components/scatter.vue.d.ts.map +1 -1
  95. package/types/src/data-chart/src/data-chart.vue.d.ts +94 -1
  96. package/types/src/data-chart/src/data-chart.vue.d.ts.map +1 -1
  97. package/types/src/data-chart/src/utils/useCharts.d.ts +6 -6
  98. package/types/src/data-chart/src/utils/useCharts.d.ts.map +1 -1
  99. package/types/src/icon/src/icon.vue.d.ts.map +1 -1
  100. package/types/src/image-upload/src/image-upload.vue.d.ts +2 -2
  101. package/types/src/image-upload/src/image-upload.vue.d.ts.map +1 -1
  102. package/types/tsconfig.tsbuildinfo +1 -1
  103. package/es/index.css +0 -82
  104. package/lib/index.css +0 -82
@@ -1 +1 @@
1
- {"version":3,"file":"pie.vue.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/pie.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { PieSeriesOption } from 'echarts/charts'\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { orderBy } from 'lodash-es'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartPie',\n})\nconst {\n chartData,\n subShowType = 'pie-simple',\n chartOptions,\n} = defineProps<{\n chartData: IFormatPublicData\n subShowType: string\n chartOptions: EChartsOption\n}>()\nconst merge = inject(InjectionChartMerge, (v: any) => v, true)\n\nconst dataChartPie = ref(null)\nconst pieChartOptions = computed<EChartsOption>(() => {\n const { colDesc, xGroupByDesc, data, modelName } = chartData\n const colDescLength = colDesc.length\n const config = {\n title: { text: modelName },\n series: colDesc.map((item, index) => {\n const seriesItem: PieSeriesOption = {\n name: item,\n type: 'pie',\n center: ['50%', '50%'],\n data: [],\n emphasis: {\n itemStyle: {\n shadowBlur: 10,\n shadowOffsetX: 0,\n shadowColor: 'rgba(0, 0, 0, 0.5)',\n },\n },\n label: {\n formatter: '{b}:{c}({d}%)',\n rich: {\n b: {\n color: '#4C5058',\n fontSize: 14,\n fontWeight: 'bold',\n lineHeight: 33,\n },\n },\n },\n }\n\n let cutNum = 5\n const currentItemData = data.filter(row => row[item] !== undefined)\n const orderByData = orderBy(currentItemData, [item], ['desc'])\n // 总数\n const totalDesc = orderByData.reduce((prev, cur) => {\n const value = Number(cur[item]) || 0\n return Number.isNaN(value) ? prev : prev + value\n }, 0)\n if (currentItemData.length > cutNum) {\n while (cutNum < 9) {\n const headerData = orderByData.slice(0, cutNum)\n // 前 cutNum 个总数\n const headerTotal = headerData.reduce(\n (prev, cur) => prev + Number(cur[item]),\n 0,\n )\n // 前五总占比\n const headerScale = headerTotal / totalDesc\n if (headerScale > 0.9 || cutNum === 8) {\n const footerData = orderByData.slice(\n cutNum,\n orderByData.length - 1,\n )\n seriesItem.data = currentItemData\n .map((yItem) => {\n let obj = {}\n headerData.forEach((headerDataItem) => {\n if (JSON.stringify(headerDataItem) === JSON.stringify(yItem)) {\n obj = {\n name: xGroupByDesc?.colDesc\n ? yItem[xGroupByDesc.colDesc]\n : '',\n value: yItem[item],\n }\n }\n })\n return obj\n })\n .filter(v => v && Object.keys(v).length > 0)\n seriesItem.data.push({\n name: '其它',\n value: footerData.reduce(\n (prev, cur) => prev + Number(cur[item]),\n 0,\n ),\n })\n\n break\n }\n else {\n cutNum++\n }\n }\n }\n else {\n seriesItem.data = currentItemData.map(yItem => ({\n name: xGroupByDesc?.colDesc ? (yItem[xGroupByDesc.colDesc] || '') : '',\n value: Number(yItem[item] || 0),\n }))\n }\n\n if (colDescLength === 1) {\n seriesItem.center = ['50%', '60%']\n }\n else if (colDescLength === 2) {\n if (index === 0) {\n seriesItem.right = '40%'\n seriesItem.left = ''\n seriesItem.center = ['40%', '60%']\n }\n else {\n seriesItem.right = ''\n seriesItem.left = '40%'\n seriesItem.center = ['60%', '60%']\n }\n }\n else if (colDescLength === 3) {\n if (index === 0) {\n seriesItem.right = '40%'\n seriesItem.bottom = '50%'\n seriesItem.top = ''\n seriesItem.left = ''\n seriesItem.center = ['40%', '78%']\n }\n else if (index === 1) {\n seriesItem.right = ''\n seriesItem.bottom = '50%'\n seriesItem.top = ''\n seriesItem.left = '40%'\n seriesItem.center = ['60%', '78%']\n }\n else {\n seriesItem.right = '40%'\n seriesItem.bottom = ''\n seriesItem.top = '50%'\n seriesItem.left = ''\n seriesItem.center = ['40%', '60%']\n }\n }\n else if (colDescLength === 4) {\n if (index === 0) {\n seriesItem.right = '40%'\n seriesItem.bottom = '50%'\n seriesItem.top = ''\n seriesItem.left = ''\n seriesItem.center = ['40%', '78%']\n }\n else if (index === 1) {\n seriesItem.right = ''\n seriesItem.bottom = '50%'\n seriesItem.top = ''\n seriesItem.left = '40%'\n seriesItem.center = ['60%', '78%']\n }\n else if (index === 2) {\n seriesItem.right = '40%'\n seriesItem.bottom = ''\n seriesItem.top = '50%'\n seriesItem.left = ''\n seriesItem.center = ['40%', '60%']\n }\n else {\n seriesItem.right = ''\n seriesItem.bottom = ''\n seriesItem.top = '50%'\n seriesItem.left = '40%'\n seriesItem.center = ['60%', '60%']\n }\n }\n // 处理图表形状\n switch (subShowType) {\n case 'pie-borderRadius':\n seriesItem.radius = ['50%', '70%']\n break\n case 'pie-simple':\n seriesItem.radius = '50%'\n break\n default:\n seriesItem.radius = '50%'\n break\n }\n return seriesItem\n }),\n }\n\n return merge(config, chartOptions)\n})\n\nuseCharts({\n chartDOM: dataChartPie,\n chartOptions: pieChartOptions,\n chartData: computed(() => chartData),\n})\n</script>\n\n<template>\n <div\n ref=\"dataChartPie\"\n class=\"data-chart-pie\"\n />\n</template>\n"],"names":["merge","inject","InjectionChartMerge","v","dataChartPie","ref","pieChartOptions","computed","colDesc","xGroupByDesc","data","modelName","__props","chartData","colDescLength","length","config","title","text","series","map","item","index","seriesItem","name","type","center","emphasis","itemStyle","shadowBlur","shadowOffsetX","shadowColor","label","formatter","rich","b","color","fontSize","fontWeight","lineHeight","cutNum","currentItemData","filter","row","orderByData","orderBy","totalDesc","reduce","prev","cur","value","Number","isNaN","headerData","slice","footerData","yItem","obj","forEach","headerDataItem","JSON","stringify","Object","keys","push","right","left","bottom","top","subShowType","radius","chartOptions","useCharts","chartDOM","_createElementBlock","class"],"mappings":"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"}
1
+ {"version":3,"file":"pie.vue.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/pie.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { PieSeriesOption } from 'echarts/charts'\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { orderBy } from 'lodash-es'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartPie',\n})\nconst {\n chartData,\n subShowType = 'pie-simple',\n chartOptions,\n} = defineProps<{\n chartData: IFormatPublicData\n subShowType: string\n chartOptions: EChartsOption\n}>()\nconst merge = inject(InjectionChartMerge, (v: any) => v, true)\n\nconst dataChartPie = ref(null)\nconst pieChartOptions = computed<EChartsOption>(() => {\n const { colDesc, xGroupByDesc, data, modelName } = chartData\n const colDescLength = colDesc.length\n const config = {\n title: { text: modelName },\n series: colDesc.map((item, index) => {\n const seriesItem: PieSeriesOption = {\n name: item,\n type: 'pie',\n center: ['50%', '50%'],\n data: [],\n emphasis: {\n itemStyle: {\n shadowBlur: 10,\n shadowOffsetX: 0,\n shadowColor: 'rgba(0, 0, 0, 0.5)',\n },\n },\n label: {\n formatter: '{b}:{c}({d}%)',\n rich: {\n b: {\n color: '#4C5058',\n fontSize: 14,\n fontWeight: 'bold',\n lineHeight: 33,\n },\n },\n },\n }\n\n let cutNum = 5\n const currentItemData = data.filter(row => row[item] !== undefined)\n const orderByData = orderBy(currentItemData, [item], ['desc'])\n // 总数\n const totalDesc = orderByData.reduce((prev, cur) => {\n const value = Number(cur[item]) || 0\n return Number.isNaN(value) ? prev : prev + value\n }, 0)\n if (currentItemData.length > cutNum) {\n while (cutNum < 9) {\n const headerData = orderByData.slice(0, cutNum)\n // 前 cutNum 个总数\n const headerTotal = headerData.reduce(\n (prev, cur) => prev + Number(cur[item]),\n 0,\n )\n // 前五总占比\n const headerScale = headerTotal / totalDesc\n if (headerScale > 0.9 || cutNum === 8) {\n const footerData = orderByData.slice(\n cutNum,\n orderByData.length - 1,\n )\n seriesItem.data = currentItemData\n .map((yItem) => {\n let obj = {}\n headerData.forEach((headerDataItem) => {\n if (JSON.stringify(headerDataItem) === JSON.stringify(yItem)) {\n obj = {\n name: xGroupByDesc?.colDesc\n ? yItem[xGroupByDesc.colDesc]\n : '',\n value: yItem[item],\n }\n }\n })\n return obj\n })\n .filter(v => v && Object.keys(v).length > 0)\n seriesItem.data.push({\n name: '其它',\n value: footerData.reduce(\n (prev, cur) => prev + Number(cur[item]),\n 0,\n ),\n })\n\n break\n }\n else {\n cutNum++\n }\n }\n }\n else {\n seriesItem.data = currentItemData.map(yItem => ({\n name: xGroupByDesc?.colDesc ? (yItem[xGroupByDesc.colDesc] || '') : '',\n value: Number(yItem[item] || 0),\n }))\n }\n\n if (colDescLength === 1) {\n seriesItem.center = ['50%', '60%']\n }\n else if (colDescLength === 2) {\n if (index === 0) {\n seriesItem.right = '40%'\n seriesItem.left = ''\n seriesItem.center = ['40%', '60%']\n }\n else {\n seriesItem.right = ''\n seriesItem.left = '40%'\n seriesItem.center = ['60%', '60%']\n }\n }\n else if (colDescLength === 3) {\n if (index === 0) {\n seriesItem.right = '40%'\n seriesItem.bottom = '50%'\n seriesItem.top = ''\n seriesItem.left = ''\n seriesItem.center = ['40%', '78%']\n }\n else if (index === 1) {\n seriesItem.right = ''\n seriesItem.bottom = '50%'\n seriesItem.top = ''\n seriesItem.left = '40%'\n seriesItem.center = ['60%', '78%']\n }\n else {\n seriesItem.right = '40%'\n seriesItem.bottom = ''\n seriesItem.top = '50%'\n seriesItem.left = ''\n seriesItem.center = ['40%', '60%']\n }\n }\n else if (colDescLength === 4) {\n if (index === 0) {\n seriesItem.right = '40%'\n seriesItem.bottom = '50%'\n seriesItem.top = ''\n seriesItem.left = ''\n seriesItem.center = ['40%', '78%']\n }\n else if (index === 1) {\n seriesItem.right = ''\n seriesItem.bottom = '50%'\n seriesItem.top = ''\n seriesItem.left = '40%'\n seriesItem.center = ['60%', '78%']\n }\n else if (index === 2) {\n seriesItem.right = '40%'\n seriesItem.bottom = ''\n seriesItem.top = '50%'\n seriesItem.left = ''\n seriesItem.center = ['40%', '60%']\n }\n else {\n seriesItem.right = ''\n seriesItem.bottom = ''\n seriesItem.top = '50%'\n seriesItem.left = '40%'\n seriesItem.center = ['60%', '60%']\n }\n }\n // 处理图表形状\n switch (subShowType) {\n case 'pie-borderRadius':\n seriesItem.radius = ['50%', '70%']\n break\n case 'pie-simple':\n seriesItem.radius = '50%'\n break\n default:\n seriesItem.radius = '50%'\n break\n }\n return seriesItem\n }),\n }\n\n return merge(config, chartOptions)\n})\n\nconst { myChart } = useCharts({\n chartDOM: dataChartPie,\n chartOptions: pieChartOptions,\n chartData: computed(() => chartData),\n})\n\n// 暴露图表实例\ndefineExpose({\n myChart\n})\n</script>\n\n<template>\n <div\n ref=\"dataChartPie\"\n class=\"data-chart-pie\"\n />\n</template>\n"],"names":["merge","inject","InjectionChartMerge","v","dataChartPie","ref","pieChartOptions","computed","colDesc","xGroupByDesc","data","modelName","__props","chartData","colDescLength","length","config","title","text","series","map","item","index","seriesItem","name","type","center","emphasis","itemStyle","shadowBlur","shadowOffsetX","shadowColor","label","formatter","rich","b","color","fontSize","fontWeight","lineHeight","cutNum","currentItemData","filter","row","orderByData","orderBy","totalDesc","reduce","prev","cur","value","Number","isNaN","headerData","slice","footerData","yItem","obj","forEach","headerDataItem","JSON","stringify","Object","keys","push","right","left","bottom","top","subShowType","radius","chartOptions","myChart","useCharts","chartDOM","__expose","_createElementBlock","class"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),a=require("lodash-es"),r=require("../utils/injectionKeys.cjs"),t=require("../utils/useCharts.cjs"),u=e.defineComponent({name:"DataChartRadar",__name:"radar",props:{chartData:{type:Object,required:!0},chartOptions:{type:null,required:!0}},setup(u){const s=e.ref(),c=e.inject(r.InjectionChartMerge,e=>e,!0),o=e.computed(()=>{const{colDesc:e,xGroupByDesc:r,modelName:t,data:s}=u.chartData;r?.groupByValues||(r.groupByValues=[]),r.groupByValues=a.uniq(s.map(e=>e[r.colDesc||""]).filter(e=>e));const o={title:{text:t},radar:{indicator:r?.groupByValues?.map(a=>({name:a,max:Math.max(...s.map(a=>Number(a[e[0]])))}))||[]},series:[{name:r?.colDesc,type:"radar",tooltip:{trigger:"item"},data:e.map(e=>({name:e,value:r?.groupByValues?.map(a=>s.map(t=>a===t[r.colDesc||""]?t[e]:null).filter(e=>e).reduce((e,a)=>Number(e||0)+Number(a||0),0))}))}]};return c(o,u.chartOptions)});return t.useCharts({chartDOM:s,chartOptions:o,chartData:e.computed(()=>u.chartData)}),(a,r)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dataChartRadar",ref:s,class:"data-chart-radar"},null,512))}});exports.default=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),a=require("lodash-es"),r=require("../utils/injectionKeys.cjs"),t=require("../utils/useCharts.cjs"),u=e.defineComponent({name:"DataChartRadar",__name:"radar",props:{chartData:{type:Object,required:!0},chartOptions:{type:null,required:!0}},setup(u,{expose:s}){const c=e.ref(),o=e.inject(r.InjectionChartMerge,e=>e,!0),l=e.computed(()=>{const{colDesc:e,xGroupByDesc:r,modelName:t,data:s}=u.chartData;r?.groupByValues||(r.groupByValues=[]),r.groupByValues=a.uniq(s.map(e=>e[r.colDesc||""]).filter(e=>e));const c={title:{text:t},radar:{indicator:r?.groupByValues?.map(a=>({name:a,max:Math.max(...s.map(a=>Number(a[e[0]])))}))||[]},series:[{name:r?.colDesc,type:"radar",tooltip:{trigger:"item"},data:e.map(e=>({name:e,value:r?.groupByValues?.map(a=>s.map(t=>a===t[r.colDesc||""]?t[e]:null).filter(e=>e).reduce((e,a)=>Number(e||0)+Number(a||0),0))}))}]};return o(c,u.chartOptions)}),{myChart:p}=t.useCharts({chartDOM:c,chartOptions:l,chartData:e.computed(()=>u.chartData)});return s({myChart:p}),(a,r)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dataChartRadar",ref:c,class:"data-chart-radar"},null,512))}});exports.default=u;
2
2
  //# sourceMappingURL=radar.vue.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"radar.vue.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/radar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { uniq } from 'lodash-es'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartRadar',\n})\n\nconst {\n chartData,\n chartOptions,\n} = defineProps<{\n chartData: IFormatPublicData\n chartOptions: EChartsOption\n}>()\n\nconst dataChartRadar = ref()\nconst merge = inject(InjectionChartMerge, (v: any) => v, true)\nconst radarChartOptions = computed<EChartsOption>(() => {\n const { colDesc, xGroupByDesc, modelName, data } = chartData\n\n if (!xGroupByDesc?.groupByValues) {\n xGroupByDesc.groupByValues = []\n }\n xGroupByDesc.groupByValues = uniq(data.map((item) => {\n return item[xGroupByDesc.colDesc || ''] as string\n }).filter(v => v))\n\n const config = {\n title: {\n text: modelName,\n },\n radar: {\n indicator: xGroupByDesc?.groupByValues?.map((groupByValuesItem) => {\n return {\n name: groupByValuesItem,\n max: Math.max(...data.map(item => Number(item[colDesc[0]]))),\n }\n }) || [],\n },\n series: [{\n name: xGroupByDesc?.colDesc,\n type: 'radar',\n tooltip: {\n trigger: 'item',\n },\n data: colDesc.map(colDescItem => ({\n name: colDescItem,\n value: xGroupByDesc?.groupByValues?.map((groupByValuesItem) => {\n return (data.map((dataItem) => {\n if (groupByValuesItem === dataItem[xGroupByDesc.colDesc || '']) {\n return dataItem[colDescItem]\n }\n return null\n }).filter(v => v)).reduce((pre, cur) => Number(pre || 0) + Number(cur || 0), 0)\n }),\n })),\n }],\n }\n\n return merge(config, chartOptions)\n})\nuseCharts({ chartDOM: dataChartRadar, chartOptions: radarChartOptions, chartData: computed(() => chartData) })\n</script>\n\n<template>\n <div\n ref=\"dataChartRadar\"\n class=\"data-chart-radar\"\n />\n</template>\n"],"names":["dataChartRadar","ref","merge","inject","InjectionChartMerge","v","radarChartOptions","computed","colDesc","xGroupByDesc","modelName","data","__props","chartData","groupByValues","uniq","map","item","filter","config","title","text","radar","indicator","groupByValuesItem","name","max","Math","Number","series","type","tooltip","trigger","colDescItem","value","dataItem","reduce","pre","cur","chartOptions","useCharts","chartDOM","_createElementBlock","class"],"mappings":"gVAkBA,MAAMA,EAAiBC,EAAAA,MACjBC,EAAQC,EAAAA,OAAOC,EAAAA,oBAAsBC,GAAWA,GAAG,GACnDC,EAAoBC,EAAAA,SAAwB,KAChD,MAAMC,QAAEA,EAAAC,aAASA,EAAAC,UAAcA,EAAAC,KAAWA,GAASC,EAAAC,UAE9CJ,GAAcK,gBACjBL,EAAaK,cAAgB,IAE/BL,EAAaK,cAAgBC,EAAAA,KAAKJ,EAAKK,IAAKC,GACnCA,EAAKR,EAAaD,SAAW,KACnCU,OAAOb,GAAKA,IAEf,MAAMc,EAAS,CACbC,MAAO,CACLC,KAAMX,GAERY,MAAO,CACLC,UAAWd,GAAcK,eAAeE,IAAKQ,IACpC,CACLC,KAAMD,EACNE,IAAKC,KAAKD,OAAOf,EAAKK,IAAIC,GAAQW,OAAOX,EAAKT,EAAQ,WAEpD,IAERqB,OAAQ,CAAC,CACPJ,KAAMhB,GAAcD,QACpBsB,KAAM,QACNC,QAAS,CACPC,QAAS,QAEXrB,KAAMH,EAAQQ,IAAIiB,IAAA,CAChBR,KAAMQ,EACNC,MAAOzB,GAAcK,eAAeE,IAAKQ,GAC/Bb,EAAKK,IAAKmB,GACZX,IAAsBW,EAAS1B,EAAaD,SAAW,IAClD2B,EAASF,GAEX,MACNf,UAAYb,GAAI+B,OAAO,CAACC,EAAKC,IAAQV,OAAOS,GAAO,GAAKT,OAAOU,GAAO,GAAI,UAMrF,OAAOpC,EAAMiB,EAAQP,EAAA2B,uBAEvBC,EAAAA,UAAU,CAAEC,SAAUzC,EAAgBuC,aAAcjC,EAAmBO,UAAWN,WAAS,IAAMK,EAAAC,mCAI/F6B,EAAAA,mBAGE,MAAA,SAFI,iBAAJzC,IAAID,EACJ2C,MAAM"}
1
+ {"version":3,"file":"radar.vue.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/components/radar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { EChartsOption, IFormatPublicData } from '../utils/types'\nimport { uniq } from 'lodash-es'\nimport { InjectionChartMerge } from '../utils/injectionKeys'\nimport { useCharts } from '../utils/useCharts'\n\ndefineOptions({\n name: 'DataChartRadar',\n})\n\nconst {\n chartData,\n chartOptions,\n} = defineProps<{\n chartData: IFormatPublicData\n chartOptions: EChartsOption\n}>()\n\nconst dataChartRadar = ref()\nconst merge = inject(InjectionChartMerge, (v: any) => v, true)\nconst radarChartOptions = computed<EChartsOption>(() => {\n const { colDesc, xGroupByDesc, modelName, data } = chartData\n\n if (!xGroupByDesc?.groupByValues) {\n xGroupByDesc.groupByValues = []\n }\n xGroupByDesc.groupByValues = uniq(data.map((item) => {\n return item[xGroupByDesc.colDesc || ''] as string\n }).filter(v => v))\n\n const config = {\n title: {\n text: modelName,\n },\n radar: {\n indicator: xGroupByDesc?.groupByValues?.map((groupByValuesItem) => {\n return {\n name: groupByValuesItem,\n max: Math.max(...data.map(item => Number(item[colDesc[0]]))),\n }\n }) || [],\n },\n series: [{\n name: xGroupByDesc?.colDesc,\n type: 'radar',\n tooltip: {\n trigger: 'item',\n },\n data: colDesc.map(colDescItem => ({\n name: colDescItem,\n value: xGroupByDesc?.groupByValues?.map((groupByValuesItem) => {\n return (data.map((dataItem) => {\n if (groupByValuesItem === dataItem[xGroupByDesc.colDesc || '']) {\n return dataItem[colDescItem]\n }\n return null\n }).filter(v => v)).reduce((pre, cur) => Number(pre || 0) + Number(cur || 0), 0)\n }),\n })),\n }],\n }\n\n return merge(config, chartOptions)\n})\nconst { myChart } = useCharts({ chartDOM: dataChartRadar, chartOptions: radarChartOptions, chartData: computed(() => chartData) })\n\n// 暴露图表实例\ndefineExpose({\n myChart\n})\n</script>\n\n<template>\n <div\n ref=\"dataChartRadar\"\n class=\"data-chart-radar\"\n />\n</template>\n"],"names":["dataChartRadar","ref","merge","inject","InjectionChartMerge","v","radarChartOptions","computed","colDesc","xGroupByDesc","modelName","data","__props","chartData","groupByValues","uniq","map","item","filter","config","title","text","radar","indicator","groupByValuesItem","name","max","Math","Number","series","type","tooltip","trigger","colDescItem","value","dataItem","reduce","pre","cur","chartOptions","myChart","useCharts","chartDOM","__expose","_createElementBlock","class"],"mappings":"2VAkBA,MAAMA,EAAiBC,EAAAA,MACjBC,EAAQC,EAAAA,OAAOC,EAAAA,oBAAsBC,GAAWA,GAAG,GACnDC,EAAoBC,EAAAA,SAAwB,KAChD,MAAMC,QAAEA,EAAAC,aAASA,EAAAC,UAAcA,EAAAC,KAAWA,GAASC,EAAAC,UAE9CJ,GAAcK,gBACjBL,EAAaK,cAAgB,IAE/BL,EAAaK,cAAgBC,EAAAA,KAAKJ,EAAKK,IAAKC,GACnCA,EAAKR,EAAaD,SAAW,KACnCU,OAAOb,GAAKA,IAEf,MAAMc,EAAS,CACbC,MAAO,CACLC,KAAMX,GAERY,MAAO,CACLC,UAAWd,GAAcK,eAAeE,IAAKQ,IACpC,CACLC,KAAMD,EACNE,IAAKC,KAAKD,OAAOf,EAAKK,IAAIC,GAAQW,OAAOX,EAAKT,EAAQ,WAEpD,IAERqB,OAAQ,CAAC,CACPJ,KAAMhB,GAAcD,QACpBsB,KAAM,QACNC,QAAS,CACPC,QAAS,QAEXrB,KAAMH,EAAQQ,IAAIiB,IAAA,CAChBR,KAAMQ,EACNC,MAAOzB,GAAcK,eAAeE,IAAKQ,GAC/Bb,EAAKK,IAAKmB,GACZX,IAAsBW,EAAS1B,EAAaD,SAAW,IAClD2B,EAASF,GAEX,MACNf,UAAYb,GAAI+B,OAAO,CAACC,EAAKC,IAAQV,OAAOS,GAAO,GAAKT,OAAOU,GAAO,GAAI,UAMrF,OAAOpC,EAAMiB,EAAQP,EAAA2B,iBAEjBC,QAAEA,GAAYC,EAAAA,UAAU,CAAEC,SAAU1C,EAAgBuC,aAAcjC,EAAmBO,UAAWN,EAAAA,SAAS,IAAMK,EAAAC,oBAGrH8B,EAAa,CACXH,kCAKAI,EAAAA,mBAGE,MAAA,SAFI,iBAAJ3C,IAAID,EACJ6C,MAAM"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("../utils/injectionKeys.cjs"),a=require("../utils/useCharts.cjs"),r=e.defineComponent({name:"DataChartScatterSimple",__name:"scatter-simple",props:{chartData:{type:Object,required:!0},chartOptions:{type:null,required:!0}},setup(r){const s=e.ref(),c=e.inject(t.InjectionChartMerge,e=>e,!0),i=e.computed(()=>{const{colDesc:e,xGroupByDesc:t,modelName:a,data:s}=r.chartData,i={title:{text:a},tooltip:{formatter:e=>e.value.length>1?`${e.seriesName} :<br/>${e.value[0]} ${e.value[1]} `:`${e.seriesName} :<br/>${e.name} : ${e.value} `},series:e.map(e=>({symbolSize:20,name:e,data:s.map(a=>[a[e],a[t?.colDesc||""]]),type:"scatter"}))};return c(i,r.chartOptions)});return a.useCharts({chartDOM:s,chartOptions:i,chartData:e.computed(()=>r.chartData)}),(t,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dataChartScatterSimple",ref:s,class:"data-chart-scatter-simple"},null,512))}});exports.default=r;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("../utils/injectionKeys.cjs"),a=require("../utils/useCharts.cjs"),r=e.defineComponent({name:"DataChartScatterSimple",__name:"scatter-simple",props:{chartData:{type:Object,required:!0},chartOptions:{type:null,required:!0}},setup(r,{expose:s}){const c=e.ref(),i=e.inject(t.InjectionChartMerge,e=>e,!0),l=e.computed(()=>{const{colDesc:e,xGroupByDesc:t,modelName:a,data:s}=r.chartData,c={title:{text:a},tooltip:{formatter:e=>e.value.length>1?`${e.seriesName} :<br/>${e.value[0]} ${e.value[1]} `:`${e.seriesName} :<br/>${e.name} : ${e.value} `},series:e.map(e=>({symbolSize:20,name:e,data:s.map(a=>[a[e],a[t?.colDesc||""]]),type:"scatter"}))};return i(c,r.chartOptions)}),{myChart:o}=a.useCharts({chartDOM:c,chartOptions:l,chartData:e.computed(()=>r.chartData)});return s({myChart:o}),(t,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dataChartScatterSimple",ref:c,class:"data-chart-scatter-simple"},null,512))}});exports.default=r;
2
2
  //# sourceMappingURL=scatter-simple.vue.cjs.map
@@ -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","_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
+ {"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})\nconst { myChart } = useCharts({ chartDOM: dataChartScatterSimple, chartOptions: scatterChartOptions, chartData: computed(() => chartData) })\n\n// 暴露图表实例\ndefineExpose({\n myChart\n})\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","myChart","useCharts","chartDOM","__expose","_createElementBlock","class"],"mappings":"qVAeA,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,iBAEjBC,QAAEA,GAAYC,EAAAA,UAAU,CAAEC,SAAUjC,EAAwB8B,aAAcxB,EAAqBO,UAAWN,EAAAA,SAAS,IAAMK,EAAAC,oBAG/HqB,EAAa,CACXH,kCAKAI,EAAAA,mBAGE,MAAA,SAFI,yBAAJlC,IAAID,EACJoC,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,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;
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,{expose:s}){const c=e.ref(),i=e.inject(t.InjectionChartMerge,e=>e,!0),n=e.computed(()=>i({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)),{myChart:o}=r.useCharts({chartDOM:c,chartOptions:n,chartData:e.computed(()=>a.chartData)});return s({myChart:o}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dataChartScatter",ref:c,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","_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
+ {"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})\nconst { myChart } = useCharts({ chartDOM: dataChartScatter, chartOptions: scatterChartOptions, chartData: computed(() => chartData) })\n\n// 暴露图表实例\ndefineExpose({\n myChart\n})\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","myChart","useCharts","chartDOM","chartData","__expose","_createElementBlock","class"],"mappings":"wUAiBA,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,gBAEjBC,QAAEA,GAAYC,EAAAA,UAAU,CAAEC,SAAUlB,EAAkBe,aAAcT,EAAqBa,UAAWZ,EAAAA,SAAS,IAAMO,EAAAK,oBAGzHC,EAAa,CACXJ,kCAKAK,EAAAA,mBAGE,MAAA,SAFI,mBAAJpB,IAAID,EACJsB,MAAM"}
@@ -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(()=>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;
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"),f=require("./components/scatter.vue.cjs"),m=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:C}){const x=t.useNamespace("data-chart"),D={analyze:a,config:y,types:j},b={table:m.default,bar:u.default,line:l.default,pie:i.default,radar:p.default,scatter:f.default,funnel:n.default,area:o.default,card:c.default,"scatter-simple":d.default},w=e.useTemplateRef("myChartRef"),S=e.computed(()=>s.cloneDeep(y.defaultChartOption[g.showTypeName])),T=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 C({exportExal:function(){if(0===g.data.data.length)return void console.log("暂无数据");const e=v.useDataToExcelJson(g.data);r.JsonToExcel(g.modelName,e)},QxsDataChartConfig:D,myChartRef:w}),e.provide(h.InjectionChartMerge,function(e,t){let r=s.merge({},S.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(b[t.showTypeName]),{key:t.showTypeName,ref_key:"myChartRef",ref:w,class:e.normalizeClass([e.unref(x).e("wrapper")]),"sub-show-type":t.subShowType,"chart-data":e.unref(T),"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","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,cAElBC,EAAqB,CACzBC,UACAC,SACAC,SAEIC,EAEF,CACFC,MAASC,EAAAA,QACTC,IAAOC,EAAAA,QACPC,KAAQC,EAAAA,QACRC,IAAOC,EAAAA,QACPC,MAASC,EAAAA,QACTC,QAAWC,EAAAA,QACXC,OAAUC,EAAAA,QACVC,KAAQC,EAAAA,QACRC,KAAQC,EAAAA,QACR,iBAAkBC,EAAAA,SAGdC,EAAyBC,EAAAA,SAAS,IAC/BC,YAAUC,EAAAA,mBAAmBC,kBAGhCC,EAAmBJ,EAAAA,SAA4B,KACnD,MAAQK,MAAMC,QAAEA,EAAU,eAAIC,EAAc,IAAO,CAAA,EAACC,KAAGA,EAAO,IAAOL,EAAAK,KAGrE,IAAIC,EAAS,GAETC,EAA4D,KAChED,EAASF,GAAaI,IAAKC,IAQrBA,EAAgBC,QAClBH,EAAeE,GAEVA,IAGT,MAAME,EAAYJ,EAAeF,EAAKO,OAAOC,GAAQA,GAAQA,EAAKN,EAAcJ,UAAaE,EA0B7F,MAboB,CAClBF,QAASA,GAAW,GACpBW,UAAQd,EAAAc,UACRC,YAAUf,EAAAe,YACVR,aAAcA,GAAgB,CAC5BJ,QAAS,GACTC,YAAa,GACbY,cAAe,GACfN,OAAO,GAETN,YAAaE,EACbD,KAAMM,YAgCVM,EAAa,CACXC,WA3BF,WACE,GAA6B,IAAzBlB,OAASK,KAAKc,OAGhB,YADAC,QAAQC,IAAI,QAGd,MAAMC,EAAMC,EAAAA,mBAAmBvB,EAAAK,MAC/BmB,cAAYxB,EAAAc,UAAWQ,EACzB,EAoBElD,uBAEFqD,EAAAA,QAAQC,EAAAA,oBArBR,SAAepD,EAAuBqD,GAEpC,IAAIC,EADaC,EAAAA,MAAY,CAAA,EAAIjC,EAAuBkC,MAAOxD,EAAQqD,IAChD,CAAA,EAEvB,GAAI3B,EAAA+B,cACF,IAEEH,EAAOI,EAAAA,eAAehC,gBAAe4B,EACvC,OACOK,GACLb,QAAQa,MAAM,UAAWA,EAC3B,CAGF,OAAOL,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
+ {"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 myChartRef = useTemplateRef<typeof Bar | typeof Line | typeof Pie | typeof Radar | typeof Scatter | typeof Funnel | typeof Area | typeof Card | typeof ScatterSimple>('myChartRef')\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 myChartRef\n})\nprovide(InjectionChartMerge, merge)\n</script>\n\n<template>\n <component\n :is=\"coms[showTypeName]\"\n :key=\"showTypeName\"\n ref=\"myChartRef\"\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","myChartRef","useTemplateRef","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","ref","class","_normalizeClass","_unref","e","chartOptions"],"mappings":"muCAqDA,MAAMA,EAAKC,EAAAA,aAAa,cAElBC,EAAqB,CACzBC,UACAC,SACAC,SAEIC,EAEF,CACFC,MAASC,EAAAA,QACTC,IAAOC,EAAAA,QACPC,KAAQC,EAAAA,QACRC,IAAOC,EAAAA,QACPC,MAASC,EAAAA,QACTC,QAAWC,EAAAA,QACXC,OAAUC,EAAAA,QACVC,KAAQC,EAAAA,QACRC,KAAQC,EAAAA,QACR,iBAAkBC,EAAAA,SAGdC,EAAaC,EAAAA,eAAyJ,cAEtKC,EAAyBC,EAAAA,SAAS,IAC/BC,YAAUC,EAAAA,mBAAmBC,kBAGhCC,EAAmBJ,EAAAA,SAA4B,KACnD,MAAQK,MAAMC,QAAEA,EAAU,eAAIC,EAAc,IAAO,CAAA,EAACC,KAAGA,EAAO,IAAOL,EAAAK,KAGrE,IAAIC,EAAS,GAETC,EAA4D,KAChED,EAASF,GAAaI,IAAKC,IAQrBA,EAAgBC,QAClBH,EAAeE,GAEVA,IAGT,MAAME,EAAYJ,EAAeF,EAAKO,OAAOC,GAAQA,GAAQA,EAAKN,EAAcJ,UAAaE,EA0B7F,MAboB,CAClBF,QAASA,GAAW,GACpBW,UAAQd,EAAAc,UACRC,YAAUf,EAAAe,YACVR,aAAcA,GAAgB,CAC5BJ,QAAS,GACTC,YAAa,GACbY,cAAe,GACfN,OAAO,GAETN,YAAaE,EACbD,KAAMM,YAgCVM,EAAa,CACXC,WA3BF,WACE,GAA6B,IAAzBlB,OAASK,KAAKc,OAGhB,YADAC,QAAQC,IAAI,QAGd,MAAMC,EAAMC,EAAAA,mBAAmBvB,EAAAK,MAC/BmB,cAAYxB,EAAAc,UAAWQ,EACzB,EAoBEpD,qBACAwB,eAEF+B,EAAAA,QAAQC,EAAAA,oBAtBR,SAAetD,EAAuBuD,GAEpC,IAAIC,EADaC,EAAAA,MAAY,CAAA,EAAIjC,EAAuBkC,MAAO1D,EAAQuD,IAChD,CAAA,EAEvB,GAAI3B,EAAA+B,cACF,IAEEH,EAAOI,EAAAA,eAAehC,gBAAe4B,EACvC,OACOK,GACLb,QAAQa,MAAM,UAAWA,EAC3B,CAGF,OAAOL,CACT,yBAWEM,cAQEC,EAAAA,wBAPK7D,EAAK8D,EAAAA,eAAY,CACrBC,IAAKD,EAAAA,qBACF,aAAJE,IAAI5C,EACH6C,MAAKC,EAAAA,eAAA,CAAGC,EAAAA,MAAAzE,GAAG0E,EAAC,aACZ,gBAAe3B,EAAAA,YACf,aAAY0B,EAAAA,MAAAxC,GACZ,gBAAe0C,EAAAA"}
@@ -1,2 +1,2 @@
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;
1
+ "use strict";var e=require("echarts"),t=require("vue"),a=require("@vueuse/core"),o=require("../components/empty.svg.cjs");function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(a){if("default"!==a){var o=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,o.get?o:{enumerable:!0,get:function(){return e[a]}})}}),t.default=e,Object.freeze(t)}var i=n(e);function r(e,t){const{width:o,height:n}=a.useElementSize(t);a.watchDebounced([o,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:u,chartOptions:s,initBefore:l,initAfter:c}=e;const v=t.ref(null);let d=!1;const f=window.devicePixelRatio||1;function h(){if(v.value&&!v.value.isDisposed()){try{v.value.dispose()}catch(e){console.warn("Error disposing chart:",e)}v.value=null}}function p(){return v.value&&!v.value.isDisposed()||(v.value=i.init(n.value,null,{devicePixelRatio:f,renderer:"svg"})),v.value}function g(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"暂无数据";return new Promise(t=>{const a=new Image;a.src=o.default,a.onload=()=>{const n=a.width/a.height,i={title:[{text:u.value?.modelName,...s.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:o.default}}}}}]};d=!0,t([i,{notMerge:!0,replaceMerge:["xAxis","yAxis","series"],lazyUpdate:!1}])}})}const{isOutside:w}=a.useMouseInElement(n);return a.watchDebounced(w,e=>{"boolean"==typeof e&&v.value&&!v.value.isDisposed()&&function(e){if(v.value&&!v.value.isDisposed())try{v.value.setOption({toolbox:{show:e}})}catch(e){console.warn("Error toggling toolbox:",e)}}(!e)},{debounce:200}),a.watchDebounced(()=>s.value,async()=>{v.value&&!v.value.isDisposed()&&await async function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];try{v.value?.showLoading(),u.value?.data?.length?(!0===d&&(t[1]||(t[1]={}),t[1].notMerge=!0),d=!1):t=await g(),v.value?.setOption(...t)}catch(e){v.value&&!v.value.isDisposed()&&h(),p(),t=await g("配置项错误"),v.value?.setOption(...t)}finally{v.value?.hideLoading()}}(s.value)},{debounce:500,deep:!0,immediate:!0}),t.onMounted(async()=>{l&&await l(),p(),c&&c(v.value),v.value&&!v.value.isDisposed()&&r(v.value,n)}),t.onUnmounted(()=>{if(v.value&&!v.value.isDisposed())try{v.value.getZr()?.off("mousemove"),v.value.getZr()?.off("mouseout"),v.value.getZr()?.off("click"),v.value.off("click"),h()}catch(e){console.warn("Error during chart cleanup:",e)}}),{myChart:v}},exports.useDataToExcelJson=function(e){const{desc:{colDesc:t=[],groupByDesc:a=[]}={},data:o=[]}=e,n=[...a.map(e=>e.colDesc),...t].filter(e=>e),i=o.map(e=>n.map(t=>e[t]||""));return[n,...i]},exports.useResize=r;
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'\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","headerItem"],"mappings":"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"}
1
+ {"version":3,"file":"useCharts.cjs","sources":["../../../../../../../packages/components/src/data-chart/src/utils/useCharts.ts"],"sourcesContent":["import type { SetOptionOpts } from 'echarts'\nimport type { Ref } from 'vue'\nimport type { EChartData, EChartsOption, IFormatPublicData } from './types'\nimport * as echarts from 'echarts'\nimport { onMounted, onUnmounted, ref } from 'vue'\n\n// 定义返回类型,避免导出内部类型\nexport interface UseChartsReturn {\n myChart: Ref<any>\n}\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: any) => void\n}): UseChartsReturn {\n // 每个组件实例的独立状态 - 使用响应式引用\n const myChart = ref<any>(null)\n let isEmpty = false\n\n // 获取设备像素比\n const dpr = window.devicePixelRatio || 1\n\n function disposeChart() {\n if (myChart.value && !myChart.value.isDisposed()) {\n try {\n myChart.value.dispose()\n }\n catch (error) {\n console.warn('Error disposing chart:', error)\n }\n myChart.value = null\n }\n }\n\n function initChart() {\n if (!(myChart.value && !myChart.value.isDisposed())) {\n // 如果实例已被销毁,重新创建\n myChart.value = echarts.init(chartDOM.value, null, {\n devicePixelRatio: dpr,\n renderer: 'svg',\n })\n }\n return myChart.value\n }\n\n async function renderChart(...opt: [EChartsOption, SetOptionOpts?]) {\n try {\n myChart.value?.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.value?.setOption(...opt)\n }\n catch (error) {\n if (myChart.value && !myChart.value.isDisposed()) {\n disposeChart()\n }\n // 如果实例已被销毁,重新创建\n initChart()\n opt = await setEmpty('配置项错误')\n myChart.value?.setOption(...opt)\n } finally {\n myChart.value?.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.value && !myChart.value.isDisposed()) {\n try {\n myChart.value.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.value || myChart.value.isDisposed())) {\n return\n }\n toggleToolbox(!newVal)\n }, { debounce: 200 })\n\n watchDebounced(\n () => chartOptions.value,\n async () => {\n // 修改条件判断\n if (myChart.value && !myChart.value.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 initAfter(myChart.value)\n }\n // 修改条件判断\n if (myChart.value && !myChart.value.isDisposed()) {\n useResize(myChart.value, chartDOM)\n }\n })\n\n onUnmounted(() => {\n if (myChart.value && !myChart.value.isDisposed()) {\n try {\n // 清理所有事件监听器\n myChart.value.getZr()?.off('mousemove')\n myChart.value.getZr()?.off('mouseout')\n myChart.value.getZr()?.off('click')\n myChart.value.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: any, 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","ref","isEmpty","dpr","window","devicePixelRatio","disposeChart","value","dispose","initChart","echarts","init","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","headerItem"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),n=require("../../../node_modules/.pnpm/@iconify_vue@5.0.0_vue@3.5.18_typescript@5.9.2_/node_modules/@iconify/vue/dist/iconify.cjs"),o=require("@qxs-bns/hooks");const r={key:3,"aria-hidden":"true"},t=["xlink:href"];var i=e.defineComponent({name:"QxsIcon",__name:"icon",props:{icon:{type:null,required:!0},runtime:{type:Boolean,required:!1},flip:{type:String,required:!1},rotate:{type:Number,required:!1},color:{type:String,required:!1},size:{type:[String,Number],required:!1}},setup(i){const c=i,u=e.useAttrs(),s=o.useNamespace("icon"),l=e.computed(()=>"object"==typeof c.icon||"function"==typeof c.icon),a=e.computed(()=>l.value?"component":0===c.icon.indexOf("i-")?c.runtime?"svg":"css":c.icon.includes(":")?"svg":"custom"),p=e.computed(()=>{if(l.value)return"";if(0===c.icon.indexOf("i-")){let e=c.icon;return c.runtime&&(e=e.replace("i-","")),e}return c.icon}),f=e.computed(()=>{const e=[];if(""!==c.flip)switch(c.flip){case"horizontal":e.push("rotateY(180deg)");break;case"vertical":e.push("rotateX(180deg)");break;case"both":e.push("rotateX(180deg)"),e.push("rotateY(180deg)")}c.rotate&&e.push(`rotate(${c.rotate%360}deg)`);const{color:n,size:o}=c;return`${n?`color: ${n};`:""}\n ${o?`font-size: ${"number"==typeof o?`${o}px;`:o}`:""}\n ${e.length?`transform: ${e.join(" ")};`:""}`});return(o,i)=>(e.openBlock(),e.createElementBlock("i",{class:e.normalizeClass([e.unref(s).b(),e.unref(s).e("icon-wrap")]),style:e.normalizeStyle(e.unref(f)+e.unref(u).style)},["component"===e.unref(a)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.icon),{key:0})):"css"===e.unref(a)?(e.openBlock(),e.createElementBlock("i",{key:1,class:e.normalizeClass(e.unref(p))},null,2)):"svg"===e.unref(a)?(e.openBlock(),e.createBlock(e.unref(n.Icon),{key:2,icon:e.unref(p)},null,8,["icon"])):(e.openBlock(),e.createElementBlock("svg",r,[e.createElementVNode("use",{"xlink:href":`#icon-${e.unref(p)}`},null,8,t)]))],6))}});exports.default=i;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),o=require("../../../node_modules/.pnpm/@iconify_vue@5.0.0_vue@3.5.18_typescript@5.9.2_/node_modules/@iconify/vue/dist/iconify.cjs"),n=require("@qxs-bns/hooks");const r={key:3,"aria-hidden":"true"},t=["xlink:href"];var i=e.defineComponent({name:"QxsIcon",__name:"icon",props:{icon:{type:null,required:!0},runtime:{type:Boolean,required:!1},flip:{type:String,required:!1},rotate:{type:Number,required:!1},color:{type:String,required:!1},size:{type:[String,Number],required:!1}},setup(i){const c=i,u=e.useAttrs(),s=n.useNamespace("icon"),l=e.computed(()=>"object"==typeof c.icon||"function"==typeof c.icon),a=e.computed(()=>l.value?"component":0===c.icon.indexOf("i-")?c.runtime?"svg":"css":c.icon.includes(":")?"svg":"custom"),p=e.computed(()=>{if(l.value)return"";if(0===c.icon.indexOf("i-")){let e=c.icon;return c.runtime&&(e=e.replace("i-","")),e}return c.icon}),f=e.computed(()=>{const e=[];if(""!==c.flip)switch(c.flip){case"horizontal":e.push("rotateY(180deg)");break;case"vertical":e.push("rotateX(180deg)");break;case"both":e.push("rotateX(180deg)"),e.push("rotateY(180deg)")}c.rotate&&e.push(`rotate(${c.rotate%360}deg)`);const{color:o,size:n}=c;return`${o?`color: ${o};`:""}${n?`font-size: ${r=n,r?"number"==typeof r||/^\d+(\.\d+)?$/.test(r)?`${r}px`:r:""};`:""}${e.length?`transform: ${e.join(" ")};`:""}`;var r});return(n,i)=>(e.openBlock(),e.createElementBlock("i",{class:e.normalizeClass([e.unref(s).b(),e.unref(s).e("icon-wrap")]),style:e.normalizeStyle(e.unref(f)+(e.unref(u).style||""))},["component"===e.unref(a)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.icon),{key:0})):"css"===e.unref(a)?(e.openBlock(),e.createElementBlock("i",{key:1,class:e.normalizeClass(e.unref(p))},null,2)):"svg"===e.unref(a)?(e.openBlock(),e.createBlock(e.unref(o.Icon),{key:2,icon:e.unref(p)},null,8,["icon"])):(e.openBlock(),e.createElementBlock("svg",r,[e.createElementVNode("use",{"xlink:href":`#icon-${e.unref(p)}`},null,8,t)]))],6))}});exports.default=i;
2
2
  //# sourceMappingURL=icon.vue.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"icon.vue.cjs","sources":["../../../../../../packages/components/src/icon/src/icon.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Icon } from '@iconify/vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport type { Component } from 'vue'\n\ndefineOptions({\n name: 'QxsIcon',\n})\n\nconst props = defineProps<PropsType>()\n\nconst attrs = useAttrs()\n\nconst ns = useNamespace('icon')\n\nexport interface PropsType {\n icon: string | Component\n runtime?: boolean\n flip?: 'horizontal' | 'vertical' | 'both' | ''\n rotate?: number\n color?: string\n size?: string | number\n}\n\nconst isComponentName = computed(() => typeof props.icon === 'object' || typeof props.icon === 'function')\n\nconst outputType = computed(() => {\n if (isComponentName.value) {\n return 'component'\n }\n if ((props.icon as string).indexOf('i-') === 0) {\n return props.runtime ? 'svg' : 'css'\n }\n else if ((props.icon as string).includes(':')) {\n return 'svg'\n }\n else {\n return 'custom'\n }\n})\n\nconst outputName = computed(() => {\n if (isComponentName.value) return ''\n if ((props.icon as string).indexOf('i-') === 0) {\n let conversionName = props.icon as string\n if (props.runtime) {\n conversionName = conversionName.replace('i-', '')\n }\n return conversionName\n }\n else {\n return props.icon as string\n }\n})\n\nconst style = computed(() => {\n const transform = [] as string[]\n if (props.flip !== '') {\n switch (props.flip) {\n case 'horizontal':\n transform.push('rotateY(180deg)')\n break\n case 'vertical':\n transform.push('rotateX(180deg)')\n break\n case 'both':\n transform.push('rotateX(180deg)')\n transform.push('rotateY(180deg)')\n break\n }\n }\n if (props.rotate) {\n transform.push(`rotate(${props.rotate % 360}deg)`)\n }\n const { color, size } = props\n return `${color ? `color: ${color};` : ''}\n ${size ? `font-size: ${typeof size === 'number' ? `${size}px;` : size}` : ''}\n ${transform.length ? `transform: ${transform.join(' ')};` : ''}`\n})\n</script>\n\n<template>\n <i\n :class=\"[ns.b(), ns.e('icon-wrap')]\"\n :style=\"style + attrs.style\"\n >\n <component\n v-if=\"outputType === 'component'\"\n :is=\"icon as any\"\n />\n <i\n v-else-if=\"outputType === 'css'\"\n :class=\"outputName\"\n />\n <Icon\n v-else-if=\"outputType === 'svg'\"\n :icon=\"outputName\"\n />\n <svg\n v-else\n aria-hidden=\"true\"\n >\n <use :xlink:href=\"`#icon-${outputName}`\" />\n </svg>\n </i>\n</template>\n"],"names":["props","__props","attrs","useAttrs","ns","useNamespace","isComponentName","computed","icon","outputType","value","indexOf","runtime","includes","outputName","conversionName","replace","style","transform","flip","push","rotate","color","size","length","join","_createElementBlock","class","_unref","b","e","_normalizeStyle","_openBlock","_createBlock","_resolveDynamicComponent","key","Icon","_hoisted_1","_createElementVNode"],"mappings":"8jBASA,MAAMA,EAAQC,EAERC,EAAQC,EAAAA,WAERC,EAAKC,EAAAA,aAAa,QAWlBC,EAAkBC,WAAS,IAA4B,iBAAfP,EAAMQ,MAA2C,mBAAfR,EAAMQ,MAEhFC,EAAaF,EAAAA,SAAS,IACtBD,EAAgBI,MACX,YAEoC,IAAxCV,EAAMQ,KAAgBG,QAAQ,MAC1BX,EAAMY,QAAU,MAAQ,MAEvBZ,EAAMQ,KAAgBK,SAAS,KAChC,MAGA,UAILC,EAAaP,EAAAA,SAAS,KAC1B,GAAID,EAAgBI,MAAO,MAAO,GAClC,GAA6C,IAAxCV,EAAMQ,KAAgBG,QAAQ,MAAa,CAC9C,IAAII,EAAiBf,EAAMQ,KAI3B,OAHIR,EAAMY,UACRG,EAAiBA,EAAeC,QAAQ,KAAM,KAEzCD,CACT,CAEE,OAAOf,EAAMQ,OAIXS,EAAQV,EAAAA,SAAS,KACrB,MAAMW,EAAY,GAClB,GAAmB,KAAflB,EAAMmB,KACR,OAAQnB,EAAMmB,MACZ,IAAK,aACHD,EAAUE,KAAK,mBACf,MACF,IAAK,WACHF,EAAUE,KAAK,mBACf,MACF,IAAK,OACHF,EAAUE,KAAK,mBACfF,EAAUE,KAAK,mBAIjBpB,EAAMqB,QACRH,EAAUE,KAAK,UAAUpB,EAAMqB,OAAS,WAE1C,MAAMC,MAAEA,EAAAC,KAAOA,GAASvB,EACxB,MAAO,GAAGsB,EAAQ,UAAUA,KAAW,iBAC7BC,EAAO,cAA8B,iBAATA,EAAoB,GAAGA,OAAYA,IAAS,iBACxEL,EAAUM,OAAS,cAAcN,EAAUO,KAAK,QAAU,mCAKpEC,EAAAA,mBAsBI,IAAA,CArBDC,wBAAQC,EAAAA,MAAAxB,GAAGyB,IAAKD,EAAAA,MAAAxB,GAAG0B,EAAC,eACpBb,MAAKc,EAAAA,eAAEH,QAAAX,GAAQW,EAAAA,MAAA1B,GAAMe,SAGJ,cAAVW,QAAAnB,IADRuB,EAAAA,YAAAC,cAGEC,EAAAA,wBADK1B,EAAAA,MAAI,CAAA2B,IAAA,KAGY,QAAVP,EAAAA,MAAAnB,kBADbiB,EAAAA,mBAGE,IAAA,OADCC,uBAAOC,EAAAA,MAAAd,cAGa,QAAVc,EAAAA,MAAAnB,kBADbwB,EAAAA,YAGEL,QAAAQ,EAAAA,MAAA,OADC5B,KAAMoB,EAAAA,MAAAd,uBAETkB,EAAAA,YAAAN,EAAAA,mBAKM,MALNW,EAKM,CADJC,EAAAA,mBAA2C,MAAA,CAArC,sBAAqBV,EAAAA,MAAAd"}
1
+ {"version":3,"file":"icon.vue.cjs","sources":["../../../../../../packages/components/src/icon/src/icon.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Icon } from '@iconify/vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport type { Component } from 'vue'\n\ndefineOptions({\n name: 'QxsIcon',\n})\n\nconst props = defineProps<PropsType>()\n\nconst attrs = useAttrs()\n\nconst ns = useNamespace('icon')\n\nexport interface PropsType {\n icon: string | Component\n runtime?: boolean\n flip?: 'horizontal' | 'vertical' | 'both' | ''\n rotate?: number\n color?: string\n size?: string | number\n}\n\nconst isComponentName = computed(() => typeof props.icon === 'object' || typeof props.icon === 'function')\n\nconst outputType = computed(() => {\n if (isComponentName.value) {\n return 'component'\n }\n if ((props.icon as string).indexOf('i-') === 0) {\n return props.runtime ? 'svg' : 'css'\n }\n else if ((props.icon as string).includes(':')) {\n return 'svg'\n }\n else {\n return 'custom'\n }\n})\n\nconst outputName = computed(() => {\n if (isComponentName.value) return ''\n if ((props.icon as string).indexOf('i-') === 0) {\n let conversionName = props.icon as string\n if (props.runtime) {\n conversionName = conversionName.replace('i-', '')\n }\n return conversionName\n }\n else {\n return props.icon as string\n }\n})\n\nconst style = computed(() => {\n const transform = [] as string[]\n if (props.flip !== '') {\n switch (props.flip) {\n case 'horizontal':\n transform.push('rotateY(180deg)')\n break\n case 'vertical':\n transform.push('rotateX(180deg)')\n break\n case 'both':\n transform.push('rotateX(180deg)')\n transform.push('rotateY(180deg)')\n break\n }\n }\n if (props.rotate) {\n transform.push(`rotate(${props.rotate % 360}deg)`)\n }\n const { color, size } = props\n\n // 用正则匹配 size 是不是 number 值,再判断是否有 px 结尾的单位,没有则拼接\n const formatSize = (size: string | number | undefined): string => {\n if (!size) return ''\n\n // 如果是数字,直接添加 px\n if (typeof size === 'number') {\n return `${size}px`\n }\n\n // 如果是纯数字字符串,添加 px\n if (/^\\d+(\\.\\d+)?$/.test(size)) {\n return `${size}px`\n }\n\n // 如果已经有单位(px、em、rem等)或者不是纯数字,直接返回\n return size\n }\n\n return `${color ? `color: ${color};` : ''}${size ? `font-size: ${formatSize(size)};` : ''}${transform.length ? `transform: ${transform.join(' ')};` : ''}`\n})\n</script>\n\n<template>\n <i\n :class=\"[ns.b(), ns.e('icon-wrap')]\"\n :style=\"style + (attrs.style || '')\"\n >\n <component\n v-if=\"outputType === 'component'\"\n :is=\"icon as any\"\n />\n <i\n v-else-if=\"outputType === 'css'\"\n :class=\"outputName\"\n />\n <Icon\n v-else-if=\"outputType === 'svg'\"\n :icon=\"outputName\"\n />\n <svg\n v-else\n aria-hidden=\"true\"\n >\n <use :xlink:href=\"`#icon-${outputName}`\" />\n </svg>\n </i>\n</template>\n"],"names":["props","__props","attrs","useAttrs","ns","useNamespace","isComponentName","computed","icon","outputType","value","indexOf","runtime","includes","outputName","conversionName","replace","style","transform","flip","push","rotate","color","size","test","length","join","_createElementBlock","class","_unref","b","e","_normalizeStyle","_openBlock","_createBlock","_resolveDynamicComponent","key","Icon","_hoisted_1","_createElementVNode"],"mappings":"8jBASA,MAAMA,EAAQC,EAERC,EAAQC,EAAAA,WAERC,EAAKC,EAAAA,aAAa,QAWlBC,EAAkBC,WAAS,IAA4B,iBAAfP,EAAMQ,MAA2C,mBAAfR,EAAMQ,MAEhFC,EAAaF,EAAAA,SAAS,IACtBD,EAAgBI,MACX,YAEoC,IAAxCV,EAAMQ,KAAgBG,QAAQ,MAC1BX,EAAMY,QAAU,MAAQ,MAEvBZ,EAAMQ,KAAgBK,SAAS,KAChC,MAGA,UAILC,EAAaP,EAAAA,SAAS,KAC1B,GAAID,EAAgBI,MAAO,MAAO,GAClC,GAA6C,IAAxCV,EAAMQ,KAAgBG,QAAQ,MAAa,CAC9C,IAAII,EAAiBf,EAAMQ,KAI3B,OAHIR,EAAMY,UACRG,EAAiBA,EAAeC,QAAQ,KAAM,KAEzCD,CACT,CAEE,OAAOf,EAAMQ,OAIXS,EAAQV,EAAAA,SAAS,KACrB,MAAMW,EAAY,GAClB,GAAmB,KAAflB,EAAMmB,KACR,OAAQnB,EAAMmB,MACZ,IAAK,aACHD,EAAUE,KAAK,mBACf,MACF,IAAK,WACHF,EAAUE,KAAK,mBACf,MACF,IAAK,OACHF,EAAUE,KAAK,mBACfF,EAAUE,KAAK,mBAIjBpB,EAAMqB,QACRH,EAAUE,KAAK,UAAUpB,EAAMqB,OAAS,WAE1C,MAAMC,MAAEA,EAAAC,KAAOA,GAASvB,EAoBxB,MAAO,GAAGsB,EAAQ,UAAUA,KAAW,KAAKC,EAAO,cAjB/BA,EAiBwDA,EAhBrEA,EAGe,iBAATA,GAKP,gBAAgBC,KAAKD,GAJhB,GAAGA,MASLA,EAbW,MAgBmE,KAAKL,EAAUO,OAAS,cAAcP,EAAUQ,KAAK,QAAU,KAjBnI,IAACH,gCAsBpBI,EAAAA,mBAsBI,IAAA,CArBDC,wBAAQC,EAAAA,MAAAzB,GAAG0B,IAAKD,EAAAA,MAAAzB,GAAG2B,EAAC,eACpBd,MAAKe,EAAAA,eAAEH,EAAAA,MAAAZ,IAASY,EAAAA,MAAA3B,GAAMe,OAAK,OAGV,cAAVY,QAAApB,IADRwB,EAAAA,YAAAC,cAGEC,EAAAA,wBADK3B,EAAAA,MAAI,CAAA4B,IAAA,KAGY,QAAVP,EAAAA,MAAApB,kBADbkB,EAAAA,mBAGE,IAAA,OADCC,uBAAOC,EAAAA,MAAAf,cAGa,QAAVe,EAAAA,MAAApB,kBADbyB,EAAAA,YAGEL,QAAAQ,EAAAA,MAAA,OADC7B,KAAMqB,EAAAA,MAAAf,uBAETmB,EAAAA,YAAAN,EAAAA,mBAKM,MALNW,EAKM,CADJC,EAAAA,mBAA2C,MAAA,CAArC,sBAAqBV,EAAAA,MAAAf"}
@@ -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/image-viewer/style/index"),require("element-plus/es/components/upload/style/index"),require("element-plus/es/components/icon/style/index");var t=require("vue"),l=require("@element-plus/icons-vue"),i=require("@qxs-bns/icons"),r=require("element-plus");require("element-plus/es/components/message/style/index");const a={class:"image-slot"},s=["src"],n=["onClick"],o=["onClick"],u={class:"tip-content"};var p=t.defineComponent({name:"QxsImageUpload",__name:"image-upload",props:t.mergeModels({action:{type:String,required:!0},headers:{type:null,required:!1},data:{type:null,required:!1},name:{type:String,required:!1,default:"file"},url:{type:String,required:!1},size:{type:Number,required:!1,default:20},width:{type:Number,required:!1,default:160},accept:{type:String,required:!1,default:"image/jpeg,image/jpg,image/png,image/gif"},height:{type:Number,required:!1,default:90},placeholder:{type:String,required:!1,default:"上传图片"},notip:{type:Boolean,required:!1,default:!1},tipText:{type:String,required:!1,default:""},beforeUpload:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:1}},{fileList:{type:Array,default:()=>[]},fileListModifiers:{}}),emits:t.mergeModels(["onSuccess","remove"],["update:fileList"]),setup(p,{emit:d}){const c=d,m=t.useAttrs(),f=t.useModel(p,"fileList"),g=r.useNamespace("image-upload"),v=t.ref(0),h=t.ref({imageViewerVisible:!1,progress:{preview:"",percent:0}}),y=t.computed(()=>g.cssVarBlock({ns:g.namespace.value,width:`${p.width||160}px`,height:`${p.height||90}px`})),q=t.computed(()=>p.accept.split(",").map(e=>e.split("/").pop())),V=t.computed(()=>p.tipText||`上传图片支持 ${q.value.join(" / ")} 格式,且图片大小不超过 ${p.size}MB${p.width&&p.height?`,建议图片尺寸为 ${p.width}*${p.height}`:""}`);function x(e){v.value=f.value.indexOf(e),h.value.imageViewerVisible=!0}function w(e){f.value.splice(f.value.indexOf(e),1)}function C(){h.value.imageViewerVisible=!1}const N=t=>{const l=t.name.split(".").pop()??"",i=q.value.includes(l),r=t.size/1024/1024<p.size;return i?r?(h.value.progress.preview=URL.createObjectURL(t),!p.beforeUpload||p.beforeUpload(t)):(e.ElMessage.error(`上传图片大小不能超过 ${p.size}MB!`),!1):(e.ElMessage.error(`上传图片只支持${q.value.join(" / ")}格式!`),!1)},b=e=>{h.value.progress.percent=Math.floor(e.percent)},_=(...e)=>{h.value.progress={preview:"",percent:0},c("onSuccess",...e)};return(r,p)=>{const d=e.ElIcon,c=e.ElUpload,q=e.ElImageViewer;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(t.unref(g).e("container")),style:t.normalizeStyle(t.unref(y))},[t.createVNode(c,t.mergeProps(t.unref(m),{"file-list":f.value,"onUpdate:fileList":p[0]||(p[0]=e=>f.value=e),drag:"",limit:r.limit,"list-type":"picture-card",headers:r.headers,action:r.action,data:r.data,name:r.name,accept:r.accept,"before-upload":N,"on-progress":b,"on-preview":x,"on-success":_,class:[t.unref(g).e("control"),r.limit<=f.value.length?t.unref(g).e("more-than-limit"):""],"on-remove":w}),{file:t.withCtx(({file:e})=>[t.createElementVNode("img",{class:t.normalizeClass(`${t.unref(g).namespace.value}-upload-list__item-thumbnail`),src:e.url,alt:""},null,10,s),t.createElementVNode("span",{class:t.normalizeClass(`${t.unref(g).namespace.value}-upload-list__item-actions`)},[t.createElementVNode("span",{class:t.normalizeClass(`${t.unref(g).namespace.value}-upload-list__item-preview`),onClick:t=>x(e)},[t.createVNode(d,null,{default:t.withCtx(()=>[t.createVNode(t.unref(i.ZoomIn))]),_:1})],10,n),r.disabled?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(`${t.unref(g).namespace.value}-upload-list__item-delete`),onClick:t=>w(e)},[t.createVNode(d,null,{default:t.withCtx(()=>[t.createVNode(t.unref(l.Delete))]),_:1})],10,o))],2)]),tip:t.withCtx(()=>[t.renderSlot(r.$slots,"tip",{},()=>[r.notip?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(`${t.unref(g).namespace.value}-upload__tip-text`)},[t.createElementVNode("div",u,t.toDisplayString(t.unref(V)),1)],2))])]),default:t.withCtx(()=>[t.renderSlot(r.$slots,"default",{},()=>[t.createElementVNode("div",a,[t.createVNode(d,null,{default:t.withCtx(()=>[t.createVNode(t.unref(l.Plus))]),_:1}),t.createElementVNode("p",null,t.toDisplayString(r.placeholder),1)])])]),_:3},16,["file-list","limit","headers","action","data","name","accept","class"]),t.unref(h).imageViewerVisible?(t.openBlock(),t.createBlock(q,{key:0,"url-list":f.value.map(e=>e.url).filter(e=>void 0!==e),"initial-index":t.unref(v),teleported:"",onClose:C},null,8,["url-list","initial-index"])):t.createCommentVNode("v-if",!0)],6)}}});exports.default=p;
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/image-viewer/style/index"),require("element-plus/es/components/upload/style/index");var t=require("vue"),l=require("@element-plus/icons-vue"),i=require("@qxs-bns/icons"),r=require("element-plus");require("element-plus/es/components/message/style/index");const a={class:"image-slot"},s=["src"],n=["onClick"],o=["onClick"],u={class:"tip-content"};var p=t.defineComponent({name:"QxsImageUpload",__name:"image-upload",props:t.mergeModels({action:{type:String,required:!0},headers:{type:null,required:!1},data:{type:null,required:!1},name:{type:String,required:!1,default:"file"},url:{type:String,required:!1},size:{type:Number,required:!1,default:20},width:{type:Number,required:!1,default:160},accept:{type:String,required:!1,default:"image/jpeg,image/jpg,image/png,image/gif"},height:{type:Number,required:!1,default:90},placeholder:{type:String,required:!1,default:"上传图片"},notip:{type:Boolean,required:!1,default:!1},tipText:{type:String,required:!1,default:""},beforeUpload:{type:null,required:!1},disabled:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:1}},{fileList:{type:Array,default:()=>[]},fileListModifiers:{}}),emits:t.mergeModels(["onSuccess","remove"],["update:fileList"]),setup(p,{emit:d}){const c=d,m=t.useAttrs(),f=t.useModel(p,"fileList"),g=r.useNamespace("image-upload"),v=t.ref(0),y=t.ref({imageViewerVisible:!1,progress:{preview:"",percent:0}}),h=t.computed(()=>g.cssVarBlock({ns:g.namespace.value,width:`${p.width||160}px`,height:`${p.height||90}px`})),q=t.computed(()=>p.accept.split(",").map(e=>e.split("/").pop())),V=t.computed(()=>p.tipText||`上传图片支持 ${q.value.join(" / ")} 格式,且图片大小不超过 ${p.size}MB${p.width&&p.height?`,建议图片尺寸为 ${p.width}*${p.height}`:""}`);function x(e){v.value=f.value.indexOf(e),y.value.imageViewerVisible=!0}function b(e){f.value.splice(f.value.indexOf(e),1)}function w(){y.value.imageViewerVisible=!1}const C=t=>{const l=t.name.split(".").pop()??"",i=q.value.includes(l),r=t.size/1024/1024<p.size;return i?r?(y.value.progress.preview=URL.createObjectURL(t),!p.beforeUpload||p.beforeUpload(t)):(e.ElMessage.error(`上传图片大小不能超过 ${p.size}MB!`),!1):(e.ElMessage.error(`上传图片只支持${q.value.join(" / ")}格式!`),!1)},N=e=>{y.value.progress.percent=Math.floor(e.percent)},k=(...e)=>{y.value.progress={preview:"",percent:0},c("onSuccess",...e)};return(r,p)=>{const d=e.ElUpload,c=e.ElImageViewer;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(t.unref(g).e("container")),style:t.normalizeStyle(t.unref(h))},[t.createVNode(d,t.mergeProps(t.unref(m),{"file-list":f.value,"onUpdate:fileList":p[0]||(p[0]=e=>f.value=e),drag:"",limit:r.limit,"list-type":"picture-card",headers:r.headers,action:r.action,data:r.data,name:r.name,accept:r.accept,"before-upload":C,"on-progress":N,"on-preview":x,"on-success":k,class:[t.unref(g).e("control"),r.limit<=f.value.length?t.unref(g).e("more-than-limit"):""],"on-remove":b}),{file:t.withCtx(({file:e})=>[t.createElementVNode("img",{class:t.normalizeClass(`${t.unref(g).namespace.value}-upload-list__item-thumbnail`),src:e.url,alt:""},null,10,s),t.createElementVNode("span",{class:t.normalizeClass(`${t.unref(g).namespace.value}-upload-list__item-actions`)},[t.createElementVNode("span",{class:t.normalizeClass(`${t.unref(g).namespace.value}-upload-list__item-preview`),onClick:t=>x(e)},[t.createVNode(t.unref(i.ZoomIn))],10,n),r.disabled?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(`${t.unref(g).namespace.value}-upload-list__item-delete`),onClick:t=>b(e)},[t.createVNode(t.unref(i.Delete))],10,o))],2)]),tip:t.withCtx(()=>[t.renderSlot(r.$slots,"tip",{},()=>[r.notip?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(`${t.unref(g).namespace.value}-upload__tip-text`)},[t.createElementVNode("div",u,t.toDisplayString(t.unref(V)),1)],2))])]),default:t.withCtx(()=>[t.renderSlot(r.$slots,"default",{},()=>[t.createElementVNode("div",a,[t.createVNode(t.unref(l.Plus)),t.createElementVNode("p",null,t.toDisplayString(r.placeholder),1)])])]),_:3},16,["file-list","limit","headers","action","data","name","accept","class"]),t.unref(y).imageViewerVisible?(t.openBlock(),t.createBlock(c,{key:0,"url-list":f.value.map(e=>e.url).filter(e=>void 0!==e),"initial-index":t.unref(v),teleported:"",onClose:w},null,8,["url-list","initial-index"])):t.createCommentVNode("v-if",!0)],6)}}});exports.default=p;
2
2
  //# sourceMappingURL=image-upload.vue.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"image-upload.vue.cjs","sources":["../../../../../../packages/components/src/image-upload/src/image-upload.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { UploadFile, UploadFiles, UploadProps } from 'element-plus'\nimport { Delete, Plus } from '@element-plus/icons-vue'\nimport { ZoomIn } from '@qxs-bns/icons'\nimport { useNamespace } from 'element-plus'\n\n// 组件名称\ndefineOptions({\n name: 'QxsImageUpload',\n})\n\n// Props 定义\nconst {\n name = 'file',\n size = 20,\n width = 160,\n height = 90,\n limit = 1,\n placeholder = '上传图片',\n notip = false,\n accept = 'image/jpeg,image/jpg,image/png,image/gif',\n beforeUpload,\n tipText = '',\n disabled = false,\n} = defineProps<ImageUploadProps>()\n\n// Emits 定义\nconst emits = defineEmits<{\n onSuccess: [res: any, uploadFile: UploadFile, uploadFiles: UploadFiles]\n remove: [file: UploadFile]\n}>()\n\n// 类型定义\nexport interface ImageUploadProps {\n action: UploadProps['action']\n headers?: UploadProps['headers']\n data?: UploadProps['data']\n name?: UploadProps['name']\n url?: string\n size?: number\n width?: number\n accept?: string\n height?: number\n placeholder?: string\n notip?: boolean\n tipText?: string\n beforeUpload?: UploadProps['beforeUpload']\n disabled?: boolean\n limit?: number\n}\n\ninterface UploadProgress {\n preview: string\n percent: number\n}\n\nconst attrs = useAttrs()\n\nconst fileList = defineModel('fileList', {\n type: Array as () => UploadFile[],\n default: () => [],\n})\n\n// 命名空间\nconst nsEl = useNamespace('image-upload')\n\nconst initialIndex = ref(0)\n// 响应式数据\nconst uploadData = ref<{\n imageViewerVisible: boolean\n progress: UploadProgress\n}>({\n imageViewerVisible: false,\n progress: {\n preview: '',\n percent: 0,\n },\n})\n\nconst cssVar = computed(() => {\n return nsEl.cssVarBlock({\n ns: nsEl.namespace.value,\n width: `${width || 160}px`,\n height: `${height || 90}px`,\n })\n})\n\n// 计算属性\nconst exts = computed(() =>\n accept.split(',').map(ext => ext.split('/').pop()),\n)\n\nconst tipMessage = computed(\n () =>\n tipText\n || `上传图片支持 ${exts.value.join(\n ' / ',\n )} 格式,且图片大小不超过 ${size}MB${width && height ? `,建议图片尺寸为 ${width}*${height}` : ''}`,\n)\n\n// 方法\nfunction onPreview(file: UploadFile) {\n initialIndex.value = fileList.value.indexOf(file)\n uploadData.value.imageViewerVisible = true\n}\nfunction onRemove(file: UploadFile) {\n fileList.value.splice(fileList.value.indexOf(file), 1)\n}\n\nfunction previewClose() {\n uploadData.value.imageViewerVisible = false\n}\n\nconst handleBeforeUpload: UploadProps['beforeUpload'] = (file) => {\n const fileExt = file.name.split('.').pop() ?? ''\n const isTypeOk = exts.value.includes(fileExt)\n const isSizeOk = file.size / 1024 / 1024 < size\n\n if (!isTypeOk) {\n ElMessage.error(`上传图片只支持${exts.value.join(' / ')}格式!`)\n return false\n }\n\n if (!isSizeOk) {\n ElMessage.error(`上传图片大小不能超过 ${size}MB!`)\n return false\n }\n\n uploadData.value.progress.preview = URL.createObjectURL(file)\n\n return beforeUpload ? beforeUpload(file) : true\n}\n\nconst onProgress: UploadProps['onProgress'] = (evt) => {\n uploadData.value.progress.percent = Math.floor(evt.percent)\n}\n\nconst onSuccess: UploadProps['onSuccess'] = (...args) => {\n uploadData.value.progress = {\n preview: '',\n percent: 0,\n }\n emits('onSuccess', ...args)\n}\n</script>\n\n<template>\n <div\n :class=\"nsEl.e('container')\"\n :style=\"cssVar\"\n >\n <el-upload\n v-bind=\"attrs\"\n v-model:file-list=\"fileList\"\n drag\n :limit=\"limit\"\n list-type=\"picture-card\"\n :headers=\"headers\"\n :action=\"action\"\n :data=\"data\"\n :name=\"name\"\n :accept=\"accept\"\n :before-upload=\"handleBeforeUpload\"\n :on-progress=\"onProgress\"\n :on-preview=\"onPreview\"\n :on-success=\"onSuccess\"\n :class=\"[nsEl.e('control'), limit <= fileList.length ? nsEl.e('more-than-limit') : '']\"\n :on-remove=\"onRemove\"\n >\n <slot>\n <div class=\"image-slot\">\n <el-icon><Plus /></el-icon>\n <p>{{ placeholder }}</p>\n </div>\n </slot>\n <template #file=\"{ file }\">\n <img\n :class=\"`${nsEl.namespace.value}-upload-list__item-thumbnail`\"\n :src=\"file.url\"\n alt=\"\"\n >\n <span :class=\"`${nsEl.namespace.value}-upload-list__item-actions`\">\n <span\n :class=\"`${nsEl.namespace.value}-upload-list__item-preview`\"\n @click=\"onPreview(file)\"\n >\n <el-icon><ZoomIn /></el-icon>\n </span>\n <span\n v-if=\"!disabled\"\n :class=\"`${nsEl.namespace.value}-upload-list__item-delete`\"\n @click=\"onRemove(file)\"\n >\n <el-icon><Delete /></el-icon>\n </span>\n </span>\n </template>\n <template #tip>\n <slot name=\"tip\">\n <div\n v-if=\"!notip\"\n :class=\"`${nsEl.namespace.value}-upload__tip-text`\"\n >\n <div class=\"tip-content\">\n {{ tipMessage }}\n </div>\n </div>\n </slot>\n </template>\n </el-upload>\n\n <el-image-viewer\n v-if=\"uploadData.imageViewerVisible\"\n :url-list=\"fileList.map((item: UploadFile) => item.url).filter((v: string | undefined) => v !== undefined)\"\n :initial-index=\"initialIndex\"\n teleported\n @close=\"previewClose\"\n />\n </div>\n</template>\n"],"names":["emits","__emit","attrs","useAttrs","fileList","_useModel","__props","nsEl","useNamespace","initialIndex","ref","uploadData","imageViewerVisible","progress","preview","percent","cssVar","computed","cssVarBlock","ns","namespace","value","width","height","exts","split","map","ext","pop","tipMessage","tipText","join","size","onPreview","file","indexOf","onRemove","splice","previewClose","handleBeforeUpload","fileExt","name","isTypeOk","includes","isSizeOk","URL","createObjectURL","beforeUpload","ElMessage","error","onProgress","evt","Math","floor","onSuccess","args","_createElementBlock","class","_normalizeClass","_unref","e","style","_createVNode","_component_el_upload","_mergeProps","$event","drag","limit","headers","action","data","accept","length","_withCtx","_createElementVNode","src","url","alt","onClick","_component_el_icon","ZoomIn","disabled","Delete","tip","_renderSlot","_ctx","notip","_hoisted_5","_toDisplayString","_hoisted_1","Plus","placeholder","_createBlock","_component_el_image_viewer","item","filter","v","teleported","onClose"],"mappings":"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"}
1
+ {"version":3,"file":"image-upload.vue.cjs","sources":["../../../../../../packages/components/src/image-upload/src/image-upload.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { UploadFile, UploadFiles, UploadProps } from 'element-plus'\nimport { Plus } from '@element-plus/icons-vue'\nimport { ZoomIn, Delete } from '@qxs-bns/icons'\nimport { useNamespace } from 'element-plus'\n\n// 组件名称\ndefineOptions({\n name: 'QxsImageUpload',\n})\n\n// Props 定义\nconst {\n name = 'file',\n size = 20,\n width = 160,\n height = 90,\n limit = 1,\n placeholder = '上传图片',\n notip = false,\n accept = 'image/jpeg,image/jpg,image/png,image/gif',\n beforeUpload,\n tipText = '',\n disabled = false,\n} = defineProps<ImageUploadProps>()\n\n// Emits 定义\nconst emits = defineEmits<{\n onSuccess: [res: any, uploadFile: UploadFile, uploadFiles: UploadFiles]\n remove: [file: UploadFile]\n}>()\n\n// 类型定义\nexport interface ImageUploadProps {\n action: UploadProps['action']\n headers?: UploadProps['headers']\n data?: UploadProps['data']\n name?: UploadProps['name']\n url?: string\n size?: number\n width?: number\n accept?: string\n height?: number\n placeholder?: string\n notip?: boolean\n tipText?: string\n beforeUpload?: UploadProps['beforeUpload']\n disabled?: boolean\n limit?: number\n}\n\ninterface UploadProgress {\n preview: string\n percent: number\n}\n\nconst attrs = useAttrs()\n\nconst fileList = defineModel('fileList', {\n type: Array as () => UploadFile[],\n default: () => [],\n})\n\n// 命名空间\nconst nsEl = useNamespace('image-upload')\n\nconst initialIndex = ref(0)\n// 响应式数据\nconst uploadData = ref<{\n imageViewerVisible: boolean\n progress: UploadProgress\n}>({\n imageViewerVisible: false,\n progress: {\n preview: '',\n percent: 0,\n },\n})\n\nconst cssVar = computed(() => {\n return nsEl.cssVarBlock({\n ns: nsEl.namespace.value,\n width: `${width || 160}px`,\n height: `${height || 90}px`,\n })\n})\n\n// 计算属性\nconst exts = computed(() =>\n accept.split(',').map(ext => ext.split('/').pop()),\n)\n\nconst tipMessage = computed(\n () =>\n tipText\n || `上传图片支持 ${exts.value.join(\n ' / ',\n )} 格式,且图片大小不超过 ${size}MB${width && height ? `,建议图片尺寸为 ${width}*${height}` : ''}`,\n)\n\n// 方法\nfunction onPreview(file: UploadFile) {\n initialIndex.value = fileList.value.indexOf(file)\n uploadData.value.imageViewerVisible = true\n}\nfunction onRemove(file: UploadFile) {\n fileList.value.splice(fileList.value.indexOf(file), 1)\n}\n\nfunction previewClose() {\n uploadData.value.imageViewerVisible = false\n}\n\nconst handleBeforeUpload: UploadProps['beforeUpload'] = (file) => {\n const fileExt = file.name.split('.').pop() ?? ''\n const isTypeOk = exts.value.includes(fileExt)\n const isSizeOk = file.size / 1024 / 1024 < size\n\n if (!isTypeOk) {\n ElMessage.error(`上传图片只支持${exts.value.join(' / ')}格式!`)\n return false\n }\n\n if (!isSizeOk) {\n ElMessage.error(`上传图片大小不能超过 ${size}MB!`)\n return false\n }\n\n uploadData.value.progress.preview = URL.createObjectURL(file)\n\n return beforeUpload ? beforeUpload(file) : true\n}\n\nconst onProgress: UploadProps['onProgress'] = (evt) => {\n uploadData.value.progress.percent = Math.floor(evt.percent)\n}\n\nconst onSuccess: UploadProps['onSuccess'] = (...args) => {\n uploadData.value.progress = {\n preview: '',\n percent: 0,\n }\n emits('onSuccess', ...args)\n}\n</script>\n\n<template>\n <div\n :class=\"nsEl.e('container')\"\n :style=\"cssVar\"\n >\n <el-upload\n v-bind=\"attrs\"\n v-model:file-list=\"fileList\"\n drag\n :limit=\"limit\"\n list-type=\"picture-card\"\n :headers=\"headers\"\n :action=\"action\"\n :data=\"data\"\n :name=\"name\"\n :accept=\"accept\"\n :before-upload=\"handleBeforeUpload\"\n :on-progress=\"onProgress\"\n :on-preview=\"onPreview\"\n :on-success=\"onSuccess\"\n :class=\"[nsEl.e('control'), limit <= fileList.length ? nsEl.e('more-than-limit') : '']\"\n :on-remove=\"onRemove\"\n >\n <slot>\n <div class=\"image-slot\">\n <Plus />\n <p>{{ placeholder }}</p>\n </div>\n </slot>\n <template #file=\"{ file }\">\n <img\n :class=\"`${nsEl.namespace.value}-upload-list__item-thumbnail`\"\n :src=\"file.url\"\n alt=\"\"\n >\n <span :class=\"`${nsEl.namespace.value}-upload-list__item-actions`\">\n <span\n :class=\"`${nsEl.namespace.value}-upload-list__item-preview`\"\n @click=\"onPreview(file)\"\n >\n <ZoomIn />\n </span>\n <span\n v-if=\"!disabled\"\n :class=\"`${nsEl.namespace.value}-upload-list__item-delete`\"\n @click=\"onRemove(file)\"\n >\n <Delete />\n </span>\n </span>\n </template>\n <template #tip>\n <slot name=\"tip\">\n <div\n v-if=\"!notip\"\n :class=\"`${nsEl.namespace.value}-upload__tip-text`\"\n >\n <div class=\"tip-content\">\n {{ tipMessage }}\n </div>\n </div>\n </slot>\n </template>\n </el-upload>\n\n <el-image-viewer\n v-if=\"uploadData.imageViewerVisible\"\n :url-list=\"fileList.map((item: UploadFile) => item.url).filter((v: string | undefined) => v !== undefined)\"\n :initial-index=\"initialIndex\"\n teleported\n @close=\"previewClose\"\n />\n </div>\n</template>\n"],"names":["emits","__emit","attrs","useAttrs","fileList","_useModel","__props","nsEl","useNamespace","initialIndex","ref","uploadData","imageViewerVisible","progress","preview","percent","cssVar","computed","cssVarBlock","ns","namespace","value","width","height","exts","split","map","ext","pop","tipMessage","tipText","join","size","onPreview","file","indexOf","onRemove","splice","previewClose","handleBeforeUpload","fileExt","name","isTypeOk","includes","isSizeOk","URL","createObjectURL","beforeUpload","ElMessage","error","onProgress","evt","Math","floor","onSuccess","args","_createElementBlock","class","_normalizeClass","_unref","e","style","_createVNode","_component_el_upload","_mergeProps","$event","drag","limit","headers","action","data","accept","length","_withCtx","_createElementVNode","src","url","alt","onClick","ZoomIn","disabled","Delete","tip","_renderSlot","_ctx","notip","_hoisted_5","_toDisplayString","_hoisted_1","Plus","placeholder","_createBlock","_component_el_image_viewer","item","filter","v","teleported","onClose"],"mappings":"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"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qxs-bns/components",
3
3
  "type": "module",
4
- "version": "0.0.60",
4
+ "version": "0.0.62",
5
5
  "description": "Vue 3 Component Library",
6
6
  "license": "MIT",
7
7
  "homepage": "https://trry-hub.github.io/qxs-bns/",
@@ -45,7 +45,7 @@
45
45
  "@iconify/vue": "^5.0.0",
46
46
  "@qxs-bns/directives": "0.0.19",
47
47
  "@qxs-bns/hooks": "0.0.5",
48
- "@qxs-bns/icons": "0.0.3",
48
+ "@qxs-bns/icons": "0.0.5",
49
49
  "@qxs-bns/utils": "0.0.26",
50
50
  "@vueuse/core": "^11.3.0",
51
51
  "echarts": "^5.5.1",
@@ -1 +1 @@
1
- :root [data-fixed-calc-width]{position:fixed;right:0;left:0%}:root [data-mode=mobile] [data-fixed-calc-width]{width:100% !important}.qxs-data-chart__table{box-sizing:border-box;display:flex;flex-direction:column}.qxs-data-chart__table .title{display:flex;align-items:center;justify-content:space-between;padding:0 5px;margin-top:2px;margin-bottom:7px;font-family:sans-serif;font-size:14px;font-weight:bolder;color:#464646}.qxs-data-chart__table>div[class*=-table]{position:relative;display:flex;flex:1;flex-direction:column;overflow:hidden;background-color:rgba(0,0,0,0);border-top-left-radius:4px;border-top-right-radius:4px}.qxs-data-chart__table>div[class*=-table] [class*=-table__body-wrapper] [class*=-table__cell]{border-right:0}.qxs-data-chart__table>div[class*=-table] [class*=-table__body-wrapper] [class$=table__empty-text]{line-height:unset}.qxs-data-chart__empty{display:flex;align-items:center;justify-content:center;height:100%}.qxs-data-chart__empty-content{display:flex;flex-direction:column;align-items:center;pointer-events:none;margin-top:-2px}.qxs-data-chart__empty-description{font-size:14px;color:#74767e;margin-left:1px}.qxs-data-chart__wrapper{height:100%}.qxs-fixed-action-bar__actionbar{bottom:0;z-index:10;padding:var(--qxs-fixed-action-bar-actionbar-padding);padding-bottom:calc(env(safe-area-inset-bottom) + var(--qxs-fixed-action-bar-actionbar-padding-bottom));text-align:center;background-color:var(--qxs-bg-color, #fff);box-shadow:0 0 1px 0 var(--qxs-border-color, #f3f3f2);transition:box-shadow .3s,var(--qxs-transition-box-shadow, #f3f3f2)}.qxs-fixed-action-bar__actionbar.is-shadow{box-shadow:0 0 1px 0 var(--qxs-border-color, #f3f3f2)}.qxs-photo-crop-tool__img-box{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:100%;overflow:hidden;background-color:#fafafa}.qxs-photo-crop-tool__error-message{color:red}.qxs-photo-crop-tool__image{max-width:100%;max-height:100%;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;user-select:none;-o-object-fit:contain;object-fit:contain;-webkit-user-drag:none}.qxs-photo-crop-tool__crop-tool-box{position:absolute;width:calc(var(--qxs-photo-crop-tool-width)*1px);max-width:100%;height:calc(var(--qxs-photo-crop-tool-height)*1px);max-height:100%;aspect-ratio:var(--qxs-photo-crop-tool-aspect-ratio);overflow:hidden;cursor:move;border:1px dashed #fff;box-shadow:0 0 0 9999px rgba(0,0,0,.4)}.qxs-photo-crop-tool__crop-tool-box>div{position:absolute;z-index:3;width:30%;aspect-ratio:1/1;background-color:rgba(2,2,2,.01);border-radius:50%;transition:all .3s}.qxs-photo-crop-tool__crop-tool-box>div:after{content:"";position:absolute;width:10px;height:10px;top:50%;left:50%;transform:translate3d(-50%, -50%, 0);border-radius:50%;background-color:var(--qxs-color-primary, #3d61e3)}.qxs-photo-crop-tool__crop-tool-box>div:hover,.qxs-photo-crop-tool__crop-tool-box>div:active{background-color:rgba(2,2,2,.5)}.qxs-photo-crop-tool__top-left{top:0;left:0;cursor:nwse-resize;transform:translate3d(-50%, -50%, 0)}.qxs-photo-crop-tool__top-right{top:0;right:0;cursor:nesw-resize;transform:translate3d(50%, -50%, 0)}.qxs-photo-crop-tool__bottom-right{right:0;bottom:0;cursor:nwse-resize;transform:translate3d(50%, 50%, 0)}.qxs-photo-crop-tool__bottom-left{bottom:0;left:0;cursor:nesw-resize;transform:translate3d(-50%, 50%, 0)}.el-image-upload__container{line-height:initial}.el-image-upload__control>.el-upload-list--picture-card .el-upload-list__item{width:var(--el-image-upload-width);height:var(--el-image-upload-height)}.el-image-upload__control>.el-upload-list--picture-card .el-upload-list__item [role=progressbar]{width:calc(min(var(--el-image-upload-width),var(--el-image-upload-height))/4*3) !important}.el-image-upload__control>.el-upload-list--picture-card .el-upload-list__item [role=progressbar] .el-progress-circle{width:calc(min(var(--el-image-upload-width),var(--el-image-upload-height))/4*3) !important;height:calc(min(var(--el-image-upload-width),var(--el-image-upload-height))/4*3) !important}.el-image-upload__control>.el-upload-list--picture-card .is-drag{width:var(--el-image-upload-width);height:var(--el-image-upload-height)}.el-image-upload__control>.el-upload-list--picture-card .is-drag .el-upload-dragger{border:unset;background-color:unset;width:100%;height:100%;display:flex;justify-content:center;align-items:center}.el-image-upload__control>.el-upload-list--picture-card .is-drag .el-upload-dragger .image-slot [class$=-icon]{font-size:28px;margin-bottom:10px}.el-image-upload__more-than-limit .is-drag{display:none}.el-image-upload__container .el-upload__tip-text{font-size:14px;line-height:32px;color:#c8c8c8}.qxs-file-upload__control .is-drag{display:inline-block !important}.qxs-file-upload__control .is-drag [class$=-upload-dragger]{padding:0}.qxs-file-upload__control .is-drag [class$=-upload-dragger] [class$=-icon--upload]{margin-bottom:0;font-size:40px}.qxs-file-upload__control .is-drag [class$=-upload-dragger] [class$=-upload__text]{padding:0 6px;font-size:14px;line-height:1.5}.qxs-file-upload__control .is-drag.is-dragover{border-width:1px}.qxs-file-upload__control .is-drag .slot{width:160px;height:90px}.qxs-tiny-mce-editor__tiny-mce .tox-tinymce{border-width:1px;border-radius:var(--qxs-border-radius-base, 4px)}.qxs-tiny-mce-editor__tiny-mce .tox-tinymce:not(.tox-tinymce-inline) .tox-editor-header{box-shadow:0 2px 2px -2px rgba(34,47,62,.1),0 4px 4px -4px rgba(34,47,62,.07)}.qxs-tiny-mce-editor__tiny-mce .tox-tinymce .tox-sidebar-wrap{overflow-y:auto}.qxs-tiny-mce-editor__tiny-mce .tox-tinymce .tox-sidebar-wrap .tox-edit-area::before{border-width:1px;border-radius:0}.qxs-tiny-mce-editor .tox-tinymce-aux{z-index:2500 !important}.qxs-subject-list__list-exam .flex{display:flex;align-items:center}.qxs-subject-list__list-exam .flex-items-center{display:flex;align-items:center}.qxs-subject-list__list-exam .flex-justify-between{display:flex;justify-content:space-between}.qxs-subject-list__list-exam .flex-justify-center{display:flex;justify-content:center}.qxs-subject-list__list-exam .flex-justify-end{display:flex;justify-content:flex-end}.qxs-subject-list__list-exam .margin-left-10{margin-left:10px}.qxs-subject-list__list-exam .label{min-width:50px}.qxs-subject-list__list-exam .flex-1{flex:1}.qxs-subject-list__list-exam .subject-list-wrapper{width:100%;margin-bottom:20px}.qxs-subject-list__list-exam .margin-bottom{margin-bottom:20px}.qxs-subject-list__list-exam .auto-line{flex:1;height:1px;margin:0 15px;background-color:#c8c8c8}.qxs-subject-list__list-exam .title{font-size:14px;font-weight:500}.qxs-subject-list__list-exam .rich-text img{max-width:100%}.qxs-subject-single__single-exam .preview-answer{display:flex;flex-direction:column;margin-bottom:10px}.qxs-subject-single__single-exam .flex{display:flex;align-items:center}.qxs-subject-single__single-exam .margin-bottom{margin-bottom:20px}.qxs-subject-single__single-exam .answer-list .answer-item{margin-top:15px}.qxs-subject-single__single-exam .answer-list .answer-item .input{width:300px}.qxs-subject-single__single-exam .answer-list .answer-item .input [class$=-input]{font-weight:bold}.qxs-subject-single__single-exam .answer-list .answer-item .correct{margin:0 10px}.qxs-subject-single__single-exam .answer-list .answer-item .correct:hover{color:#3d61e3;cursor:pointer}.qxs-subject-single__single-exam .answer-list .answer-item .is-correct{color:#67c23a}.qxs-subject-single__single-exam .answer-list .answer-item .icon{margin-left:10px;font-size:18px;color:#a3a3a3;cursor:pointer}.qxs-subject-single__single-exam .answer-list .answer-item .disabled{color:#c0c4cc;cursor:not-allowed}.qxs-subject-single__single-exam .preview .answer-radio{padding-left:10px}.qxs-subject-single__single-exam .preview .answer-radio .radio{margin-top:10px}.qxs-subject-blank-fill__blank-fill-exam .flex{display:flex;align-items:center}.qxs-subject-blank-fill__blank-fill-exam .label{min-width:50px;margin-right:10px}.qxs-subject-blank-fill__blank-fill-exam .margin-bottom{margin-bottom:20px}.qxs-subject-blank-fill__blank-fill-exam .answer-list .answer-item{width:100%;margin-top:15px}.qxs-subject-blank-fill__blank-fill-exam .answer-list .answer-item .answer-tags{flex:1;padding:5px 15px;border:1px solid #eee;border-radius:4px}.qxs-subject-blank-fill__blank-fill-exam .answer-list .answer-item .answer-tags [class$=-tag]{margin-right:10px}.qxs-subject-blank-fill__blank-fill-exam .preview .content{min-height:100px;padding-top:10px;background-color:#fff}.qxs-subject-text-fill__text-fill-exam .flex{display:flex;align-items:center}.qxs-subject-text-fill__text-fill-exam .label{min-width:50px;margin-right:10px}.qxs-subject-text-fill__text-fill-exam .margin-bottom{margin-bottom:20px}.qxs-subject-text-fill__text-fill-exam .answer-list .answer-item{width:100%;margin-top:15px}.qxs-subject-text-fill__text-fill-exam .answer-list .answer-item .answer-tags{flex:1;padding:5px 15px;border:1px solid #eee;border-radius:4px}.qxs-subject-text-fill__text-fill-exam .answer-list .answer-item .operation .icon{margin-left:10px;font-size:16px;color:#a3a3a3;cursor:pointer}.qxs-subject-text-fill__text-fill-exam .answer-list .answer-item .operation .disabled{color:#c0c4cc;cursor:not-allowed}.qxs-subject-text-fill__text-fill-exam .preview .content{min-height:100px;margin-top:10px}.qxs-subject-scale__scale-exam .flex{display:flex;align-items:center}.qxs-subject-scale__scale-exam .label{min-width:50px}.qxs-subject-scale__scale-exam .margin-bottom{margin-bottom:20px}.qxs-subject-scale__scale-exam .answer{margin:20px 0}.qxs-subject-scale__scale-exam .answer .answer-list{margin-left:40px}.qxs-subject-scale__scale-exam .answer .answer-list .answer-item{margin-bottom:20px}.qxs-subject-scale__scale-exam .answer .answer-list .answer-item .order{width:16px;margin-right:10px}.qxs-subject-scale__scale-exam .answer .answer-list .answer-item .icon{margin-left:10px;font-size:16px;color:#a3a3a3;cursor:pointer}.qxs-subject-scale__scale-exam .answer .answer-list .answer-item .disabled{color:#c0c4cc;cursor:not-allowed}.qxs-subject-scale__scale-exam .preview .answer-radio .radio-item .qxs-radio-wrapper{margin-inline-end:0}.qxs-subject-layout__layout-exam{padding:10px;font-size:12px;color:#5a5a5a}.qxs-subject-layout__layout-exam .edit{position:relative;padding:20px 10px;padding-bottom:10px;margin-top:20px;background-color:#f6f7fb}.qxs-subject-layout__layout-exam .edit .triangle-up{position:absolute;top:-20px;left:100px;width:0;height:0;border-right:20px solid rgba(0,0,0,0);border-bottom:20px solid #f6f7fb;border-left:20px solid rgba(0,0,0,0)}.qxs-subject-action__action-exam .action{padding:20px 0}.qxs-subject-action__action-exam .active{padding-right:10px;padding-left:10px;background-color:#f6f7fb}.qxs-subject-action__action-exam .btn-margin{margin-right:10px}.qxs-subject-action__action-exam .has-set{display:flex;align-items:center;font-size:12px;color:#bbb}.qxs-subject-action__action-exam .vertical-radio-group{display:flex;flex-direction:column;align-items:flex-start;margin-left:20px}.qxs-subject-action__action-exam .vertical-radio-group ::v-deep(.qxs-radio){display:block;margin-right:0}.qxs-subject-type__type-list .type-item{margin-bottom:20px}.qxs-subject-type__type-list .base-subject{display:flex;flex-wrap:wrap;align-items:center}.qxs-subject-type__type-list .base-subject .item{width:50px;height:22px;margin-top:10px;margin-right:10px;font-size:14px;color:#5a5a5a;text-align:center;cursor:pointer;background:#fafafa}.qxs-subject-type__type-list .base-subject .item:hover{color:#3d61e3;background:rgba(61,97,227,.12)}.qxs-icon{position:relative;display:inline-flex;align-items:center;justify-content:center;width:1em;height:1em;font-size:1em;line-height:1em;vertical-align:-2px;color:currentColor;fill:currentColor}.qxs-icon__icon-wrap svg{width:100%;height:100%}.qxs-icon__icon-wrap svg *{fill:currentColor}.qxs-icon__icon-wrap svg [fill=none]{fill:none}
1
+ :root [data-fixed-calc-width]{position:fixed;right:0;left:0%}:root [data-mode=mobile] [data-fixed-calc-width]{width:100% !important}.qxs-data-chart__table{box-sizing:border-box;display:flex;flex-direction:column}.qxs-data-chart__table .title{display:flex;align-items:center;justify-content:space-between;padding:0 5px;margin-top:2px;margin-bottom:7px;font-family:sans-serif;font-size:14px;font-weight:bolder;color:#464646}.qxs-data-chart__table>div[class*=-table]{position:relative;display:flex;flex:1;flex-direction:column;overflow:hidden;background-color:rgba(0,0,0,0);border-top-left-radius:4px;border-top-right-radius:4px}.qxs-data-chart__table>div[class*=-table] [class*=-table__body-wrapper] [class*=-table__cell]{border-right:0}.qxs-data-chart__table>div[class*=-table] [class*=-table__body-wrapper] [class$=table__empty-text]{line-height:unset}.qxs-data-chart__empty{display:flex;align-items:center;justify-content:center;height:100%}.qxs-data-chart__empty-content{display:flex;flex-direction:column;align-items:center;pointer-events:none;margin-top:-2px}.qxs-data-chart__empty-description{font-size:14px;color:#74767e;margin-left:1px}.qxs-data-chart__wrapper{height:100%}.qxs-fixed-action-bar__actionbar{bottom:0;z-index:10;padding:var(--qxs-fixed-action-bar-actionbar-padding);padding-bottom:calc(env(safe-area-inset-bottom) + var(--qxs-fixed-action-bar-actionbar-padding-bottom));text-align:center;background-color:var(--qxs-bg-color, #fff);box-shadow:0 0 1px 0 var(--qxs-border-color, #f3f3f2);transition:box-shadow .3s,var(--qxs-transition-box-shadow, #f3f3f2)}.qxs-fixed-action-bar__actionbar.is-shadow{box-shadow:0 0 1px 0 var(--qxs-border-color, #f3f3f2)}.qxs-photo-crop-tool__img-box{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:100%;overflow:hidden;background-color:#fafafa}.qxs-photo-crop-tool__error-message{color:red}.qxs-photo-crop-tool__image{max-width:100%;max-height:100%;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;user-select:none;-o-object-fit:contain;object-fit:contain;-webkit-user-drag:none}.qxs-photo-crop-tool__crop-tool-box{position:absolute;width:calc(var(--qxs-photo-crop-tool-width)*1px);max-width:100%;height:calc(var(--qxs-photo-crop-tool-height)*1px);max-height:100%;aspect-ratio:var(--qxs-photo-crop-tool-aspect-ratio);overflow:hidden;cursor:move;border:1px dashed #fff;box-shadow:0 0 0 9999px rgba(0,0,0,.4)}.qxs-photo-crop-tool__crop-tool-box>div{position:absolute;z-index:3;width:30%;aspect-ratio:1/1;background-color:rgba(2,2,2,.01);border-radius:50%;transition:all .3s}.qxs-photo-crop-tool__crop-tool-box>div:after{content:"";position:absolute;width:10px;height:10px;top:50%;left:50%;transform:translate3d(-50%, -50%, 0);border-radius:50%;background-color:var(--qxs-color-primary, #3d61e3)}.qxs-photo-crop-tool__crop-tool-box>div:hover,.qxs-photo-crop-tool__crop-tool-box>div:active{background-color:rgba(2,2,2,.5)}.qxs-photo-crop-tool__top-left{top:0;left:0;cursor:nwse-resize;transform:translate3d(-50%, -50%, 0)}.qxs-photo-crop-tool__top-right{top:0;right:0;cursor:nesw-resize;transform:translate3d(50%, -50%, 0)}.qxs-photo-crop-tool__bottom-right{right:0;bottom:0;cursor:nwse-resize;transform:translate3d(50%, 50%, 0)}.qxs-photo-crop-tool__bottom-left{bottom:0;left:0;cursor:nesw-resize;transform:translate3d(-50%, 50%, 0)}.el-image-upload__container{line-height:initial}.el-image-upload__control>.el-upload-list--picture-card .el-upload-list__item{width:var(--el-image-upload-width);height:var(--el-image-upload-height)}.el-image-upload__control>.el-upload-list--picture-card .el-upload-list__item [role=progressbar]{width:calc(min(var(--el-image-upload-width),var(--el-image-upload-height))/4*3) !important}.el-image-upload__control>.el-upload-list--picture-card .el-upload-list__item [role=progressbar] .el-progress-circle{width:calc(min(var(--el-image-upload-width),var(--el-image-upload-height))/4*3) !important;height:calc(min(var(--el-image-upload-width),var(--el-image-upload-height))/4*3) !important}.el-image-upload__control>.el-upload-list--picture-card .is-drag{width:var(--el-image-upload-width);height:var(--el-image-upload-height)}.el-image-upload__control>.el-upload-list--picture-card .is-drag .el-upload-dragger{border:unset;background-color:unset;width:100%;height:100%;display:flex;justify-content:center;align-items:center}.el-image-upload__control>.el-upload-list--picture-card .is-drag .el-upload-dragger .image-slot [class$=-icon]{font-size:28px;margin-bottom:10px}.el-image-upload__more-than-limit .is-drag{display:none}.el-image-upload__container .el-upload__tip-text{font-size:14px;line-height:32px;color:#c8c8c8}.qxs-file-upload__control .is-drag{display:inline-block !important}.qxs-file-upload__control .is-drag [class$=-upload-dragger]{padding:0}.qxs-file-upload__control .is-drag [class$=-upload-dragger] [class$=-icon--upload]{margin-bottom:0;font-size:40px}.qxs-file-upload__control .is-drag [class$=-upload-dragger] [class$=-upload__text]{padding:0 6px;font-size:14px;line-height:1.5}.qxs-file-upload__control .is-drag.is-dragover{border-width:1px}.qxs-file-upload__control .is-drag .slot{width:160px;height:90px}.qxs-tiny-mce-editor__tiny-mce .tox-tinymce{border-width:1px;border-radius:var(--qxs-border-radius-base, 4px)}.qxs-tiny-mce-editor__tiny-mce .tox-tinymce:not(.tox-tinymce-inline) .tox-editor-header{box-shadow:0 2px 2px -2px rgba(34,47,62,.1),0 4px 4px -4px rgba(34,47,62,.07)}.qxs-tiny-mce-editor__tiny-mce .tox-tinymce .tox-sidebar-wrap{overflow-y:auto}.qxs-tiny-mce-editor__tiny-mce .tox-tinymce .tox-sidebar-wrap .tox-edit-area::before{border-width:1px;border-radius:0}.qxs-tiny-mce-editor .tox-tinymce-aux{z-index:2500 !important}.qxs-subject-list__list-exam .flex{display:flex;align-items:center}.qxs-subject-list__list-exam .flex-items-center{display:flex;align-items:center}.qxs-subject-list__list-exam .flex-justify-between{display:flex;justify-content:space-between}.qxs-subject-list__list-exam .flex-justify-center{display:flex;justify-content:center}.qxs-subject-list__list-exam .flex-justify-end{display:flex;justify-content:flex-end}.qxs-subject-list__list-exam .margin-left-10{margin-left:10px}.qxs-subject-list__list-exam .label{min-width:50px}.qxs-subject-list__list-exam .flex-1{flex:1}.qxs-subject-list__list-exam .subject-list-wrapper{width:100%;margin-bottom:20px}.qxs-subject-list__list-exam .margin-bottom{margin-bottom:20px}.qxs-subject-list__list-exam .auto-line{flex:1;height:1px;margin:0 15px;background-color:#c8c8c8}.qxs-subject-list__list-exam .title{font-size:14px;font-weight:500}.qxs-subject-list__list-exam .rich-text img{max-width:100%}.qxs-subject-single__single-exam .preview-answer{display:flex;flex-direction:column;margin-bottom:10px}.qxs-subject-single__single-exam .flex{display:flex;align-items:center}.qxs-subject-single__single-exam .margin-bottom{margin-bottom:20px}.qxs-subject-single__single-exam .answer-list .answer-item{margin-top:15px}.qxs-subject-single__single-exam .answer-list .answer-item .input{width:300px}.qxs-subject-single__single-exam .answer-list .answer-item .input [class$=-input]{font-weight:bold}.qxs-subject-single__single-exam .answer-list .answer-item .correct{margin:0 10px}.qxs-subject-single__single-exam .answer-list .answer-item .correct:hover{color:#3d61e3;cursor:pointer}.qxs-subject-single__single-exam .answer-list .answer-item .is-correct{color:#67c23a}.qxs-subject-single__single-exam .answer-list .answer-item .icon{margin-left:10px;font-size:18px;color:#a3a3a3;cursor:pointer}.qxs-subject-single__single-exam .answer-list .answer-item .disabled{color:#c0c4cc;cursor:not-allowed}.qxs-subject-single__single-exam .preview .answer-radio{padding-left:10px}.qxs-subject-single__single-exam .preview .answer-radio .radio{margin-top:10px}.qxs-subject-blank-fill__blank-fill-exam .flex{display:flex;align-items:center}.qxs-subject-blank-fill__blank-fill-exam .label{min-width:50px;margin-right:10px}.qxs-subject-blank-fill__blank-fill-exam .margin-bottom{margin-bottom:20px}.qxs-subject-blank-fill__blank-fill-exam .answer-list .answer-item{width:100%;margin-top:15px}.qxs-subject-blank-fill__blank-fill-exam .answer-list .answer-item .answer-tags{flex:1;padding:5px 15px;border:1px solid #eee;border-radius:4px}.qxs-subject-blank-fill__blank-fill-exam .answer-list .answer-item .answer-tags [class$=-tag]{margin-right:10px}.qxs-subject-blank-fill__blank-fill-exam .preview .content{min-height:100px;padding-top:10px;background-color:#fff}.qxs-subject-text-fill__text-fill-exam .flex{display:flex;align-items:center}.qxs-subject-text-fill__text-fill-exam .label{min-width:50px;margin-right:10px}.qxs-subject-text-fill__text-fill-exam .margin-bottom{margin-bottom:20px}.qxs-subject-text-fill__text-fill-exam .answer-list .answer-item{width:100%;margin-top:15px}.qxs-subject-text-fill__text-fill-exam .answer-list .answer-item .answer-tags{flex:1;padding:5px 15px;border:1px solid #eee;border-radius:4px}.qxs-subject-text-fill__text-fill-exam .answer-list .answer-item .operation .icon{margin-left:10px;font-size:16px;color:#a3a3a3;cursor:pointer}.qxs-subject-text-fill__text-fill-exam .answer-list .answer-item .operation .disabled{color:#c0c4cc;cursor:not-allowed}.qxs-subject-text-fill__text-fill-exam .preview .content{min-height:100px;margin-top:10px}.qxs-subject-scale__scale-exam .flex{display:flex;align-items:center}.qxs-subject-scale__scale-exam .label{min-width:50px}.qxs-subject-scale__scale-exam .margin-bottom{margin-bottom:20px}.qxs-subject-scale__scale-exam .answer{margin:20px 0}.qxs-subject-scale__scale-exam .answer .answer-list{margin-left:40px}.qxs-subject-scale__scale-exam .answer .answer-list .answer-item{margin-bottom:20px}.qxs-subject-scale__scale-exam .answer .answer-list .answer-item .order{width:16px;margin-right:10px}.qxs-subject-scale__scale-exam .answer .answer-list .answer-item .icon{margin-left:10px;font-size:16px;color:#a3a3a3;cursor:pointer}.qxs-subject-scale__scale-exam .answer .answer-list .answer-item .disabled{color:#c0c4cc;cursor:not-allowed}.qxs-subject-scale__scale-exam .preview .answer-radio .radio-item .qxs-radio-wrapper{margin-inline-end:0}.qxs-subject-layout__layout-exam{padding:10px;font-size:12px;color:#5a5a5a}.qxs-subject-layout__layout-exam .edit{position:relative;padding:20px 10px;padding-bottom:10px;margin-top:20px;background-color:#f6f7fb}.qxs-subject-layout__layout-exam .edit .triangle-up{position:absolute;top:-20px;left:100px;width:0;height:0;border-right:20px solid rgba(0,0,0,0);border-bottom:20px solid #f6f7fb;border-left:20px solid rgba(0,0,0,0)}.qxs-subject-action__action-exam .action{padding:20px 0}.qxs-subject-action__action-exam .active{padding-right:10px;padding-left:10px;background-color:#f6f7fb}.qxs-subject-action__action-exam .btn-margin{margin-right:10px}.qxs-subject-action__action-exam .has-set{display:flex;align-items:center;font-size:12px;color:#bbb}.qxs-subject-action__action-exam .vertical-radio-group{display:flex;flex-direction:column;align-items:flex-start;margin-left:20px}.qxs-subject-action__action-exam .vertical-radio-group ::v-deep(.qxs-radio){display:block;margin-right:0}.qxs-subject-type__type-list .type-item{margin-bottom:20px}.qxs-subject-type__type-list .base-subject{display:flex;flex-wrap:wrap;align-items:center}.qxs-subject-type__type-list .base-subject .item{width:50px;height:22px;margin-top:10px;margin-right:10px;font-size:14px;color:#5a5a5a;text-align:center;cursor:pointer;background:#fafafa}.qxs-subject-type__type-list .base-subject .item:hover{color:#3d61e3;background:rgba(61,97,227,.12)}.qxs-icon{position:relative;display:inline-flex;align-items:center;justify-content:center;width:1em;height:1em;line-height:1em;vertical-align:-2px;color:currentColor;fill:currentColor}.qxs-icon__icon-wrap svg{width:1em !important;height:1em !important;display:block}.qxs-icon__icon-wrap svg *{fill:currentColor !important}.qxs-icon__icon-wrap svg [fill=none]{fill:none !important}
@@ -1 +1 @@
1
- .qxs-icon{position:relative;display:inline-flex;align-items:center;justify-content:center;width:1em;height:1em;font-size:1em;line-height:1em;vertical-align:-2px;color:currentColor;fill:currentColor}.qxs-icon__icon-wrap svg{width:100%;height:100%}.qxs-icon__icon-wrap svg *{fill:currentColor}.qxs-icon__icon-wrap svg [fill=none]{fill:none}
1
+ .qxs-icon{position:relative;display:inline-flex;align-items:center;justify-content:center;width:1em;height:1em;line-height:1em;vertical-align:-2px;color:currentColor;fill:currentColor}.qxs-icon__icon-wrap svg{width:1em !important;height:1em !important;display:block}.qxs-icon__icon-wrap svg *{fill:currentColor !important}.qxs-icon__icon-wrap svg [fill=none]{fill:none !important}
@@ -7,21 +7,22 @@
7
7
  justify-content: center;
8
8
  width: 1em;
9
9
  height: 1em;
10
- font-size: 1em;
11
10
  line-height: 1em;
12
11
  vertical-align: -2px;
13
12
  color: currentColor;
14
13
  fill: currentColor;
14
+
15
15
  @include e(icon-wrap) {
16
16
  svg {
17
- width: 100%;
18
- height: 100%;
17
+ width: 1em !important;
18
+ height: 1em !important;
19
+ display: block;
19
20
  }
20
21
  svg * {
21
- fill: currentColor;
22
+ fill: currentColor !important;
22
23
  }
23
24
  svg [fill="none"] {
24
- fill: none;
25
+ fill: none !important;
25
26
  }
26
27
  }
27
28
  }