ac24429fa3fb42578ca787c26dc80c848d5370d5c0288b480cbf955e03e24b59dca12c4743bda6c86f65ab278ab88414e8d1d9e750967fa036ed917e0e8482 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import ComponentModel from '../../model/Component.js';
  2. import Calendar from './Calendar.js';
  3. import { ComponentOption, BoxLayoutOptionMixin, LayoutOrient, LineStyleOption, ItemStyleOption, LabelOption, OptionDataValueDate } from '../../util/types.js';
  4. import GlobalModel from '../../model/Global.js';
  5. import Model from '../../model/Model.js';
  6. export interface CalendarMonthLabelFormatterCallbackParams {
  7. nameMap: string;
  8. yyyy: string;
  9. yy: string;
  10. /**
  11. * Month string. With 0 prefix.
  12. */
  13. MM: string;
  14. /**
  15. * Month number
  16. */
  17. M: number;
  18. }
  19. export interface CalendarYearLabelFormatterCallbackParams {
  20. nameMap: string;
  21. /**
  22. * Start year
  23. */
  24. start: string;
  25. /**
  26. * End year
  27. */
  28. end: string;
  29. }
  30. export interface CalendarOption extends ComponentOption, BoxLayoutOptionMixin {
  31. mainType?: 'calendar';
  32. cellSize?: number | 'auto' | (number | 'auto')[];
  33. orient?: LayoutOrient;
  34. splitLine?: {
  35. show?: boolean;
  36. lineStyle?: LineStyleOption;
  37. };
  38. itemStyle?: ItemStyleOption;
  39. /**
  40. * // one year
  41. * range: 2017
  42. * // one month
  43. * range: '2017-02'
  44. * // a range
  45. * range: ['2017-01-02', '2017-02-23']
  46. * // note: they will be identified as ['2017-01-01', '2017-02-01']
  47. * range: ['2017-01', '2017-02']
  48. */
  49. range?: OptionDataValueDate | (OptionDataValueDate)[];
  50. dayLabel?: Omit<LabelOption, 'position'> & {
  51. /**
  52. * First day of week.
  53. */
  54. firstDay?: number;
  55. /**
  56. * Margin between day label and axis line.
  57. * Can be percent string of cell size.
  58. */
  59. margin?: number | string;
  60. /**
  61. * Position of week, at the beginning or end of the range.
  62. */
  63. position?: 'start' | 'end';
  64. /**
  65. * Week text content
  66. *
  67. * defaults to auto-detected locale by the browser or the specified locale by `echarts.init` function.
  68. * It supports any registered locale name (case-sensitive) or customized array.
  69. * index 0 always means Sunday.
  70. */
  71. nameMap?: string | string[];
  72. };
  73. monthLabel?: Omit<LabelOption, 'position'> & {
  74. /**
  75. * Margin between month label and axis line.
  76. */
  77. margin?: number;
  78. /**
  79. * Position of month label, at the beginning or end of the range.
  80. */
  81. position?: 'start' | 'end';
  82. /**
  83. * Month text content
  84. *
  85. * defaults to auto-detected locale by the browser or the specified locale by `echarts.init` function.
  86. * It supports any registered locale name (case-sensitive) or customized array.
  87. * index 0 always means Jan.
  88. */
  89. nameMap?: string | string[];
  90. formatter?: string | ((params: CalendarMonthLabelFormatterCallbackParams) => string);
  91. };
  92. yearLabel?: Omit<LabelOption, 'position'> & {
  93. /**
  94. * Margin between year label and axis line.
  95. */
  96. margin?: number;
  97. /**
  98. * Position of year label, at the beginning or end of the range.
  99. */
  100. position?: 'top' | 'bottom' | 'left' | 'right';
  101. formatter?: string | ((params: CalendarYearLabelFormatterCallbackParams) => string);
  102. };
  103. }
  104. declare class CalendarModel extends ComponentModel<CalendarOption> {
  105. static type: string;
  106. type: string;
  107. coordinateSystem: Calendar;
  108. /**
  109. * @override
  110. */
  111. init(option: CalendarOption, parentModel: Model, ecModel: GlobalModel): void;
  112. /**
  113. * @override
  114. */
  115. mergeOption(option: CalendarOption): void;
  116. getCellSize(): (number | "auto")[];
  117. static defaultOption: CalendarOption;
  118. }
  119. export default CalendarModel;