category.d.ts 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. import { IList } from '../interfaces';
  2. import { CategoryLegendCfg, ListItem } from '../types';
  3. import LegendBase from './base';
  4. declare class Category extends LegendBase<CategoryLegendCfg> implements IList {
  5. private currentPageIndex;
  6. private totalPagesCnt;
  7. private pageWidth;
  8. private pageHeight;
  9. private startX;
  10. private startY;
  11. getDefaultCfg(): {
  12. name: string;
  13. type: string;
  14. itemSpacing: number;
  15. itemMarginBottom: number;
  16. maxItemWidth: any;
  17. itemWidth: any;
  18. itemHeight: any;
  19. itemName: {};
  20. itemValue: any;
  21. maxWidth: any;
  22. maxHeight: any;
  23. marker: {};
  24. radio: any;
  25. items: any[];
  26. itemStates: {};
  27. itemBackground: {};
  28. pageNavigator: {};
  29. defaultCfg: {
  30. title: {
  31. spacing: number;
  32. style: {
  33. fill: string;
  34. fontSize: number;
  35. textAlign: string;
  36. textBaseline: string;
  37. };
  38. };
  39. background: {
  40. padding: number;
  41. style: {
  42. stroke: string;
  43. };
  44. };
  45. itemBackground: {
  46. style: {
  47. opacity: number;
  48. fill: string;
  49. };
  50. };
  51. pageNavigator: {
  52. marker: {
  53. style: {
  54. inactiveFill: string;
  55. inactiveOpacity: number;
  56. fill: string;
  57. opacity: number;
  58. size: number;
  59. };
  60. };
  61. text: {
  62. style: {
  63. fill: string;
  64. fontSize: number;
  65. };
  66. };
  67. };
  68. itemName: {
  69. spacing: number;
  70. style: {
  71. fill: string;
  72. fontSize: number;
  73. textAlign: string;
  74. textBaseline: string;
  75. fontFamily: string;
  76. fontWeight: string;
  77. lineHeight: number;
  78. };
  79. };
  80. marker: {
  81. spacing: number;
  82. style: {
  83. r: number;
  84. symbol: string;
  85. };
  86. };
  87. itemValue: {
  88. alignRight: boolean;
  89. formatter: any;
  90. style: {
  91. fill: string;
  92. fontSize: number;
  93. textAlign: string;
  94. textBaseline: string;
  95. fontFamily: string;
  96. fontWeight: string;
  97. lineHeight: number;
  98. };
  99. spacing: number;
  100. };
  101. itemStates: {
  102. active: {
  103. nameStyle: {
  104. opacity: number;
  105. };
  106. };
  107. unchecked: {
  108. nameStyle: {
  109. fill: string;
  110. };
  111. markerStyle: {
  112. fill: string;
  113. stroke: string;
  114. };
  115. };
  116. inactive: {
  117. nameStyle: {
  118. fill: string;
  119. };
  120. markerStyle: {
  121. opacity: number;
  122. };
  123. };
  124. };
  125. };
  126. layout: string;
  127. locationType: string;
  128. x: number;
  129. y: number;
  130. offsetX: number;
  131. offsetY: number;
  132. title: any;
  133. background: any;
  134. container: any;
  135. shapesMap: {};
  136. group: any;
  137. capture: boolean;
  138. isRegister: boolean;
  139. isUpdating: boolean;
  140. isInit: boolean;
  141. id: string;
  142. animate: boolean;
  143. updateAutoRender: boolean;
  144. animateOption: {
  145. appear: any;
  146. update: {
  147. duration: number;
  148. easing: string;
  149. };
  150. enter: {
  151. duration: number;
  152. easing: string;
  153. };
  154. leave: {
  155. duration: number;
  156. easing: string;
  157. };
  158. };
  159. events: any;
  160. visible: boolean;
  161. };
  162. isList(): boolean;
  163. /**
  164. * 获取图例项
  165. * @return {ListItem[]} 列表项集合
  166. */
  167. getItems(): ListItem[];
  168. /**
  169. * 设置列表项
  170. * @param {ListItem[]} items 列表项集合
  171. */
  172. setItems(items: ListItem[]): void;
  173. /**
  174. * 更新列表项
  175. * @param {ListItem} item 列表项
  176. * @param {object} cfg 列表项
  177. */
  178. updateItem(item: ListItem, cfg: object): void;
  179. /**
  180. * 清空列表
  181. */
  182. clearItems(): void;
  183. /**
  184. * 设置列表项的状态
  185. * @param {ListItem} item 列表项
  186. * @param {string} state 状态名
  187. * @param {boolean} value 状态值, true, false
  188. */
  189. setItemState(item: ListItem, state: string, value: boolean): void;
  190. /**
  191. * 是否存在指定的状态
  192. * @param {ListItem} item 列表项
  193. * @param {boolean} state 状态名
  194. */
  195. hasState(item: ListItem, state: string): boolean;
  196. getItemStates(item: ListItem): string[];
  197. /**
  198. * 清楚所有列表项的状态
  199. * @param {string} state 状态值
  200. */
  201. clearItemsState(state: string): void;
  202. /**
  203. * 根据状态获取图例项
  204. * @param {string} state [description]
  205. * @return {ListItem[]} [description]
  206. */
  207. getItemsByState(state: string): ListItem[];
  208. protected drawLegendContent(group: any): void;
  209. private processItems;
  210. private drawItems;
  211. private getItemHeight;
  212. private drawMarker;
  213. private drawItemText;
  214. private drawRadio;
  215. private drawItem;
  216. private adjustNavigation;
  217. /**
  218. * 绘制分页器
  219. */
  220. private drawNavigation;
  221. private updateNavigation;
  222. private drawArrow;
  223. /**
  224. * 更新分页器 arrow 组件
  225. */
  226. private updateArrowPath;
  227. private getCurrentNavigationMatrix;
  228. private onNavigationBack;
  229. private onNavigationAfter;
  230. private applyItemStates;
  231. private getLimitItemWidth;
  232. }
  233. export default Category;