sense-react-timeline-editor 1.1.19 → 1.1.21

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.
@@ -84,12 +84,7 @@ export declare const useRowDrag: (options: UseRowDragOptions) => {
84
84
  action?: TimelineAction;
85
85
  row?: TimelineRow;
86
86
  }) => void;
87
- getPreviewPosition: (actionId: string) => {
88
- left: number;
89
- width: number;
90
- } | null;
91
87
  isMultiDragging: () => boolean;
92
- getMultiDragState: () => MultiDragState;
93
88
  isMultiDrag: boolean;
94
89
  };
95
90
  export {};
package/dist/index.esm.js CHANGED
@@ -66,54 +66,6 @@ function _createClass(e, r, t) {
66
66
  writable: !1
67
67
  }), e;
68
68
  }
69
- function _createForOfIteratorHelper(r, e) {
70
- var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
71
- if (!t) {
72
- if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
73
- t && (r = t);
74
- var n = 0,
75
- F = function () {};
76
- return {
77
- s: F,
78
- n: function () {
79
- return n >= r.length ? {
80
- done: !0
81
- } : {
82
- done: !1,
83
- value: r[n++]
84
- };
85
- },
86
- e: function (r) {
87
- throw r;
88
- },
89
- f: F
90
- };
91
- }
92
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
93
- }
94
- var o,
95
- a = !0,
96
- u = !1;
97
- return {
98
- s: function () {
99
- t = t.call(r);
100
- },
101
- n: function () {
102
- var r = t.next();
103
- return a = r.done, r;
104
- },
105
- e: function (r) {
106
- u = !0, o = r;
107
- },
108
- f: function () {
109
- try {
110
- a || null == t.return || t.return();
111
- } finally {
112
- if (u) throw o;
113
- }
114
- }
115
- };
116
- }
117
69
  function _defineProperty(e, r, t) {
118
70
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
119
71
  value: t,
@@ -2389,6 +2341,9 @@ var EditActionO = function EditActionO(_ref7) {
2389
2341
  //#region [rgba(100,120,156,0.08)] 回调
2390
2342
  var handleDragStart = function handleDragStart() {
2391
2343
  var _areaRef$current;
2344
+ window.dispatchEvent(new CustomEvent('timeline-action-dragging-change', {
2345
+ detail: true
2346
+ }));
2392
2347
  // 保存原始位置
2393
2348
  setDragging(true);
2394
2349
  clearRipplePreview(areaRef.current);
@@ -2529,6 +2484,9 @@ var EditActionO = function EditActionO(_ref7) {
2529
2484
  height = _ref9.height,
2530
2485
  isMultiDrag = _ref9.isMultiDrag,
2531
2486
  fnCallback = _ref9.fn;
2487
+ window.dispatchEvent(new CustomEvent('timeline-action-dragging-change', {
2488
+ detail: false
2489
+ }));
2532
2490
  setDragging(false);
2533
2491
  setInsertPreview === null || setInsertPreview === void 0 ? void 0 : setInsertPreview(null);
2534
2492
  setTrackPreview === null || setTrackPreview === void 0 ? void 0 : setTrackPreview(null);
@@ -2564,6 +2522,35 @@ var EditActionO = function EditActionO(_ref7) {
2564
2522
  }),
2565
2523
  start = _parserTransformToTim.start,
2566
2524
  end = _parserTransformToTim.end;
2525
+ var isSelectionMultiDrag = ((selectedActionIds === null || selectedActionIds === void 0 ? void 0 : selectedActionIds.length) || 0) > 1 && (selectedActionIds === null || selectedActionIds === void 0 ? void 0 : selectedActionIds.includes(action.id));
2526
+ if (isSelectionMultiDrag || isMultiDrag) {
2527
+ var originalTransform = parserTimeToTransform({
2528
+ start: action.start,
2529
+ end: action.end
2530
+ }, {
2531
+ startLeft: startLeft,
2532
+ scale: scale,
2533
+ scaleWidth: scaleWidth
2534
+ });
2535
+ setTransform(_objectSpread2(_objectSpread2({}, originalTransform), {}, {
2536
+ top: 0
2537
+ }));
2538
+ if (onActionMoveEnd) {
2539
+ onActionMoveEnd({
2540
+ action: action,
2541
+ row: row,
2542
+ start: start,
2543
+ end: end,
2544
+ left: left,
2545
+ width: width,
2546
+ top: top,
2547
+ height: height,
2548
+ up: 0,
2549
+ isMultiDrag: true
2550
+ });
2551
+ }
2552
+ return;
2553
+ }
2567
2554
  // Step 1: 根据鼠标垂直位置确定初始目标行
2568
2555
  var placement = resolveTargetRowPlacement({
2569
2556
  editorData: editorData,
@@ -2835,9 +2822,18 @@ var EditActionO = function EditActionO(_ref7) {
2835
2822
  }, /*#__PURE__*/React.createElement("div", {
2836
2823
  "data-action-id": action.id,
2837
2824
  "data-action-drag": dragging,
2825
+ "data-action-name": action.file_name,
2838
2826
  "data-action-disabled": action.is_disabled ? 1 : 0,
2839
2827
  onMouseDown: function onMouseDown() {
2840
2828
  isDragWhenClick.current = false;
2829
+ if (((selectedActionIds === null || selectedActionIds === void 0 ? void 0 : selectedActionIds.length) || 0) > 0 && !(selectedActionIds === null || selectedActionIds === void 0 ? void 0 : selectedActionIds.includes(action.id))) {
2830
+ window.dispatchEvent(new CustomEvent('replace-selection-action', {
2831
+ detail: {
2832
+ actionId: action.id,
2833
+ row: row
2834
+ }
2835
+ }));
2836
+ }
2841
2837
  },
2842
2838
  onClick: function onClick(e) {
2843
2839
  var time;
@@ -3228,41 +3224,48 @@ var removeActionFromRows = function removeActionFromRows(rows, actionId) {
3228
3224
  action: undefined
3229
3225
  };
3230
3226
  };
3231
- var ensureRowAtIndex = function ensureRowAtIndex(_ref) {
3232
- var _ref2, _rows$order, _rows;
3233
- var rows = _ref.rows,
3234
- targetIndex = _ref.targetIndex,
3235
- templateRow = _ref.templateRow;
3236
- var clampedIndex = Math.max(0, Math.min(targetIndex, rows.length));
3237
- if (clampedIndex < rows.length) return rows[clampedIndex];
3238
- var previousOrder = (_ref2 = (_rows$order = (_rows = rows[rows.length - 1]) === null || _rows === void 0 ? void 0 : _rows.order) !== null && _rows$order !== void 0 ? _rows$order : templateRow.order) !== null && _ref2 !== void 0 ? _ref2 : 0;
3239
- var newRow = _objectSpread2(_objectSpread2({}, templateRow), {}, {
3240
- id: "row_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 9)),
3241
- actions: [],
3242
- order: Number(previousOrder) + 0.01
3243
- });
3244
- rows.push(newRow);
3245
- return newRow;
3246
- };
3247
- var findFirstAvailableRow = function findFirstAvailableRow(_ref3) {
3248
- var rows = _ref3.rows,
3249
- targetIndex = _ref3.targetIndex,
3250
- actionId = _ref3.actionId,
3251
- start = _ref3.start,
3252
- end = _ref3.end,
3253
- templateRow = _ref3.templateRow;
3254
- var safeIndex = Math.max(0, targetIndex);
3255
- for (var i = safeIndex; i < rows.length; i++) {
3256
- var hasConflict = rows[i].actions.some(function (item) {
3257
- return item.id !== actionId && item.start < end && item.end > start;
3227
+ var buildMultiDragPlacements = function buildMultiDragPlacements(_ref4) {
3228
+ var editorData = _ref4.editorData,
3229
+ initialPositions = _ref4.initialPositions,
3230
+ selectedActionIds = _ref4.selectedActionIds,
3231
+ timeOffset = _ref4.timeOffset,
3232
+ rowDelta = _ref4.rowDelta;
3233
+ var selectedSet = new Set(selectedActionIds);
3234
+ return selectedActionIds.map(function (actionId) {
3235
+ var initial = initialPositions.get(actionId);
3236
+ if (!initial) return null;
3237
+ var candidateRow = editorData[initial.rowIndex + rowDelta];
3238
+ var nextStart = initial.start + timeOffset;
3239
+ var nextEnd = initial.end + timeOffset;
3240
+ if (!candidateRow) {
3241
+ return {
3242
+ actionId: actionId,
3243
+ rowId: initial.rowId,
3244
+ start: initial.start,
3245
+ end: initial.end,
3246
+ conflicted: true
3247
+ };
3248
+ }
3249
+ var hasConflict = candidateRow.actions.some(function (item) {
3250
+ return !selectedSet.has(item.id) && item.start < nextEnd && item.end > nextStart;
3258
3251
  });
3259
- if (!hasConflict) return rows[i];
3260
- }
3261
- return ensureRowAtIndex({
3262
- rows: rows,
3263
- targetIndex: rows.length,
3264
- templateRow: templateRow
3265
- });
3252
+ if (hasConflict) {
3253
+ return {
3254
+ actionId: actionId,
3255
+ rowId: initial.rowId,
3256
+ start: initial.start,
3257
+ end: initial.end,
3258
+ conflicted: true
3259
+ };
3260
+ }
3261
+ return {
3262
+ actionId: actionId,
3263
+ rowId: candidateRow.id,
3264
+ start: nextStart,
3265
+ end: nextEnd,
3266
+ conflicted: false
3267
+ };
3268
+ }).filter(Boolean);
3266
3269
  };
3267
3270
  var useRowDrag = function useRowDrag(options) {
3268
3271
  var selectedActionIds = options.selectedActionIds,
@@ -3286,11 +3289,15 @@ var useRowDrag = function useRowDrag(options) {
3286
3289
  var actions = containerRef.current.querySelectorAll('.timeline-editor-action-selected');
3287
3290
  return Array.from(actions);
3288
3291
  }, [containerRef]);
3289
- var previewPositionsRef = React.useRef(new Map());
3290
3292
  // 拖拽开始
3291
- var onDragStart = React.useCallback(function (_ref4) {
3292
- var action = _ref4.action;
3293
+ var onDragStart = React.useCallback(function (_ref5) {
3294
+ var action = _ref5.action;
3293
3295
  if (selectedActionIds.length <= 1) {
3296
+ multiDragState.current = resetMultiDragState();
3297
+ return;
3298
+ }
3299
+ if (!selectedActionIds.includes(action.id)) {
3300
+ multiDragState.current = resetMultiDragState();
3294
3301
  return;
3295
3302
  }
3296
3303
  var selectedEls = getSelectedActionEls();
@@ -3387,7 +3394,6 @@ var useRowDrag = function useRowDrag(options) {
3387
3394
  }, [getSelectedActionEls]);
3388
3395
  // 拖拽结束
3389
3396
  var onDragEnd = React.useCallback(function (params) {
3390
- var _rows$primaryRemoval$;
3391
3397
  var state = multiDragState.current;
3392
3398
  var selectedEls = getSelectedActionEls();
3393
3399
  selectedEls.forEach(function (el) {
@@ -3397,7 +3403,6 @@ var useRowDrag = function useRowDrag(options) {
3397
3403
  });
3398
3404
  if (!state.isMultiDrag || !params || (params === null || params === void 0 ? void 0 : params.actionId) !== state.primaryActionId) {
3399
3405
  multiDragState.current = resetMultiDragState();
3400
- previewPositionsRef.current = new Map();
3401
3406
  return;
3402
3407
  }
3403
3408
  var left = params.left,
@@ -3410,13 +3415,11 @@ var useRowDrag = function useRowDrag(options) {
3410
3415
  primaryActionId = state.primaryActionId;
3411
3416
  if (!setEditorData || initialPositions.size === 0) {
3412
3417
  multiDragState.current = resetMultiDragState();
3413
- previewPositionsRef.current = new Map();
3414
3418
  return;
3415
3419
  }
3416
3420
  var primaryInitial = initialPositions.get(primaryActionId);
3417
3421
  if (!primaryInitial) {
3418
3422
  multiDragState.current = resetMultiDragState();
3419
- previewPositionsRef.current = new Map();
3420
3423
  return;
3421
3424
  }
3422
3425
  var primaryFinalTime = parserTransformToTime({
@@ -3431,119 +3434,75 @@ var useRowDrag = function useRowDrag(options) {
3431
3434
  var rowDelta = Math.round((top || 0) / rowHeight);
3432
3435
  if (Math.abs(timeOffset) < 0.001 && rowDelta === 0) {
3433
3436
  multiDragState.current = resetMultiDragState();
3434
- previewPositionsRef.current = new Map();
3437
+ return;
3438
+ }
3439
+ var placements = buildMultiDragPlacements({
3440
+ editorData: editorData,
3441
+ initialPositions: initialPositions,
3442
+ selectedActionIds: selectedActionIds,
3443
+ timeOffset: timeOffset,
3444
+ rowDelta: rowDelta
3445
+ });
3446
+ var hasConflict = placements.some(function (placement) {
3447
+ return placement.conflicted;
3448
+ });
3449
+ if (hasConflict) {
3450
+ multiDragState.current = resetMultiDragState();
3435
3451
  return;
3436
3452
  }
3437
3453
  var rows = cloneRows(editorData);
3438
3454
  var updatedActions = [];
3439
- var primaryRemoval = removeActionFromRows(rows, primaryActionId);
3440
- var fallbackPrimaryRow = rows.find(function (item) {
3441
- return item.id === primaryInitial.rowId;
3442
- }) || editorData[primaryInitial.rowIndex];
3443
- var primaryTargetRowId = (primaryRow === null || primaryRow === void 0 ? void 0 : primaryRow.id) || primaryInitial.rowId;
3444
- var primaryTargetRow = rows.find(function (item) {
3445
- return item.id === primaryTargetRowId;
3455
+ var removedActions = new Map();
3456
+ selectedActionIds.forEach(function (selectedId) {
3457
+ var removal = removeActionFromRows(rows, selectedId);
3458
+ if (removal.action) {
3459
+ removedActions.set(selectedId, removal.action);
3460
+ }
3446
3461
  });
3447
- if (!primaryTargetRow) {
3448
- primaryTargetRow = _objectSpread2(_objectSpread2({}, primaryRow || fallbackPrimaryRow), {}, {
3449
- actions: []
3462
+ placements.forEach(function (placement) {
3463
+ var actionItem = removedActions.get(placement.actionId) || (placement.actionId === primaryActionId ? primaryAction : undefined);
3464
+ if (!actionItem) return;
3465
+ var targetRow = rows.find(function (item) {
3466
+ return item.id === placement.rowId;
3450
3467
  });
3451
- rows.push(primaryTargetRow);
3452
- }
3453
- if (primaryAction) {
3454
- var normalizedPrimaryAction = _objectSpread2(_objectSpread2({}, primaryAction), {}, {
3455
- start: primaryFinalTime.start,
3456
- end: primaryFinalTime.end,
3457
- order: primaryTargetRow.order
3468
+ if (!targetRow) return;
3469
+ var nextAction = _objectSpread2(_objectSpread2({}, actionItem), {}, {
3470
+ start: placement.start,
3471
+ end: placement.end,
3472
+ order: targetRow.order
3458
3473
  });
3459
- primaryTargetRow.actions.push(normalizedPrimaryAction);
3460
- primaryTargetRow.actions.sort(function (a, b) {
3474
+ targetRow.actions.push(nextAction);
3475
+ targetRow.actions.sort(function (a, b) {
3461
3476
  return a.start - b.start;
3462
3477
  });
3463
- updatedActions.push(normalizedPrimaryAction);
3464
- }
3465
- if (primaryRemoval.rowIndex !== -1 && ((_rows$primaryRemoval$ = rows[primaryRemoval.rowIndex]) === null || _rows$primaryRemoval$ === void 0 ? void 0 : _rows$primaryRemoval$.actions.length) === 0) {
3466
- rows.splice(primaryRemoval.rowIndex, 1);
3467
- }
3468
- var selectedSecondaryIds = selectedActionIds.filter(function (id) {
3469
- return id !== primaryActionId;
3478
+ updatedActions.push(nextAction);
3470
3479
  });
3471
- var _iterator = _createForOfIteratorHelper(selectedSecondaryIds),
3472
- _step;
3473
- try {
3474
- var _loop = function _loop() {
3475
- var _rows$removal$rowInde;
3476
- var selectedId = _step.value;
3477
- var initial = initialPositions.get(selectedId);
3478
- if (!initial) return 0; // continue
3479
- var removal = removeActionFromRows(rows, selectedId);
3480
- var currentAction = removal.action;
3481
- if (!currentAction) return 0; // continue
3482
- var templateRow = rows.find(function (item) {
3483
- return item.id === initial.rowId;
3484
- }) || editorData[initial.rowIndex] || primaryTargetRow;
3485
- var targetStart = currentAction.start + timeOffset;
3486
- var targetEnd = currentAction.end + timeOffset;
3487
- var preferredIndex = initial.rowIndex + rowDelta;
3488
- var targetRow = findFirstAvailableRow({
3489
- rows: rows,
3490
- targetIndex: preferredIndex,
3491
- actionId: selectedId,
3492
- start: targetStart,
3493
- end: targetEnd,
3494
- templateRow: templateRow
3495
- });
3496
- var nextAction = _objectSpread2(_objectSpread2({}, currentAction), {}, {
3497
- start: targetStart,
3498
- end: targetEnd,
3499
- order: targetRow.order
3500
- });
3501
- targetRow.actions.push(nextAction);
3502
- targetRow.actions.sort(function (a, b) {
3503
- return a.start - b.start;
3504
- });
3505
- updatedActions.push(nextAction);
3506
- if (removal.rowIndex !== -1 && ((_rows$removal$rowInde = rows[removal.rowIndex]) === null || _rows$removal$rowInde === void 0 ? void 0 : _rows$removal$rowInde.actions.length) === 0) {
3507
- rows.splice(removal.rowIndex, 1);
3508
- }
3509
- },
3510
- _ret;
3511
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
3512
- _ret = _loop();
3513
- if (_ret === 0) continue;
3514
- }
3515
- } catch (err) {
3516
- _iterator.e(err);
3517
- } finally {
3518
- _iterator.f();
3519
- }
3520
- rows.sort(function (a, b) {
3480
+ var nextRows = rows.filter(function (row) {
3481
+ return row.actions.length > 0;
3482
+ }).sort(function (a, b) {
3521
3483
  return Number(a.order || 0) - Number(b.order || 0);
3522
3484
  });
3523
- setEditorData(rows);
3524
- onUpdateEditorData === null || onUpdateEditorData === void 0 ? void 0 : onUpdateEditorData(primaryTargetRow, updatedActions);
3485
+ var primaryPlacement = placements.find(function (item) {
3486
+ return item.actionId === primaryActionId;
3487
+ });
3488
+ var primaryTargetRow = primaryPlacement ? nextRows.find(function (item) {
3489
+ return item.id === primaryPlacement.rowId;
3490
+ }) : primaryRow;
3491
+ setEditorData(nextRows);
3492
+ if (primaryTargetRow) {
3493
+ onUpdateEditorData === null || onUpdateEditorData === void 0 ? void 0 : onUpdateEditorData(primaryTargetRow, updatedActions);
3494
+ }
3525
3495
  multiDragState.current = resetMultiDragState();
3526
- previewPositionsRef.current = new Map();
3527
3496
  }, [editorData, getSelectedActionEls, onUpdateEditorData, rowHeight, scale, scaleWidth, selectedActionIds, setEditorData, startLeft]);
3528
- // 获取指定 action 的预览位置
3529
- var getPreviewPosition = React.useCallback(function (actionId) {
3530
- return previewPositionsRef.current.get(actionId) || null;
3531
- }, []);
3532
3497
  // 检查是否是多选拖拽模式
3533
3498
  var isMultiDragging = React.useCallback(function () {
3534
3499
  return multiDragState.current.isMultiDrag;
3535
3500
  }, []);
3536
- // 获取当前拖拽状态
3537
- var getMultiDragState = React.useCallback(function () {
3538
- return multiDragState.current;
3539
- }, []);
3540
3501
  return {
3541
3502
  onDragStart: onDragStart,
3542
3503
  onDragMove: onDragMove,
3543
3504
  onDragEnd: onDragEnd,
3544
- getPreviewPosition: getPreviewPosition,
3545
3505
  isMultiDragging: isMultiDragging,
3546
- getMultiDragState: getMultiDragState,
3547
3506
  isMultiDrag: multiDragState.current.isMultiDrag
3548
3507
  };
3549
3508
  };
@@ -3974,6 +3933,22 @@ var EditAreaO = /*#__PURE__*/React.forwardRef(function (props, ref) {
3974
3933
  window.removeEventListener('ctrl-click-action', handleCtrlClickAction);
3975
3934
  };
3976
3935
  }, [onCtrlClick, editorData, handleSelectionChange]);
3936
+ useEffect(function () {
3937
+ var handleReplaceSelectionAction = function handleReplaceSelectionAction(e) {
3938
+ var _editorData$2;
3939
+ var _ref2 = e.detail || {},
3940
+ actionId = _ref2.actionId,
3941
+ row = _ref2.row;
3942
+ if (!actionId || !row) return;
3943
+ if (row.type !== ((_editorData$2 = editorData[0]) === null || _editorData$2 === void 0 ? void 0 : _editorData$2.type)) return;
3944
+ setSelectedActionIds(new Set([actionId]));
3945
+ handleSelectionChange([actionId]);
3946
+ };
3947
+ window.addEventListener('replace-selection-action', handleReplaceSelectionAction);
3948
+ return function () {
3949
+ window.removeEventListener('replace-selection-action', handleReplaceSelectionAction);
3950
+ };
3951
+ }, [editorData, handleSelectionChange, setSelectedActionIds]);
3977
3952
  var uploadBgMusic = useCallback(function (file, row) {
3978
3953
  var canUpload = onBeforeUpload === null || onBeforeUpload === void 0 ? void 0 : onBeforeUpload(file[0]);
3979
3954
  if (!canUpload) return;
@@ -3997,10 +3972,10 @@ var EditAreaO = /*#__PURE__*/React.forwardRef(function (props, ref) {
3997
3972
  });
3998
3973
  }, [onBeforeUpload, handleUploadChange, customRequest]);
3999
3974
  /** 获取每个cell渲染内容 */
4000
- var cellRenderer = function cellRenderer(_ref2) {
4001
- var rowIndex = _ref2.rowIndex,
4002
- key = _ref2.key,
4003
- style = _ref2.style;
3975
+ var cellRenderer = function cellRenderer(_ref3) {
3976
+ var rowIndex = _ref3.rowIndex,
3977
+ key = _ref3.key,
3978
+ style = _ref3.style;
4004
3979
  var row = editorData[rowIndex]; // 行数据
4005
3980
  var editRow = /*#__PURE__*/React.createElement(EditRow, _objectSpread2(_objectSpread2({}, props), {}, {
4006
3981
  uploadBgMusic: uploadBgMusic,
@@ -4147,9 +4122,9 @@ var EditAreaO = /*#__PURE__*/React.forwardRef(function (props, ref) {
4147
4122
  style: {
4148
4123
  height: isMulti ? _totalHeight : 'unset'
4149
4124
  }
4150
- }, function (_ref3) {
4151
- var width = _ref3.width,
4152
- height = _ref3.height;
4125
+ }, function (_ref4) {
4126
+ var width = _ref4.width,
4127
+ height = _ref4.height;
4153
4128
  // 获取全部高度
4154
4129
  var totalHeight = 0;
4155
4130
  // 高度列表
@@ -4178,8 +4153,8 @@ var EditAreaO = /*#__PURE__*/React.forwardRef(function (props, ref) {
4178
4153
  columnWidth: Math.max(scaleCount * scaleWidth + startLeft, width),
4179
4154
  width: width,
4180
4155
  height: height,
4181
- rowHeight: function rowHeight(_ref4) {
4182
- var index = _ref4.index;
4156
+ rowHeight: function rowHeight(_ref5) {
4157
+ var index = _ref5.index;
4183
4158
  return heights[index] || _rowHeight || 0;
4184
4159
  },
4185
4160
  overscanRowCount: 10,
@@ -4349,6 +4324,7 @@ var TimeArea = function TimeArea(_ref) {
4349
4324
  scaleWidth: scaleWidth
4350
4325
  });
4351
4326
  var result = onClickTimeArea && onClickTimeArea(time, e);
4327
+ console.log('TimeArea click = ', time);
4352
4328
  if (result === false) return; // 返回 false 时阻止设置时间
4353
4329
  setCursor({
4354
4330
  time: time
@@ -4471,7 +4447,6 @@ var DragLineController = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function (pro
4471
4447
  _useState2 = _slicedToArray(_useState, 2),
4472
4448
  dragLineData = _useState2[0],
4473
4449
  setDragLineData = _useState2[1];
4474
- console.log('dragLineData = ', dragLineData);
4475
4450
  var initDragLine = useCallback(function (data) {
4476
4451
  if (dragLine) {
4477
4452
  var assistActionIds = getAssistDragLineActionIds && getAssistDragLineActionIds({
package/dist/index.js CHANGED
@@ -76,54 +76,6 @@ function _createClass(e, r, t) {
76
76
  writable: !1
77
77
  }), e;
78
78
  }
79
- function _createForOfIteratorHelper(r, e) {
80
- var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
81
- if (!t) {
82
- if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
83
- t && (r = t);
84
- var n = 0,
85
- F = function () {};
86
- return {
87
- s: F,
88
- n: function () {
89
- return n >= r.length ? {
90
- done: !0
91
- } : {
92
- done: !1,
93
- value: r[n++]
94
- };
95
- },
96
- e: function (r) {
97
- throw r;
98
- },
99
- f: F
100
- };
101
- }
102
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
103
- }
104
- var o,
105
- a = !0,
106
- u = !1;
107
- return {
108
- s: function () {
109
- t = t.call(r);
110
- },
111
- n: function () {
112
- var r = t.next();
113
- return a = r.done, r;
114
- },
115
- e: function (r) {
116
- u = !0, o = r;
117
- },
118
- f: function () {
119
- try {
120
- a || null == t.return || t.return();
121
- } finally {
122
- if (u) throw o;
123
- }
124
- }
125
- };
126
- }
127
79
  function _defineProperty(e, r, t) {
128
80
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
129
81
  value: t,
@@ -2399,6 +2351,9 @@ var EditActionO = function EditActionO(_ref7) {
2399
2351
  //#region [rgba(100,120,156,0.08)] 回调
2400
2352
  var handleDragStart = function handleDragStart() {
2401
2353
  var _areaRef$current;
2354
+ window.dispatchEvent(new CustomEvent('timeline-action-dragging-change', {
2355
+ detail: true
2356
+ }));
2402
2357
  // 保存原始位置
2403
2358
  setDragging(true);
2404
2359
  clearRipplePreview(areaRef.current);
@@ -2539,6 +2494,9 @@ var EditActionO = function EditActionO(_ref7) {
2539
2494
  height = _ref9.height,
2540
2495
  isMultiDrag = _ref9.isMultiDrag,
2541
2496
  fnCallback = _ref9.fn;
2497
+ window.dispatchEvent(new CustomEvent('timeline-action-dragging-change', {
2498
+ detail: false
2499
+ }));
2542
2500
  setDragging(false);
2543
2501
  setInsertPreview === null || setInsertPreview === void 0 ? void 0 : setInsertPreview(null);
2544
2502
  setTrackPreview === null || setTrackPreview === void 0 ? void 0 : setTrackPreview(null);
@@ -2574,6 +2532,35 @@ var EditActionO = function EditActionO(_ref7) {
2574
2532
  }),
2575
2533
  start = _parserTransformToTim.start,
2576
2534
  end = _parserTransformToTim.end;
2535
+ var isSelectionMultiDrag = ((selectedActionIds === null || selectedActionIds === void 0 ? void 0 : selectedActionIds.length) || 0) > 1 && (selectedActionIds === null || selectedActionIds === void 0 ? void 0 : selectedActionIds.includes(action.id));
2536
+ if (isSelectionMultiDrag || isMultiDrag) {
2537
+ var originalTransform = parserTimeToTransform({
2538
+ start: action.start,
2539
+ end: action.end
2540
+ }, {
2541
+ startLeft: startLeft,
2542
+ scale: scale,
2543
+ scaleWidth: scaleWidth
2544
+ });
2545
+ setTransform(_objectSpread2(_objectSpread2({}, originalTransform), {}, {
2546
+ top: 0
2547
+ }));
2548
+ if (onActionMoveEnd) {
2549
+ onActionMoveEnd({
2550
+ action: action,
2551
+ row: row,
2552
+ start: start,
2553
+ end: end,
2554
+ left: left,
2555
+ width: width,
2556
+ top: top,
2557
+ height: height,
2558
+ up: 0,
2559
+ isMultiDrag: true
2560
+ });
2561
+ }
2562
+ return;
2563
+ }
2577
2564
  // Step 1: 根据鼠标垂直位置确定初始目标行
2578
2565
  var placement = resolveTargetRowPlacement({
2579
2566
  editorData: editorData,
@@ -2845,9 +2832,18 @@ var EditActionO = function EditActionO(_ref7) {
2845
2832
  }, /*#__PURE__*/React__default['default'].createElement("div", {
2846
2833
  "data-action-id": action.id,
2847
2834
  "data-action-drag": dragging,
2835
+ "data-action-name": action.file_name,
2848
2836
  "data-action-disabled": action.is_disabled ? 1 : 0,
2849
2837
  onMouseDown: function onMouseDown() {
2850
2838
  isDragWhenClick.current = false;
2839
+ if (((selectedActionIds === null || selectedActionIds === void 0 ? void 0 : selectedActionIds.length) || 0) > 0 && !(selectedActionIds === null || selectedActionIds === void 0 ? void 0 : selectedActionIds.includes(action.id))) {
2840
+ window.dispatchEvent(new CustomEvent('replace-selection-action', {
2841
+ detail: {
2842
+ actionId: action.id,
2843
+ row: row
2844
+ }
2845
+ }));
2846
+ }
2851
2847
  },
2852
2848
  onClick: function onClick(e) {
2853
2849
  var time;
@@ -3238,41 +3234,48 @@ var removeActionFromRows = function removeActionFromRows(rows, actionId) {
3238
3234
  action: undefined
3239
3235
  };
3240
3236
  };
3241
- var ensureRowAtIndex = function ensureRowAtIndex(_ref) {
3242
- var _ref2, _rows$order, _rows;
3243
- var rows = _ref.rows,
3244
- targetIndex = _ref.targetIndex,
3245
- templateRow = _ref.templateRow;
3246
- var clampedIndex = Math.max(0, Math.min(targetIndex, rows.length));
3247
- if (clampedIndex < rows.length) return rows[clampedIndex];
3248
- var previousOrder = (_ref2 = (_rows$order = (_rows = rows[rows.length - 1]) === null || _rows === void 0 ? void 0 : _rows.order) !== null && _rows$order !== void 0 ? _rows$order : templateRow.order) !== null && _ref2 !== void 0 ? _ref2 : 0;
3249
- var newRow = _objectSpread2(_objectSpread2({}, templateRow), {}, {
3250
- id: "row_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 9)),
3251
- actions: [],
3252
- order: Number(previousOrder) + 0.01
3253
- });
3254
- rows.push(newRow);
3255
- return newRow;
3256
- };
3257
- var findFirstAvailableRow = function findFirstAvailableRow(_ref3) {
3258
- var rows = _ref3.rows,
3259
- targetIndex = _ref3.targetIndex,
3260
- actionId = _ref3.actionId,
3261
- start = _ref3.start,
3262
- end = _ref3.end,
3263
- templateRow = _ref3.templateRow;
3264
- var safeIndex = Math.max(0, targetIndex);
3265
- for (var i = safeIndex; i < rows.length; i++) {
3266
- var hasConflict = rows[i].actions.some(function (item) {
3267
- return item.id !== actionId && item.start < end && item.end > start;
3237
+ var buildMultiDragPlacements = function buildMultiDragPlacements(_ref4) {
3238
+ var editorData = _ref4.editorData,
3239
+ initialPositions = _ref4.initialPositions,
3240
+ selectedActionIds = _ref4.selectedActionIds,
3241
+ timeOffset = _ref4.timeOffset,
3242
+ rowDelta = _ref4.rowDelta;
3243
+ var selectedSet = new Set(selectedActionIds);
3244
+ return selectedActionIds.map(function (actionId) {
3245
+ var initial = initialPositions.get(actionId);
3246
+ if (!initial) return null;
3247
+ var candidateRow = editorData[initial.rowIndex + rowDelta];
3248
+ var nextStart = initial.start + timeOffset;
3249
+ var nextEnd = initial.end + timeOffset;
3250
+ if (!candidateRow) {
3251
+ return {
3252
+ actionId: actionId,
3253
+ rowId: initial.rowId,
3254
+ start: initial.start,
3255
+ end: initial.end,
3256
+ conflicted: true
3257
+ };
3258
+ }
3259
+ var hasConflict = candidateRow.actions.some(function (item) {
3260
+ return !selectedSet.has(item.id) && item.start < nextEnd && item.end > nextStart;
3268
3261
  });
3269
- if (!hasConflict) return rows[i];
3270
- }
3271
- return ensureRowAtIndex({
3272
- rows: rows,
3273
- targetIndex: rows.length,
3274
- templateRow: templateRow
3275
- });
3262
+ if (hasConflict) {
3263
+ return {
3264
+ actionId: actionId,
3265
+ rowId: initial.rowId,
3266
+ start: initial.start,
3267
+ end: initial.end,
3268
+ conflicted: true
3269
+ };
3270
+ }
3271
+ return {
3272
+ actionId: actionId,
3273
+ rowId: candidateRow.id,
3274
+ start: nextStart,
3275
+ end: nextEnd,
3276
+ conflicted: false
3277
+ };
3278
+ }).filter(Boolean);
3276
3279
  };
3277
3280
  var useRowDrag = function useRowDrag(options) {
3278
3281
  var selectedActionIds = options.selectedActionIds,
@@ -3296,11 +3299,15 @@ var useRowDrag = function useRowDrag(options) {
3296
3299
  var actions = containerRef.current.querySelectorAll('.timeline-editor-action-selected');
3297
3300
  return Array.from(actions);
3298
3301
  }, [containerRef]);
3299
- var previewPositionsRef = React__default['default'].useRef(new Map());
3300
3302
  // 拖拽开始
3301
- var onDragStart = React__default['default'].useCallback(function (_ref4) {
3302
- var action = _ref4.action;
3303
+ var onDragStart = React__default['default'].useCallback(function (_ref5) {
3304
+ var action = _ref5.action;
3303
3305
  if (selectedActionIds.length <= 1) {
3306
+ multiDragState.current = resetMultiDragState();
3307
+ return;
3308
+ }
3309
+ if (!selectedActionIds.includes(action.id)) {
3310
+ multiDragState.current = resetMultiDragState();
3304
3311
  return;
3305
3312
  }
3306
3313
  var selectedEls = getSelectedActionEls();
@@ -3397,7 +3404,6 @@ var useRowDrag = function useRowDrag(options) {
3397
3404
  }, [getSelectedActionEls]);
3398
3405
  // 拖拽结束
3399
3406
  var onDragEnd = React__default['default'].useCallback(function (params) {
3400
- var _rows$primaryRemoval$;
3401
3407
  var state = multiDragState.current;
3402
3408
  var selectedEls = getSelectedActionEls();
3403
3409
  selectedEls.forEach(function (el) {
@@ -3407,7 +3413,6 @@ var useRowDrag = function useRowDrag(options) {
3407
3413
  });
3408
3414
  if (!state.isMultiDrag || !params || (params === null || params === void 0 ? void 0 : params.actionId) !== state.primaryActionId) {
3409
3415
  multiDragState.current = resetMultiDragState();
3410
- previewPositionsRef.current = new Map();
3411
3416
  return;
3412
3417
  }
3413
3418
  var left = params.left,
@@ -3420,13 +3425,11 @@ var useRowDrag = function useRowDrag(options) {
3420
3425
  primaryActionId = state.primaryActionId;
3421
3426
  if (!setEditorData || initialPositions.size === 0) {
3422
3427
  multiDragState.current = resetMultiDragState();
3423
- previewPositionsRef.current = new Map();
3424
3428
  return;
3425
3429
  }
3426
3430
  var primaryInitial = initialPositions.get(primaryActionId);
3427
3431
  if (!primaryInitial) {
3428
3432
  multiDragState.current = resetMultiDragState();
3429
- previewPositionsRef.current = new Map();
3430
3433
  return;
3431
3434
  }
3432
3435
  var primaryFinalTime = parserTransformToTime({
@@ -3441,119 +3444,75 @@ var useRowDrag = function useRowDrag(options) {
3441
3444
  var rowDelta = Math.round((top || 0) / rowHeight);
3442
3445
  if (Math.abs(timeOffset) < 0.001 && rowDelta === 0) {
3443
3446
  multiDragState.current = resetMultiDragState();
3444
- previewPositionsRef.current = new Map();
3447
+ return;
3448
+ }
3449
+ var placements = buildMultiDragPlacements({
3450
+ editorData: editorData,
3451
+ initialPositions: initialPositions,
3452
+ selectedActionIds: selectedActionIds,
3453
+ timeOffset: timeOffset,
3454
+ rowDelta: rowDelta
3455
+ });
3456
+ var hasConflict = placements.some(function (placement) {
3457
+ return placement.conflicted;
3458
+ });
3459
+ if (hasConflict) {
3460
+ multiDragState.current = resetMultiDragState();
3445
3461
  return;
3446
3462
  }
3447
3463
  var rows = cloneRows(editorData);
3448
3464
  var updatedActions = [];
3449
- var primaryRemoval = removeActionFromRows(rows, primaryActionId);
3450
- var fallbackPrimaryRow = rows.find(function (item) {
3451
- return item.id === primaryInitial.rowId;
3452
- }) || editorData[primaryInitial.rowIndex];
3453
- var primaryTargetRowId = (primaryRow === null || primaryRow === void 0 ? void 0 : primaryRow.id) || primaryInitial.rowId;
3454
- var primaryTargetRow = rows.find(function (item) {
3455
- return item.id === primaryTargetRowId;
3465
+ var removedActions = new Map();
3466
+ selectedActionIds.forEach(function (selectedId) {
3467
+ var removal = removeActionFromRows(rows, selectedId);
3468
+ if (removal.action) {
3469
+ removedActions.set(selectedId, removal.action);
3470
+ }
3456
3471
  });
3457
- if (!primaryTargetRow) {
3458
- primaryTargetRow = _objectSpread2(_objectSpread2({}, primaryRow || fallbackPrimaryRow), {}, {
3459
- actions: []
3472
+ placements.forEach(function (placement) {
3473
+ var actionItem = removedActions.get(placement.actionId) || (placement.actionId === primaryActionId ? primaryAction : undefined);
3474
+ if (!actionItem) return;
3475
+ var targetRow = rows.find(function (item) {
3476
+ return item.id === placement.rowId;
3460
3477
  });
3461
- rows.push(primaryTargetRow);
3462
- }
3463
- if (primaryAction) {
3464
- var normalizedPrimaryAction = _objectSpread2(_objectSpread2({}, primaryAction), {}, {
3465
- start: primaryFinalTime.start,
3466
- end: primaryFinalTime.end,
3467
- order: primaryTargetRow.order
3478
+ if (!targetRow) return;
3479
+ var nextAction = _objectSpread2(_objectSpread2({}, actionItem), {}, {
3480
+ start: placement.start,
3481
+ end: placement.end,
3482
+ order: targetRow.order
3468
3483
  });
3469
- primaryTargetRow.actions.push(normalizedPrimaryAction);
3470
- primaryTargetRow.actions.sort(function (a, b) {
3484
+ targetRow.actions.push(nextAction);
3485
+ targetRow.actions.sort(function (a, b) {
3471
3486
  return a.start - b.start;
3472
3487
  });
3473
- updatedActions.push(normalizedPrimaryAction);
3474
- }
3475
- if (primaryRemoval.rowIndex !== -1 && ((_rows$primaryRemoval$ = rows[primaryRemoval.rowIndex]) === null || _rows$primaryRemoval$ === void 0 ? void 0 : _rows$primaryRemoval$.actions.length) === 0) {
3476
- rows.splice(primaryRemoval.rowIndex, 1);
3477
- }
3478
- var selectedSecondaryIds = selectedActionIds.filter(function (id) {
3479
- return id !== primaryActionId;
3488
+ updatedActions.push(nextAction);
3480
3489
  });
3481
- var _iterator = _createForOfIteratorHelper(selectedSecondaryIds),
3482
- _step;
3483
- try {
3484
- var _loop = function _loop() {
3485
- var _rows$removal$rowInde;
3486
- var selectedId = _step.value;
3487
- var initial = initialPositions.get(selectedId);
3488
- if (!initial) return 0; // continue
3489
- var removal = removeActionFromRows(rows, selectedId);
3490
- var currentAction = removal.action;
3491
- if (!currentAction) return 0; // continue
3492
- var templateRow = rows.find(function (item) {
3493
- return item.id === initial.rowId;
3494
- }) || editorData[initial.rowIndex] || primaryTargetRow;
3495
- var targetStart = currentAction.start + timeOffset;
3496
- var targetEnd = currentAction.end + timeOffset;
3497
- var preferredIndex = initial.rowIndex + rowDelta;
3498
- var targetRow = findFirstAvailableRow({
3499
- rows: rows,
3500
- targetIndex: preferredIndex,
3501
- actionId: selectedId,
3502
- start: targetStart,
3503
- end: targetEnd,
3504
- templateRow: templateRow
3505
- });
3506
- var nextAction = _objectSpread2(_objectSpread2({}, currentAction), {}, {
3507
- start: targetStart,
3508
- end: targetEnd,
3509
- order: targetRow.order
3510
- });
3511
- targetRow.actions.push(nextAction);
3512
- targetRow.actions.sort(function (a, b) {
3513
- return a.start - b.start;
3514
- });
3515
- updatedActions.push(nextAction);
3516
- if (removal.rowIndex !== -1 && ((_rows$removal$rowInde = rows[removal.rowIndex]) === null || _rows$removal$rowInde === void 0 ? void 0 : _rows$removal$rowInde.actions.length) === 0) {
3517
- rows.splice(removal.rowIndex, 1);
3518
- }
3519
- },
3520
- _ret;
3521
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
3522
- _ret = _loop();
3523
- if (_ret === 0) continue;
3524
- }
3525
- } catch (err) {
3526
- _iterator.e(err);
3527
- } finally {
3528
- _iterator.f();
3529
- }
3530
- rows.sort(function (a, b) {
3490
+ var nextRows = rows.filter(function (row) {
3491
+ return row.actions.length > 0;
3492
+ }).sort(function (a, b) {
3531
3493
  return Number(a.order || 0) - Number(b.order || 0);
3532
3494
  });
3533
- setEditorData(rows);
3534
- onUpdateEditorData === null || onUpdateEditorData === void 0 ? void 0 : onUpdateEditorData(primaryTargetRow, updatedActions);
3495
+ var primaryPlacement = placements.find(function (item) {
3496
+ return item.actionId === primaryActionId;
3497
+ });
3498
+ var primaryTargetRow = primaryPlacement ? nextRows.find(function (item) {
3499
+ return item.id === primaryPlacement.rowId;
3500
+ }) : primaryRow;
3501
+ setEditorData(nextRows);
3502
+ if (primaryTargetRow) {
3503
+ onUpdateEditorData === null || onUpdateEditorData === void 0 ? void 0 : onUpdateEditorData(primaryTargetRow, updatedActions);
3504
+ }
3535
3505
  multiDragState.current = resetMultiDragState();
3536
- previewPositionsRef.current = new Map();
3537
3506
  }, [editorData, getSelectedActionEls, onUpdateEditorData, rowHeight, scale, scaleWidth, selectedActionIds, setEditorData, startLeft]);
3538
- // 获取指定 action 的预览位置
3539
- var getPreviewPosition = React__default['default'].useCallback(function (actionId) {
3540
- return previewPositionsRef.current.get(actionId) || null;
3541
- }, []);
3542
3507
  // 检查是否是多选拖拽模式
3543
3508
  var isMultiDragging = React__default['default'].useCallback(function () {
3544
3509
  return multiDragState.current.isMultiDrag;
3545
3510
  }, []);
3546
- // 获取当前拖拽状态
3547
- var getMultiDragState = React__default['default'].useCallback(function () {
3548
- return multiDragState.current;
3549
- }, []);
3550
3511
  return {
3551
3512
  onDragStart: onDragStart,
3552
3513
  onDragMove: onDragMove,
3553
3514
  onDragEnd: onDragEnd,
3554
- getPreviewPosition: getPreviewPosition,
3555
3515
  isMultiDragging: isMultiDragging,
3556
- getMultiDragState: getMultiDragState,
3557
3516
  isMultiDrag: multiDragState.current.isMultiDrag
3558
3517
  };
3559
3518
  };
@@ -3984,6 +3943,22 @@ var EditAreaO = /*#__PURE__*/React__default['default'].forwardRef(function (prop
3984
3943
  window.removeEventListener('ctrl-click-action', handleCtrlClickAction);
3985
3944
  };
3986
3945
  }, [onCtrlClick, editorData, handleSelectionChange]);
3946
+ React.useEffect(function () {
3947
+ var handleReplaceSelectionAction = function handleReplaceSelectionAction(e) {
3948
+ var _editorData$2;
3949
+ var _ref2 = e.detail || {},
3950
+ actionId = _ref2.actionId,
3951
+ row = _ref2.row;
3952
+ if (!actionId || !row) return;
3953
+ if (row.type !== ((_editorData$2 = editorData[0]) === null || _editorData$2 === void 0 ? void 0 : _editorData$2.type)) return;
3954
+ setSelectedActionIds(new Set([actionId]));
3955
+ handleSelectionChange([actionId]);
3956
+ };
3957
+ window.addEventListener('replace-selection-action', handleReplaceSelectionAction);
3958
+ return function () {
3959
+ window.removeEventListener('replace-selection-action', handleReplaceSelectionAction);
3960
+ };
3961
+ }, [editorData, handleSelectionChange, setSelectedActionIds]);
3987
3962
  var uploadBgMusic = React.useCallback(function (file, row) {
3988
3963
  var canUpload = onBeforeUpload === null || onBeforeUpload === void 0 ? void 0 : onBeforeUpload(file[0]);
3989
3964
  if (!canUpload) return;
@@ -4007,10 +3982,10 @@ var EditAreaO = /*#__PURE__*/React__default['default'].forwardRef(function (prop
4007
3982
  });
4008
3983
  }, [onBeforeUpload, handleUploadChange, customRequest]);
4009
3984
  /** 获取每个cell渲染内容 */
4010
- var cellRenderer = function cellRenderer(_ref2) {
4011
- var rowIndex = _ref2.rowIndex,
4012
- key = _ref2.key,
4013
- style = _ref2.style;
3985
+ var cellRenderer = function cellRenderer(_ref3) {
3986
+ var rowIndex = _ref3.rowIndex,
3987
+ key = _ref3.key,
3988
+ style = _ref3.style;
4014
3989
  var row = editorData[rowIndex]; // 行数据
4015
3990
  var editRow = /*#__PURE__*/React__default['default'].createElement(EditRow, _objectSpread2(_objectSpread2({}, props), {}, {
4016
3991
  uploadBgMusic: uploadBgMusic,
@@ -4157,9 +4132,9 @@ var EditAreaO = /*#__PURE__*/React__default['default'].forwardRef(function (prop
4157
4132
  style: {
4158
4133
  height: isMulti ? _totalHeight : 'unset'
4159
4134
  }
4160
- }, function (_ref3) {
4161
- var width = _ref3.width,
4162
- height = _ref3.height;
4135
+ }, function (_ref4) {
4136
+ var width = _ref4.width,
4137
+ height = _ref4.height;
4163
4138
  // 获取全部高度
4164
4139
  var totalHeight = 0;
4165
4140
  // 高度列表
@@ -4188,8 +4163,8 @@ var EditAreaO = /*#__PURE__*/React__default['default'].forwardRef(function (prop
4188
4163
  columnWidth: Math.max(scaleCount * scaleWidth + startLeft, width),
4189
4164
  width: width,
4190
4165
  height: height,
4191
- rowHeight: function rowHeight(_ref4) {
4192
- var index = _ref4.index;
4166
+ rowHeight: function rowHeight(_ref5) {
4167
+ var index = _ref5.index;
4193
4168
  return heights[index] || _rowHeight || 0;
4194
4169
  },
4195
4170
  overscanRowCount: 10,
@@ -4359,6 +4334,7 @@ var TimeArea = function TimeArea(_ref) {
4359
4334
  scaleWidth: scaleWidth
4360
4335
  });
4361
4336
  var result = onClickTimeArea && onClickTimeArea(time, e);
4337
+ console.log('TimeArea click = ', time);
4362
4338
  if (result === false) return; // 返回 false 时阻止设置时间
4363
4339
  setCursor({
4364
4340
  time: time
@@ -4481,7 +4457,6 @@ var DragLineController = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(f
4481
4457
  _useState2 = _slicedToArray(_useState, 2),
4482
4458
  dragLineData = _useState2[0],
4483
4459
  setDragLineData = _useState2[1];
4484
- console.log('dragLineData = ', dragLineData);
4485
4460
  var initDragLine = React.useCallback(function (data) {
4486
4461
  if (dragLine) {
4487
4462
  var assistActionIds = getAssistDragLineActionIds && getAssistDragLineActionIds({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sense-react-timeline-editor",
3
- "version": "1.1.19",
3
+ "version": "1.1.21",
4
4
  "author": "xzdarcy",
5
5
  "license": "MIT",
6
6
  "keywords": [