types.d.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. import { Node } from "@antv/x6";
  2. import { BorderSize, StructureType, TopicBorderType, TopicType } from "@/enum";
  3. import { topicData } from "@/config/data";
  4. export interface CompoundedComponent {
  5. name: string;
  6. icon: string;
  7. node: Node.Metadata;
  8. }
  9. export interface LaneItem {
  10. width: number;
  11. name: string;
  12. }
  13. export interface StageItem {
  14. height: number;
  15. name: string;
  16. }
  17. export interface cellStyle {
  18. opacity: number;
  19. text: {
  20. fontFamily: string;
  21. color: string;
  22. fontSize: number;
  23. lineHeight: number;
  24. textAlign: "left" | "center" | "right";
  25. textVAlign: "top" | "middle" | "bottom";
  26. bold: boolean;
  27. italic: boolean;
  28. textDecoration: "underline" | "line-through" | "none";
  29. };
  30. fill: {
  31. fillType: "color" | "gradient" | "image";
  32. color1: string;
  33. color2: string;
  34. gradientType: "linear" | "radial";
  35. gradientValue: number;
  36. objectFit: ImageFillType;
  37. imageUrl: string;
  38. };
  39. stroke: {
  40. type: "solid" | "dashed" | "dotted" | "dashdot";
  41. color: string;
  42. width: number;
  43. };
  44. }
  45. export interface HierarchyResult {
  46. id: string;
  47. x: number;
  48. y: number;
  49. data: TopicItem;
  50. width: number;
  51. height: number;
  52. children: HierarchyResult[];
  53. totalHeight: number;
  54. totalWidth: number;
  55. direction?: string;
  56. }
  57. export type TopicItem = {
  58. /**
  59. * 主键
  60. */
  61. id: string;
  62. /**
  63. * 主题内容
  64. */
  65. label: string;
  66. /**
  67. * 宽
  68. */
  69. width: number;
  70. /**
  71. * 高
  72. */
  73. height: number;
  74. /**
  75. * 主题类型 main:中心主题 branch:分支主题 sub:子主题
  76. */
  77. type: TopicType;
  78. /**
  79. * 是否固定宽度
  80. */
  81. fixedWidth: boolean;
  82. /**
  83. * 扩展模块
  84. */
  85. extraModules?: {
  86. type: "image" | "code";
  87. data:
  88. | {
  89. code: string;
  90. language: string;
  91. }
  92. | {
  93. imageUrl: string;
  94. width: number;
  95. height: number;
  96. };
  97. };
  98. /**
  99. * 图标
  100. */
  101. icons?: string[];
  102. /**
  103. * 标签
  104. */
  105. tags?: { name: string; color: string }[];
  106. /**
  107. * 备注
  108. */
  109. remark?: string;
  110. /**
  111. * 链接
  112. */
  113. href?: {
  114. title: string;
  115. value: string;
  116. };
  117. /**
  118. * 父级节点
  119. */
  120. parentId?: string;
  121. /**
  122. * 位置x
  123. */
  124. x?: number;
  125. /**
  126. * 位置y
  127. */
  128. y?: number;
  129. /**
  130. * 子节点
  131. */
  132. children?: TopicItem[];
  133. /**
  134. * 连线
  135. */
  136. edge?: {
  137. color: string;
  138. width: number;
  139. };
  140. /**
  141. * 折叠子节点
  142. */
  143. collapsed?: boolean;
  144. /**
  145. * 边框圆角
  146. */
  147. borderSize: BorderSize;
  148. /**
  149. * 关联线
  150. */
  151. links?: any[];
  152. /**
  153. * 主题链接
  154. */
  155. linkTopicId?: string;
  156. /**
  157. * 外框
  158. */
  159. border?: {
  160. line: {
  161. width: number;
  162. style: "solid" | "dashed";
  163. color: string;
  164. };
  165. fill: string;
  166. type: TopicBorderType;
  167. label: string;
  168. };
  169. /**
  170. * 概要
  171. */
  172. isSummary?: boolean;
  173. summarySource?: string;
  174. summary?: {
  175. topic: TopicItem;
  176. range: [];
  177. border: {
  178. line: {
  179. width: number;
  180. color: string;
  181. };
  182. type: TopicBorderType;
  183. };
  184. };
  185. } & cellStyle;
  186. export interface MindMapProjectInfo {
  187. name: string;
  188. desc: string;
  189. version: string;
  190. author: string;
  191. theme: string;
  192. structure: StructureType;
  193. pageSetting: {
  194. backgroundType: "color" | "image";
  195. backgroundColor: string;
  196. backgroundImage: string;
  197. branchY: number;
  198. branchX: number;
  199. subTopicY: number;
  200. subTopicX: number;
  201. alignSameTopic: boolean;
  202. showWatermark: boolean;
  203. watermarkText: string;
  204. };
  205. topics: any[];
  206. }