sense-react-timeline-editor 1.1.3 → 1.1.4

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.
@@ -83,4 +83,20 @@ export interface EventTypes {
83
83
  target: HTMLElement;
84
84
  evt: MouseEvent;
85
85
  };
86
+ /**
87
+ * 特效播放事件
88
+ * @type {{ id: string }}
89
+ * @memberof EventTypes
90
+ */
91
+ "effect-play": {
92
+ id: string;
93
+ };
94
+ /**
95
+ * 特效离开事件
96
+ * @type {{ id: string }}
97
+ * @memberof EventTypes
98
+ */
99
+ "effect-leave": {
100
+ id: string;
101
+ };
86
102
  }
package/dist/index.esm.js CHANGED
@@ -401,7 +401,9 @@ var Events = /*#__PURE__*/_createClass(function Events() {
401
401
  play: [],
402
402
  paused: [],
403
403
  ended: [],
404
- mousedown: []
404
+ mousedown: [],
405
+ "effect-play": [],
406
+ "effect-leave": []
405
407
  }, handlers);
406
408
  });
407
409
 
@@ -2108,7 +2110,7 @@ var DragLines = function DragLines(_ref) {
2108
2110
  var css_248z$2 = ".timeline-editor .ant-upload-wrapper .ant-upload-drag {\n border: none !important;\n background: none !important;\n}\n.timeline-editor:hover .timeline-editor-edit-area .ReactVirtualized__Grid::-webkit-scrollbar {\n height: 4px;\n}\n.timeline-editor-edit-area {\n flex: 1 1 auto;\n margin-top: 10px;\n overflow: hidden;\n position: relative;\n}\n.timeline-editor-edit-area.no-flex {\n flex: 0 0 auto;\n}\n.timeline-editor-edit-area.overflow-hidden {\n overflow: hidden;\n}\n.timeline-editor-edit-area.overflow-hidden .ReactVirtualized__Grid {\n overflow: hidden !important;\n height: initial !important;\n}\n.timeline-editor-edit-area .ReactVirtualized__Grid {\n outline: none !important;\n overflow: overlay !important;\n}\n.timeline-editor-edit-area .ReactVirtualized__Grid::-webkit-scrollbar {\n width: 0;\n height: 0;\n}\n.timeline-editor-edit-area .ReactVirtualized__Grid::-webkit-scrollbar-track {\n background-color: transparent !important;\n}\n.timeline-editor-edit-area .ReactVirtualized__Grid::-webkit-scrollbar-thumb {\n background: #666;\n border-radius: 16px;\n}\n.timeline-editor-selection-box {\n position: fixed;\n border: 2px solid #1890ff;\n background-color: rgba(24, 144, 255, 0.1);\n pointer-events: none;\n z-index: 9999;\n box-shadow: 0 0 8px rgba(24, 144, 255, 0.3);\n left: -100px;\n}\n";
2109
2111
  styleInject(css_248z$2);
2110
2112
 
2111
- var css_248z$3 = ".timeline-editor-action {\n position: absolute;\n left: 0;\n top: 0;\n background-color: #c6cbd2;\n display: flex;\n align-items: center;\n}\n.timeline-editor-action .timeline-editor-action-left-stretch,\n.timeline-editor-action .timeline-editor-action-right-stretch {\n position: absolute;\n}\n.timeline-editor-action .timeline-editor-action-left-stretch {\n left: -3px;\n}\n.timeline-editor-action .timeline-editor-action-right-stretch {\n right: -3px;\n transform: rotate(180deg);\n}\n";
2113
+ var css_248z$3 = ".timeline-editor-action {\n position: absolute;\n left: 0;\n top: 0;\n background-color: #c6cbd2;\n display: flex;\n align-items: center;\n}\n.timeline-editor-action[data-action-drag=\"true\"] {\n box-shadow: 0px 8px 8px rgba(77, 54, 41, 0.08);\n border-radius: 34px;\n}\n.timeline-editor-action .timeline-editor-action-left-stretch,\n.timeline-editor-action .timeline-editor-action-right-stretch {\n position: absolute;\n}\n.timeline-editor-action .timeline-editor-action-left-stretch {\n left: -3px;\n}\n.timeline-editor-action .timeline-editor-action-right-stretch {\n right: -3px;\n transform: rotate(180deg);\n}\n";
2112
2114
  styleInject(css_248z$3);
2113
2115
 
2114
2116
  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";
@@ -2168,6 +2170,10 @@ var EditActionO = function EditActionO(_ref) {
2168
2170
  _action$movable = action.movable,
2169
2171
  movable = _action$movable === void 0 ? true : _action$movable,
2170
2172
  effectId = action.effectId;
2173
+ var _useState = useState(false),
2174
+ _useState2 = _slicedToArray(_useState, 2),
2175
+ dragging = _useState2[0],
2176
+ setDragging = _useState2[1];
2171
2177
  var originStart = start;
2172
2178
  parserTimeToPixel(originStart, {
2173
2179
  startLeft: startLeft,
@@ -2199,7 +2205,7 @@ var EditActionO = function EditActionO(_ref) {
2199
2205
  scaleWidth: scaleWidth
2200
2206
  }));
2201
2207
  // 初始化动作坐标数据
2202
- var _useState = useState(function () {
2208
+ var _useState3 = useState(function () {
2203
2209
  return _objectSpread2(_objectSpread2({}, parserTimeToTransform({
2204
2210
  start: start,
2205
2211
  end: end
@@ -2211,9 +2217,9 @@ var EditActionO = function EditActionO(_ref) {
2211
2217
  top: 0
2212
2218
  });
2213
2219
  }),
2214
- _useState2 = _slicedToArray(_useState, 2),
2215
- transform = _useState2[0],
2216
- setTransform = _useState2[1];
2220
+ _useState4 = _slicedToArray(_useState3, 2),
2221
+ transform = _useState4[0],
2222
+ setTransform = _useState4[1];
2217
2223
  useLayoutEffect(function () {
2218
2224
  setTransform(_objectSpread2(_objectSpread2({}, parserTimeToTransform({
2219
2225
  start: start,
@@ -2246,6 +2252,7 @@ var EditActionO = function EditActionO(_ref) {
2246
2252
  //#region [rgba(100,120,156,0.08)] 回调
2247
2253
  var handleDragStart = function handleDragStart() {
2248
2254
  // 保存原始位置
2255
+ setDragging(true);
2249
2256
  originalPosition.current = {
2250
2257
  start: action.start,
2251
2258
  end: action.end
@@ -2339,6 +2346,7 @@ var EditActionO = function EditActionO(_ref) {
2339
2346
  isMultiDrag = _ref3.isMultiDrag,
2340
2347
  fnCallback = _ref3.fn;
2341
2348
  console.log('handleDragEnd: ', left, width, top, height);
2349
+ setDragging(false);
2342
2350
  // 清理预览指示器
2343
2351
  if (setDropPreview) {
2344
2352
  setDropPreview(null);
@@ -2826,6 +2834,7 @@ var EditActionO = function EditActionO(_ref) {
2826
2834
  deltaScrollTop: handleDeltaScrollTop
2827
2835
  }, /*#__PURE__*/React.createElement("div", {
2828
2836
  "data-action-id": action.id,
2837
+ "data-action-drag": dragging,
2829
2838
  "data-action-disabled": action.is_disabled ? 1 : 0,
2830
2839
  onMouseDown: function onMouseDown() {
2831
2840
  isDragWhenClick.current = false;
package/dist/index.js CHANGED
@@ -410,7 +410,9 @@ var Events = /*#__PURE__*/_createClass(function Events() {
410
410
  play: [],
411
411
  paused: [],
412
412
  ended: [],
413
- mousedown: []
413
+ mousedown: [],
414
+ "effect-play": [],
415
+ "effect-leave": []
414
416
  }, handlers);
415
417
  });
416
418
 
@@ -2117,7 +2119,7 @@ var DragLines = function DragLines(_ref) {
2117
2119
  var css_248z$2 = ".timeline-editor .ant-upload-wrapper .ant-upload-drag {\n border: none !important;\n background: none !important;\n}\n.timeline-editor:hover .timeline-editor-edit-area .ReactVirtualized__Grid::-webkit-scrollbar {\n height: 4px;\n}\n.timeline-editor-edit-area {\n flex: 1 1 auto;\n margin-top: 10px;\n overflow: hidden;\n position: relative;\n}\n.timeline-editor-edit-area.no-flex {\n flex: 0 0 auto;\n}\n.timeline-editor-edit-area.overflow-hidden {\n overflow: hidden;\n}\n.timeline-editor-edit-area.overflow-hidden .ReactVirtualized__Grid {\n overflow: hidden !important;\n height: initial !important;\n}\n.timeline-editor-edit-area .ReactVirtualized__Grid {\n outline: none !important;\n overflow: overlay !important;\n}\n.timeline-editor-edit-area .ReactVirtualized__Grid::-webkit-scrollbar {\n width: 0;\n height: 0;\n}\n.timeline-editor-edit-area .ReactVirtualized__Grid::-webkit-scrollbar-track {\n background-color: transparent !important;\n}\n.timeline-editor-edit-area .ReactVirtualized__Grid::-webkit-scrollbar-thumb {\n background: #666;\n border-radius: 16px;\n}\n.timeline-editor-selection-box {\n position: fixed;\n border: 2px solid #1890ff;\n background-color: rgba(24, 144, 255, 0.1);\n pointer-events: none;\n z-index: 9999;\n box-shadow: 0 0 8px rgba(24, 144, 255, 0.3);\n left: -100px;\n}\n";
2118
2120
  styleInject(css_248z$2);
2119
2121
 
2120
- var css_248z$3 = ".timeline-editor-action {\n position: absolute;\n left: 0;\n top: 0;\n background-color: #c6cbd2;\n display: flex;\n align-items: center;\n}\n.timeline-editor-action .timeline-editor-action-left-stretch,\n.timeline-editor-action .timeline-editor-action-right-stretch {\n position: absolute;\n}\n.timeline-editor-action .timeline-editor-action-left-stretch {\n left: -3px;\n}\n.timeline-editor-action .timeline-editor-action-right-stretch {\n right: -3px;\n transform: rotate(180deg);\n}\n";
2122
+ var css_248z$3 = ".timeline-editor-action {\n position: absolute;\n left: 0;\n top: 0;\n background-color: #c6cbd2;\n display: flex;\n align-items: center;\n}\n.timeline-editor-action[data-action-drag=\"true\"] {\n box-shadow: 0px 8px 8px rgba(77, 54, 41, 0.08);\n border-radius: 34px;\n}\n.timeline-editor-action .timeline-editor-action-left-stretch,\n.timeline-editor-action .timeline-editor-action-right-stretch {\n position: absolute;\n}\n.timeline-editor-action .timeline-editor-action-left-stretch {\n left: -3px;\n}\n.timeline-editor-action .timeline-editor-action-right-stretch {\n right: -3px;\n transform: rotate(180deg);\n}\n";
2121
2123
  styleInject(css_248z$3);
2122
2124
 
2123
2125
  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";
@@ -2177,6 +2179,10 @@ var EditActionO = function EditActionO(_ref) {
2177
2179
  _action$movable = action.movable,
2178
2180
  movable = _action$movable === void 0 ? true : _action$movable,
2179
2181
  effectId = action.effectId;
2182
+ var _useState = React.useState(false),
2183
+ _useState2 = _slicedToArray(_useState, 2),
2184
+ dragging = _useState2[0],
2185
+ setDragging = _useState2[1];
2180
2186
  var originStart = start;
2181
2187
  parserTimeToPixel(originStart, {
2182
2188
  startLeft: startLeft,
@@ -2208,7 +2214,7 @@ var EditActionO = function EditActionO(_ref) {
2208
2214
  scaleWidth: scaleWidth
2209
2215
  }));
2210
2216
  // 初始化动作坐标数据
2211
- var _useState = React.useState(function () {
2217
+ var _useState3 = React.useState(function () {
2212
2218
  return _objectSpread2(_objectSpread2({}, parserTimeToTransform({
2213
2219
  start: start,
2214
2220
  end: end
@@ -2220,9 +2226,9 @@ var EditActionO = function EditActionO(_ref) {
2220
2226
  top: 0
2221
2227
  });
2222
2228
  }),
2223
- _useState2 = _slicedToArray(_useState, 2),
2224
- transform = _useState2[0],
2225
- setTransform = _useState2[1];
2229
+ _useState4 = _slicedToArray(_useState3, 2),
2230
+ transform = _useState4[0],
2231
+ setTransform = _useState4[1];
2226
2232
  React.useLayoutEffect(function () {
2227
2233
  setTransform(_objectSpread2(_objectSpread2({}, parserTimeToTransform({
2228
2234
  start: start,
@@ -2255,6 +2261,7 @@ var EditActionO = function EditActionO(_ref) {
2255
2261
  //#region [rgba(100,120,156,0.08)] 回调
2256
2262
  var handleDragStart = function handleDragStart() {
2257
2263
  // 保存原始位置
2264
+ setDragging(true);
2258
2265
  originalPosition.current = {
2259
2266
  start: action.start,
2260
2267
  end: action.end
@@ -2348,6 +2355,7 @@ var EditActionO = function EditActionO(_ref) {
2348
2355
  isMultiDrag = _ref3.isMultiDrag,
2349
2356
  fnCallback = _ref3.fn;
2350
2357
  console.log('handleDragEnd: ', left, width, top, height);
2358
+ setDragging(false);
2351
2359
  // 清理预览指示器
2352
2360
  if (setDropPreview) {
2353
2361
  setDropPreview(null);
@@ -2835,6 +2843,7 @@ var EditActionO = function EditActionO(_ref) {
2835
2843
  deltaScrollTop: handleDeltaScrollTop
2836
2844
  }, /*#__PURE__*/React__default['default'].createElement("div", {
2837
2845
  "data-action-id": action.id,
2846
+ "data-action-drag": dragging,
2838
2847
  "data-action-disabled": action.is_disabled ? 1 : 0,
2839
2848
  onMouseDown: function onMouseDown() {
2840
2849
  isDragWhenClick.current = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sense-react-timeline-editor",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "author": "xzdarcy",
5
5
  "license": "MIT",
6
6
  "keywords": [