sense-react-timeline-editor 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/edit_area/edit_action.d.ts +1 -0
- package/dist/components/edit_area/edit_row.d.ts +2 -0
- package/dist/components/edit_area/hooks/use_row_drag.d.ts +88 -0
- package/dist/components/edit_area/hooks/use_row_selection.d.ts +16 -0
- package/dist/index.esm.js +762 -22
- package/dist/index.js +761 -21
- package/dist/interface/timeline.d.ts +8 -0
- package/package.json +7 -5
|
@@ -21,5 +21,6 @@ export declare type EditActionProps = CommonProp & {
|
|
|
21
21
|
} | null) => void;
|
|
22
22
|
/** time-editor-container的ref引用 */
|
|
23
23
|
containerRef?: React.MutableRefObject<HTMLDivElement>;
|
|
24
|
+
selectedActionIds?: string[];
|
|
24
25
|
};
|
|
25
26
|
export declare const EditAction: FC<EditActionProps>;
|
|
@@ -22,5 +22,7 @@ export declare type EditRowProps = CommonProp & {
|
|
|
22
22
|
} | null) => void;
|
|
23
23
|
/** time-editor-container的ref引用 */
|
|
24
24
|
containerRef?: React.MutableRefObject<HTMLDivElement>;
|
|
25
|
+
/** 选中的 action IDs */
|
|
26
|
+
selectedActionIds?: string[];
|
|
25
27
|
};
|
|
26
28
|
export declare const EditRow: FC<EditRowProps>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TimelineAction, TimelineRow } from '../../../interface/action';
|
|
3
|
+
export interface UseRowDragOptions {
|
|
4
|
+
selectedActionIds: string[];
|
|
5
|
+
editorData: TimelineRow[];
|
|
6
|
+
containerRef?: React.RefObject<HTMLDivElement>;
|
|
7
|
+
/** scale 参数 */
|
|
8
|
+
scale?: number;
|
|
9
|
+
/** 单个刻度的显示宽度 */
|
|
10
|
+
scaleWidth?: number;
|
|
11
|
+
/** 刻度开始距离左侧的距离 */
|
|
12
|
+
startLeft?: number;
|
|
13
|
+
/** 设置编辑器数据 */
|
|
14
|
+
setEditorData?: (data: TimelineRow[]) => void;
|
|
15
|
+
allowCreateTrack?: boolean;
|
|
16
|
+
rowHeight?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface MultiDragState {
|
|
19
|
+
/** 是否正在多选拖拽 */
|
|
20
|
+
isMultiDrag: boolean;
|
|
21
|
+
/** 拖拽的主 action ID */
|
|
22
|
+
primaryActionId?: string | null;
|
|
23
|
+
/** 所有选中 action 的初始位置信息 */
|
|
24
|
+
initialPositions: Map<string, {
|
|
25
|
+
rowId: string;
|
|
26
|
+
start: number;
|
|
27
|
+
end: number;
|
|
28
|
+
left: number;
|
|
29
|
+
width: number;
|
|
30
|
+
}>;
|
|
31
|
+
/** 当前拖拽的偏移量 */
|
|
32
|
+
dragOffset: {
|
|
33
|
+
dx: number;
|
|
34
|
+
dy: number;
|
|
35
|
+
};
|
|
36
|
+
/** 拖拽开始时的光标位置 */
|
|
37
|
+
startCursor?: {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
} | null;
|
|
41
|
+
/** 是否正在拖拽选中的元素 */
|
|
42
|
+
isDraggingSelection: boolean;
|
|
43
|
+
offsetX?: number;
|
|
44
|
+
offsetY?: number;
|
|
45
|
+
/** 初始元素位置(用于拖拽计算) */
|
|
46
|
+
initialElementPositions?: Map<string, {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
}>;
|
|
50
|
+
start: number;
|
|
51
|
+
end: number;
|
|
52
|
+
}
|
|
53
|
+
export declare const useRowDrag: (options: UseRowDragOptions) => {
|
|
54
|
+
onDragStart: ({ action, row }: {
|
|
55
|
+
action: TimelineAction;
|
|
56
|
+
row: TimelineRow;
|
|
57
|
+
}) => void;
|
|
58
|
+
onDragMove: (params: {
|
|
59
|
+
actionId: string;
|
|
60
|
+
left: number;
|
|
61
|
+
width: number;
|
|
62
|
+
top: number;
|
|
63
|
+
height: number;
|
|
64
|
+
dx: number;
|
|
65
|
+
dy: number;
|
|
66
|
+
lastLeft?: number;
|
|
67
|
+
lastWidth?: number;
|
|
68
|
+
lastTop?: number;
|
|
69
|
+
lastHeight?: number;
|
|
70
|
+
}) => void;
|
|
71
|
+
onDragEnd: (params?: {
|
|
72
|
+
actionId: string;
|
|
73
|
+
left: number;
|
|
74
|
+
width: number;
|
|
75
|
+
top: number;
|
|
76
|
+
height: number;
|
|
77
|
+
dx?: number;
|
|
78
|
+
dy?: number;
|
|
79
|
+
up: number;
|
|
80
|
+
}) => void;
|
|
81
|
+
getPreviewPosition: (actionId: string) => {
|
|
82
|
+
left: number;
|
|
83
|
+
width: number;
|
|
84
|
+
} | null;
|
|
85
|
+
isMultiDragging: () => boolean;
|
|
86
|
+
getMultiDragState: () => MultiDragState;
|
|
87
|
+
isMultiDrag: boolean;
|
|
88
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TimelineRow } from '../../../interface/action';
|
|
3
|
+
export interface UseRowSelectionOptions {
|
|
4
|
+
editorData: TimelineRow[];
|
|
5
|
+
rowHeight: number;
|
|
6
|
+
scrollTop: number;
|
|
7
|
+
scrollLeft: number;
|
|
8
|
+
onSelectionChange: (selectedActionIds: string[]) => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
containerRef?: React.RefObject<HTMLDivElement>;
|
|
11
|
+
}
|
|
12
|
+
export declare const useRowSelection: (options: UseRowSelectionOptions) => {
|
|
13
|
+
DragSelection: () => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
14
|
+
selectedActionIds: string[];
|
|
15
|
+
clearSelection: () => void;
|
|
16
|
+
};
|