parseText.d.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { TextAlign, TextVerticalAlign } from '../../core/types';
  2. import { TextStyleProps } from '../Text';
  3. interface InnerTruncateOption {
  4. maxIteration?: number;
  5. minChar?: number;
  6. placeholder?: string;
  7. maxIterations?: number;
  8. }
  9. export declare function truncateText(text: string, containerWidth: number, font: string, ellipsis?: string, options?: InnerTruncateOption): string;
  10. export interface PlainTextContentBlock {
  11. lineHeight: number;
  12. calculatedLineHeight: number;
  13. contentWidth: number;
  14. contentHeight: number;
  15. width: number;
  16. height: number;
  17. outerWidth: number;
  18. outerHeight: number;
  19. lines: string[];
  20. isTruncated: boolean;
  21. }
  22. export declare function parsePlainText(text: string, style?: TextStyleProps): PlainTextContentBlock;
  23. declare class RichTextToken {
  24. styleName: string;
  25. text: string;
  26. width: number;
  27. height: number;
  28. innerHeight: number;
  29. contentHeight: number;
  30. contentWidth: number;
  31. lineHeight: number;
  32. font: string;
  33. align: TextAlign;
  34. verticalAlign: TextVerticalAlign;
  35. textPadding: number[];
  36. percentWidth?: string;
  37. isLineHolder: boolean;
  38. }
  39. declare class RichTextLine {
  40. lineHeight: number;
  41. width: number;
  42. tokens: RichTextToken[];
  43. constructor(tokens?: RichTextToken[]);
  44. }
  45. export declare class RichTextContentBlock {
  46. width: number;
  47. height: number;
  48. contentWidth: number;
  49. contentHeight: number;
  50. outerWidth: number;
  51. outerHeight: number;
  52. lines: RichTextLine[];
  53. isTruncated: boolean;
  54. }
  55. export declare function parseRichText(text: string, style: TextStyleProps): RichTextContentBlock;
  56. export {};