compSetting.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * 组件库配置文件
  3. */
  4. import { h } from 'vue';
  5. import { CompTypeEnum } from "@/enum/compTypeEnum";
  6. import compIcon from "@/assets/comp-icon/index";
  7. import {
  8. AppstoreAddOutlined,
  9. FileTextOutlined,
  10. PieChartOutlined,
  11. PlaySquareOutlined,
  12. } from "@ant-design/icons-vue";
  13. export interface CompItem {
  14. // 名称
  15. name: string;
  16. // 渲染组件
  17. componetName: string;
  18. // 图标
  19. icon: string;
  20. }
  21. export interface CompGroup {
  22. // 名称
  23. name: string;
  24. // 子组件
  25. children: CompItem[];
  26. }
  27. export interface CompCategory {
  28. // 类型
  29. type: CompTypeEnum;
  30. // 名称
  31. name: string;
  32. // 图标
  33. icon: () => any;
  34. // 是否是组
  35. isGroup?: boolean;
  36. // 组件
  37. children?: CompGroup[] | CompItem[];
  38. }
  39. interface CompSetting {
  40. // 组件列表
  41. compList: CompCategory[];
  42. }
  43. /**
  44. * 组件库配置文件
  45. * */
  46. export const compSetting: CompSetting = {
  47. compList: [
  48. {
  49. type: CompTypeEnum.CHART,
  50. name: '图表',
  51. icon: () => h(PieChartOutlined),
  52. isGroup: true,
  53. children: [
  54. {
  55. name: '柱状图类',
  56. children: [
  57. {
  58. name: '柱状图',
  59. componetName: 'BasicBar',
  60. icon: compIcon['icon-1']
  61. }
  62. ]
  63. },
  64. {
  65. name: '折线图类',
  66. children: [
  67. {
  68. name: '折线图',
  69. componetName: 'BasicLine',
  70. icon: compIcon['icon-2']
  71. }
  72. ]
  73. },
  74. {
  75. name: '饼状图类',
  76. children: [
  77. {
  78. name: '饼状图',
  79. componetName: 'BasicPie',
  80. icon: compIcon['icon-4']
  81. }
  82. ]
  83. }
  84. ]
  85. },
  86. {
  87. type: CompTypeEnum.TEXT,
  88. name: '文本',
  89. icon: () => h(FileTextOutlined),
  90. isGroup: false,
  91. children: [
  92. {
  93. name: '标题',
  94. componetName: 'Title',
  95. icon: compIcon['icon-3']
  96. },
  97. ]
  98. },
  99. {
  100. type: CompTypeEnum.MEDIA,
  101. name: '媒体',
  102. icon: () => h(PlaySquareOutlined),
  103. isGroup: false,
  104. },
  105. {
  106. type: CompTypeEnum.INPUT_COMP,
  107. name: '控件',
  108. icon: () => h(AppstoreAddOutlined),
  109. isGroup: false,
  110. }
  111. ]
  112. }