types.d.ts 3.4 KB

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