|
1 | | -<script lang="ts"> |
2 | | -export interface SplitPanelProps { |
3 | | - /** Sets the split panel's orientation */ |
4 | | - orientation?: 'horizontal' | 'vertical'; |
5 | | -
|
6 | | - /** Sets the split panel's text direction */ |
7 | | - direction?: 'ltr' | 'rtl'; |
8 | | -
|
9 | | - /** If no primary panel is designated, both panels will resize proportionally when the host element is resized. If a primary panel is designated, it will maintain its size and the other panel will grow or shrink as needed when the panels component is resized */ |
10 | | - primary?: 'start' | 'end'; |
11 | | -
|
12 | | - /** The invisible region around the divider where dragging can occur. This is usually wider than the divider to facilitate easier dragging. CSS value */ |
13 | | - dividerHitArea?: string; |
14 | | -
|
15 | | - /** Whether the size v-model should be in relative percentages or absolute pixels */ |
16 | | - sizeUnit?: '%' | 'px'; |
17 | | -
|
18 | | - /** Disable the manual resizing of the panels */ |
19 | | - disabled?: boolean; |
20 | | -
|
21 | | - /** The minimum allowed size of the primary panel */ |
22 | | - minSize?: number; |
23 | | -
|
24 | | - /** The maximum allowed size of the primary panel */ |
25 | | - maxSize?: number; |
26 | | -
|
27 | | - /** Whether to allow the primary panel to be collapsed on enter key on divider or when the collapse threshold is met */ |
28 | | - collapsible?: boolean; |
29 | | -
|
30 | | - /** How far to drag beyond the minSize to collapse/expand the primary panel */ |
31 | | - collapseThreshold?: number; |
32 | | -
|
33 | | - /** How long should the collapse/expand state transition for in CSS value */ |
34 | | - transitionDuration?: string; |
35 | | -
|
36 | | - /** CSS transition timing function for the expand transition */ |
37 | | - transitionTimingFunctionExpand?: string; |
38 | | -
|
39 | | - /** CSS transition timing function for the collapse transition */ |
40 | | - transitionTimingFunctionCollapse?: string; |
41 | | -
|
42 | | - /** What size values the divider should snap to */ |
43 | | - snapPoints?: number[]; |
44 | | -
|
45 | | - /** How close to the snap point the size should be before the snapping occurs */ |
46 | | - snapThreshold?: number; |
47 | | -} |
48 | | -</script> |
49 | | - |
50 | 1 | <script lang="ts" setup> |
| 2 | +import type { SplitPanelProps } from './types'; |
51 | 3 | import { clamp, useDraggable, useElementSize, useResizeObserver } from '@vueuse/core'; |
52 | 4 | import { computed, onMounted, ref, useTemplateRef, watch } from 'vue'; |
53 | 5 | import { closestNumber } from './utils/closest-number'; |
|
0 commit comments