slides.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. export type ElementType = 'text' | 'image' | 'shape' | 'line' | 'chart' | 'table'
  2. export interface PPTElementBaseProps {
  3. elId: string;
  4. isLock: boolean;
  5. left: number;
  6. top: number;
  7. groupId?: string;
  8. }
  9. export interface PPTElementSizeProps {
  10. width: number;
  11. height: number;
  12. }
  13. export interface PPTElementBorderProps {
  14. borderStyle?: string;
  15. borderWidth?: number;
  16. borderColor?: string;
  17. }
  18. export interface PPTTextElement extends PPTElementBaseProps, PPTElementSizeProps, PPTElementBorderProps {
  19. type: 'text';
  20. content: string;
  21. rotate?: number;
  22. fill?: string;
  23. opacity?: number;
  24. lineHeight?: number;
  25. segmentSpacing?: number;
  26. letterSpacing?: number;
  27. shadow?: string;
  28. }
  29. export interface PPTImageElement extends PPTElementBaseProps, PPTElementSizeProps, PPTElementBorderProps {
  30. type: 'image';
  31. lockRatio: boolean;
  32. imgUrl: string;
  33. rotate?: number;
  34. filter?: string;
  35. clip?: {
  36. range: [[number, number], [number, number]];
  37. shape: string;
  38. };
  39. flip?: string;
  40. shadow?: string;
  41. }
  42. export interface PPTShapeElement extends PPTElementBaseProps, PPTElementSizeProps, PPTElementBorderProps {
  43. type: 'shape';
  44. svgCode: string;
  45. lockRatio: boolean;
  46. fill: string;
  47. rotate?: number;
  48. opacity?: number;
  49. shadow?: string;
  50. }
  51. export interface PPTLineElement extends PPTElementBaseProps {
  52. type: 'line';
  53. start: [number, number];
  54. end: [number, number];
  55. width: number;
  56. style: string;
  57. color: string;
  58. marker: [string, string];
  59. lineType: string;
  60. }
  61. export interface PPTChartElement extends PPTElementBaseProps, PPTElementSizeProps, PPTElementBorderProps {
  62. type: 'chart';
  63. chartType: string;
  64. theme: string;
  65. data: Object;
  66. }
  67. export interface TableElementCell {
  68. colspan: number;
  69. rowspan: number;
  70. content: string;
  71. bgColor: string;
  72. }
  73. export interface PPTTableElement extends PPTElementBaseProps, PPTElementSizeProps {
  74. type: 'table';
  75. borderTheme: string;
  76. theme: string;
  77. rowSizes: number[];
  78. colSizes: number[];
  79. data: TableElementCell[][];
  80. }
  81. export type PPTElement = PPTTextElement |
  82. PPTImageElement |
  83. PPTShapeElement |
  84. PPTLineElement |
  85. PPTChartElement |
  86. PPTTableElement
  87. export interface PPTAnimation {
  88. elId: string;
  89. type: string;
  90. duration: number;
  91. }
  92. export interface Slide {
  93. id: string;
  94. elements: PPTElement[];
  95. background?: [string, string];
  96. animations?: PPTAnimation[];
  97. }