sense-react-timeline-editor 1.0.13 → 1.0.14
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { TimelineAction, TimelineRow } from '../../interface/action';
|
|
3
3
|
import { CommonProp } from '../../interface/common_prop';
|
|
4
4
|
import { DragLineData } from './drag_lines';
|
|
@@ -23,4 +23,4 @@ export declare type EditActionProps = CommonProp & {
|
|
|
23
23
|
containerRef?: React.MutableRefObject<HTMLDivElement>;
|
|
24
24
|
selectedActionIds?: string[];
|
|
25
25
|
};
|
|
26
|
-
export declare const EditAction:
|
|
26
|
+
export declare const EditAction: React.NamedExoticComponent<EditActionProps>;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useEffect, cloneElement, useImperativeHandle, useState, useLayoutEffect, useCallback } from 'react';
|
|
2
2
|
import { AutoSizer, Grid, ScrollSync } from 'react-virtualized';
|
|
3
|
-
import { useThrottleEffect,
|
|
3
|
+
import { useThrottleEffect, useThrottleFn } from 'ahooks';
|
|
4
4
|
import { prefixNames } from 'framework-utils';
|
|
5
5
|
import interact from 'interactjs';
|
|
6
6
|
import { useSelectionContainer } from '@air/react-drag-to-select';
|
|
@@ -2114,7 +2114,7 @@ styleInject(css_248z$3);
|
|
|
2114
2114
|
var stretchIcon = "data:image/svg+xml,%3Csvg%20width%3D%227%22%20height%3D%2216%22%20viewBox%3D%220%200%207%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M7%2015C7%2015.5523%206.55228%2016%206%2016L1%2016C0.447715%2016%201.06779e-08%2015.5523%202.38498e-08%2015L3.57746e-07%201C3.70918e-07%200.447715%200.447716%20-1.5627e-07%201%20-1.43099e-07L6%209.29825e-07C6.55229%209.42996e-07%207%200.447716%207%201L7%2015Z%22%20fill%3D%22%23226EFF%22%2F%3E%3Cpath%20d%3D%22M2%204L2%2012%22%20stroke%3D%22white%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4%2012.25L5.5%208L4%203.75%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M4%2012.25L5.5%208L4%203.75L4%2012.25Z%22%20stroke%3D%22white%22%20stroke-width%3D%220.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E";
|
|
2115
2115
|
|
|
2116
2116
|
var _excluded = ["left", "width", "top"];
|
|
2117
|
-
var
|
|
2117
|
+
var EditActionO = function EditActionO(_ref) {
|
|
2118
2118
|
var editorData = _ref.editorData,
|
|
2119
2119
|
row = _ref.row,
|
|
2120
2120
|
action = _ref.action,
|
|
@@ -2150,7 +2150,6 @@ var EditAction = function EditAction(_ref) {
|
|
|
2150
2150
|
setDropPreview = _ref.setDropPreview,
|
|
2151
2151
|
containerRef = _ref.containerRef,
|
|
2152
2152
|
selectedActionIds = _ref.selectedActionIds;
|
|
2153
|
-
console.log('action: selectedActionIds = ', selectedActionIds);
|
|
2154
2153
|
var rowRnd = useRef();
|
|
2155
2154
|
var isDragWhenClick = useRef(false);
|
|
2156
2155
|
var originalPosition = useRef({
|
|
@@ -2654,10 +2653,10 @@ var EditAction = function EditAction(_ref) {
|
|
|
2654
2653
|
});
|
|
2655
2654
|
}, [action, allowCreateTrack, editorData, id, onActionMoveEnd, parserTimeToTransform, parserTransformToTime, row, scale, scaleWidth, setDropPreview, setEditorData, startLeft, selectedActionIds]);
|
|
2656
2655
|
// 防抖版本的 handleDragEnd
|
|
2657
|
-
var
|
|
2656
|
+
var _useThrottleFn = useThrottleFn(handleDragEndBase, {
|
|
2658
2657
|
wait: 300
|
|
2659
2658
|
}),
|
|
2660
|
-
handleDragEnd =
|
|
2659
|
+
handleDragEnd = _useThrottleFn.run;
|
|
2661
2660
|
var handleResizeStart = function handleResizeStart(dir) {
|
|
2662
2661
|
onActionResizeStart && onActionResizeStart({
|
|
2663
2662
|
action: action,
|
|
@@ -2882,6 +2881,7 @@ var EditAction = function EditAction(_ref) {
|
|
|
2882
2881
|
alt: ""
|
|
2883
2882
|
}))));
|
|
2884
2883
|
};
|
|
2884
|
+
var EditAction = /*#__PURE__*/React.memo(EditActionO);
|
|
2885
2885
|
|
|
2886
2886
|
var css_248z$4 = ".timeline-editor-edit-row {\n background-repeat: no-repeat, repeat;\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n transition: background-color 0.15s ease, box-shadow 0.15s ease;\n}\n.timeline-editor-edit-row.preview-row {\n background-color: rgba(100, 150, 255, 0.15);\n border: 1px dashed rgba(100, 150, 255, 0.5);\n opacity: 0.8;\n transition: all 0.2s ease;\n}\n.timeline-editor-edit-row.selected {\n background-color: rgba(24, 144, 255, 0.08);\n box-shadow: inset 0 0 0 2px rgba(24, 144, 255, 0.4);\n position: relative;\n z-index: 10;\n}\n.timeline-editor-edit-row.selected::before {\n content: '';\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n width: 3px;\n background-color: #1890ff;\n}\n.timeline-editor-edit-row.dragging {\n opacity: 0.6;\n cursor: move;\n}\n";
|
|
2887
2887
|
styleInject(css_248z$4);
|
|
@@ -4344,7 +4344,7 @@ var Timeline = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
4344
4344
|
};
|
|
4345
4345
|
/** 处理主动数据变化 */
|
|
4346
4346
|
var handleEditorDataChange = function handleEditorDataChange(updatedData) {
|
|
4347
|
-
var result = onChange(updatedData);
|
|
4347
|
+
var result = onChange === null || onChange === void 0 ? void 0 : onChange(updatedData);
|
|
4348
4348
|
if (result !== false) {
|
|
4349
4349
|
setEditorData(updatedData);
|
|
4350
4350
|
engineRef.current.data = updatedData;
|
|
@@ -4529,7 +4529,7 @@ var Timeline = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
4529
4529
|
var indexB = keys.indexOf(String(b.type));
|
|
4530
4530
|
return indexA - indexB;
|
|
4531
4531
|
});
|
|
4532
|
-
var result = onChange(sortedMergedData);
|
|
4532
|
+
var result = onChange === null || onChange === void 0 ? void 0 : onChange(sortedMergedData);
|
|
4533
4533
|
if (result !== false) {
|
|
4534
4534
|
setEditorData(sortedMergedData);
|
|
4535
4535
|
engineRef.current.data = sortedMergedData;
|
package/dist/index.js
CHANGED
|
@@ -2123,7 +2123,7 @@ styleInject(css_248z$3);
|
|
|
2123
2123
|
var stretchIcon = "data:image/svg+xml,%3Csvg%20width%3D%227%22%20height%3D%2216%22%20viewBox%3D%220%200%207%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M7%2015C7%2015.5523%206.55228%2016%206%2016L1%2016C0.447715%2016%201.06779e-08%2015.5523%202.38498e-08%2015L3.57746e-07%201C3.70918e-07%200.447715%200.447716%20-1.5627e-07%201%20-1.43099e-07L6%209.29825e-07C6.55229%209.42996e-07%207%200.447716%207%201L7%2015Z%22%20fill%3D%22%23226EFF%22%2F%3E%3Cpath%20d%3D%22M2%204L2%2012%22%20stroke%3D%22white%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4%2012.25L5.5%208L4%203.75%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M4%2012.25L5.5%208L4%203.75L4%2012.25Z%22%20stroke%3D%22white%22%20stroke-width%3D%220.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E";
|
|
2124
2124
|
|
|
2125
2125
|
var _excluded = ["left", "width", "top"];
|
|
2126
|
-
var
|
|
2126
|
+
var EditActionO = function EditActionO(_ref) {
|
|
2127
2127
|
var editorData = _ref.editorData,
|
|
2128
2128
|
row = _ref.row,
|
|
2129
2129
|
action = _ref.action,
|
|
@@ -2159,7 +2159,6 @@ var EditAction = function EditAction(_ref) {
|
|
|
2159
2159
|
setDropPreview = _ref.setDropPreview,
|
|
2160
2160
|
containerRef = _ref.containerRef,
|
|
2161
2161
|
selectedActionIds = _ref.selectedActionIds;
|
|
2162
|
-
console.log('action: selectedActionIds = ', selectedActionIds);
|
|
2163
2162
|
var rowRnd = React.useRef();
|
|
2164
2163
|
var isDragWhenClick = React.useRef(false);
|
|
2165
2164
|
var originalPosition = React.useRef({
|
|
@@ -2663,10 +2662,10 @@ var EditAction = function EditAction(_ref) {
|
|
|
2663
2662
|
});
|
|
2664
2663
|
}, [action, allowCreateTrack, editorData, id, onActionMoveEnd, parserTimeToTransform, parserTransformToTime, row, scale, scaleWidth, setDropPreview, setEditorData, startLeft, selectedActionIds]);
|
|
2665
2664
|
// 防抖版本的 handleDragEnd
|
|
2666
|
-
var
|
|
2665
|
+
var _useThrottleFn = ahooks.useThrottleFn(handleDragEndBase, {
|
|
2667
2666
|
wait: 300
|
|
2668
2667
|
}),
|
|
2669
|
-
handleDragEnd =
|
|
2668
|
+
handleDragEnd = _useThrottleFn.run;
|
|
2670
2669
|
var handleResizeStart = function handleResizeStart(dir) {
|
|
2671
2670
|
onActionResizeStart && onActionResizeStart({
|
|
2672
2671
|
action: action,
|
|
@@ -2891,6 +2890,7 @@ var EditAction = function EditAction(_ref) {
|
|
|
2891
2890
|
alt: ""
|
|
2892
2891
|
}))));
|
|
2893
2892
|
};
|
|
2893
|
+
var EditAction = /*#__PURE__*/React__default['default'].memo(EditActionO);
|
|
2894
2894
|
|
|
2895
2895
|
var css_248z$4 = ".timeline-editor-edit-row {\n background-repeat: no-repeat, repeat;\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n transition: background-color 0.15s ease, box-shadow 0.15s ease;\n}\n.timeline-editor-edit-row.preview-row {\n background-color: rgba(100, 150, 255, 0.15);\n border: 1px dashed rgba(100, 150, 255, 0.5);\n opacity: 0.8;\n transition: all 0.2s ease;\n}\n.timeline-editor-edit-row.selected {\n background-color: rgba(24, 144, 255, 0.08);\n box-shadow: inset 0 0 0 2px rgba(24, 144, 255, 0.4);\n position: relative;\n z-index: 10;\n}\n.timeline-editor-edit-row.selected::before {\n content: '';\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n width: 3px;\n background-color: #1890ff;\n}\n.timeline-editor-edit-row.dragging {\n opacity: 0.6;\n cursor: move;\n}\n";
|
|
2896
2896
|
styleInject(css_248z$4);
|
|
@@ -4353,7 +4353,7 @@ var Timeline = /*#__PURE__*/React__default['default'].forwardRef(function (props
|
|
|
4353
4353
|
};
|
|
4354
4354
|
/** 处理主动数据变化 */
|
|
4355
4355
|
var handleEditorDataChange = function handleEditorDataChange(updatedData) {
|
|
4356
|
-
var result = onChange(updatedData);
|
|
4356
|
+
var result = onChange === null || onChange === void 0 ? void 0 : onChange(updatedData);
|
|
4357
4357
|
if (result !== false) {
|
|
4358
4358
|
setEditorData(updatedData);
|
|
4359
4359
|
engineRef.current.data = updatedData;
|
|
@@ -4538,7 +4538,7 @@ var Timeline = /*#__PURE__*/React__default['default'].forwardRef(function (props
|
|
|
4538
4538
|
var indexB = keys.indexOf(String(b.type));
|
|
4539
4539
|
return indexA - indexB;
|
|
4540
4540
|
});
|
|
4541
|
-
var result = onChange(sortedMergedData);
|
|
4541
|
+
var result = onChange === null || onChange === void 0 ? void 0 : onChange(sortedMergedData);
|
|
4542
4542
|
if (result !== false) {
|
|
4543
4543
|
setEditorData(sortedMergedData);
|
|
4544
4544
|
engineRef.current.data = sortedMergedData;
|