splitter.component.d.ts 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /**
  2. * Use of this source code is governed by an MIT-style license that can be
  3. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  4. */
  5. import { Directionality } from '@angular/cdk/bidi';
  6. import { ElementRef } from '@angular/core';
  7. import { NzResizeObserver } from 'ng-zorro-antd/cdk/resize-observer';
  8. import { NzDestroyService } from 'ng-zorro-antd/core/services';
  9. import { NzSplitterPanelComponent } from './splitter-panel.component';
  10. import { NzSplitterCollapseOption, NzSplitterLayout } from './typings';
  11. import * as i0 from "@angular/core";
  12. interface PanelSize {
  13. size: string | number | undefined;
  14. postPxSize: number;
  15. percentage: number;
  16. min: string | number | undefined;
  17. max: string | number | undefined;
  18. postPercentMinSize: number;
  19. postPercentMaxSize: number;
  20. }
  21. interface ResizableInfo {
  22. resizable: boolean;
  23. collapsible: Required<NzSplitterCollapseOption>;
  24. }
  25. export declare class NzSplitterComponent {
  26. /** ------------------- Props ------------------- */
  27. readonly nzLayout: import("@angular/core").InputSignal<NzSplitterLayout>;
  28. readonly nzLazy: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
  29. readonly nzResizeStart: import("@angular/core").OutputEmitterRef<number[]>;
  30. readonly nzResize: import("@angular/core").OutputEmitterRef<number[]>;
  31. readonly nzResizeEnd: import("@angular/core").OutputEmitterRef<number[]>;
  32. protected readonly destroy$: NzDestroyService;
  33. protected readonly elementRef: ElementRef<HTMLElement>;
  34. protected readonly directionality: Directionality;
  35. protected readonly resizeObserver: NzResizeObserver;
  36. protected readonly document: Document;
  37. protected readonly dir: import("@angular/core").Signal<import("@angular/cdk/bidi").Direction>;
  38. /** ------------------- Panels ------------------- */
  39. protected readonly panels: import("@angular/core").Signal<readonly NzSplitterPanelComponent[]>;
  40. protected readonly panelProps: import("@angular/core").Signal<{
  41. defaultSize: string | number | undefined;
  42. size: string | number | undefined;
  43. min: string | number | undefined;
  44. max: string | number | undefined;
  45. resizable: boolean;
  46. collapsible: NzSplitterCollapseOption;
  47. contentTemplate: import("@angular/core").TemplateRef<void>;
  48. }[]>;
  49. /** ------------------- Sizes ------------------- */
  50. /**
  51. * Observe the size of the container.
  52. */
  53. private readonly containerBox;
  54. /**
  55. * The size of the container, used to calculate the percentage size and flex basis of each panel.
  56. */
  57. protected readonly containerSize: import("@angular/core").Signal<number>;
  58. /**
  59. * Derived from defaultSize of each panel.
  60. * After that it will be updated by the resize event with **real** size in pixels.
  61. */
  62. protected readonly innerSizes: import("@angular/core").WritableSignal<(string | number | undefined)[]>;
  63. /**
  64. * Calculate the size of each panel based on the container size and the percentage size.
  65. */
  66. protected readonly sizes: import("@angular/core").Signal<PanelSize[]>;
  67. protected readonly ariaInfos: import("@angular/core").Signal<{
  68. ariaNow: number;
  69. ariaMin: number;
  70. ariaMax: number;
  71. }[]>;
  72. private getPxSizes;
  73. /** ------------------ Resize ------------------ */
  74. /**
  75. * The index of the panel that is being resized.
  76. * @note Mark the moving splitter bar as activated to show the dragging effect even if the mouse is outside the
  77. * splitter container.
  78. */
  79. protected readonly movingIndex: import("@angular/core").WritableSignal<{
  80. index: number;
  81. confirmed: boolean;
  82. } | null>;
  83. /**
  84. * The offset of preview position (lazy mode) when dragging the splitter bar.
  85. * Constrained by the min and max size of the target panel.
  86. */
  87. protected readonly constrainedOffset: import("@angular/core").WritableSignal<number>;
  88. /**
  89. * The resizable information of each splitter bar.
  90. */
  91. protected readonly resizableInfos: import("@angular/core").Signal<ResizableInfo[]>;
  92. /**
  93. * Handle the resize start event for the specified panel.
  94. * @param index The index of the panel.
  95. * @param startPos The start position of the resize event.
  96. */
  97. protected startResize(index: number, startPos: [x: number, y: number]): void;
  98. /**
  99. * Update the sizes of specified panels based on the move offset.
  100. * @param index The index of the panel.
  101. * @param offset The move offset in pixels.
  102. */
  103. private updateOffset;
  104. /** ------------------ Resize ------------------ */
  105. /**
  106. * Record the original size of the collapsed panel.
  107. * Used to restore the size when the panel is expanded back.
  108. */
  109. private readonly cacheCollapsedSize;
  110. /**
  111. * Collapse the specified panel.
  112. * @param index The index of the panel to collapse.
  113. * @param type The type of collapse, either `start` or `end`.
  114. */
  115. protected collapse(index: number, type: 'start' | 'end'): void;
  116. static ɵfac: i0.ɵɵFactoryDeclaration<NzSplitterComponent, never>;
  117. static ɵcmp: i0.ɵɵComponentDeclaration<NzSplitterComponent, "nz-splitter", ["nzSplitter"], { "nzLayout": { "alias": "nzLayout"; "required": false; "isSignal": true; }; "nzLazy": { "alias": "nzLazy"; "required": false; "isSignal": true; }; }, { "nzResizeStart": "nzResizeStart"; "nzResize": "nzResize"; "nzResizeEnd": "nzResizeEnd"; }, ["panels"], never, true, never>;
  118. }
  119. export {};