sense-react-timeline-editor 1.1.25 → 1.1.26
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.
|
@@ -12,6 +12,7 @@ export interface UseRowSelectionOptions {
|
|
|
12
12
|
export declare const useRowSelection: (options: UseRowSelectionOptions) => {
|
|
13
13
|
DragSelection: () => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
14
14
|
selectedActionIds: string[];
|
|
15
|
+
justFinishedSelectionRef: import("react").MutableRefObject<boolean>;
|
|
15
16
|
clearSelection: () => void;
|
|
16
17
|
onClickOutside: (target: HTMLElement) => void;
|
|
17
18
|
onCtrlClick: (actionId: string, event: MouseEvent) => void;
|
package/dist/index.esm.js
CHANGED
|
@@ -3095,6 +3095,8 @@ var useRowSelection = function useRowSelection(options) {
|
|
|
3095
3095
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3096
3096
|
selectedActionIds = _useState2[0],
|
|
3097
3097
|
setSelectedActionIds = _useState2[1];
|
|
3098
|
+
var justFinishedSelectionRef = useRef(false);
|
|
3099
|
+
var selectionResetTimerRef = useRef(null);
|
|
3098
3100
|
// 计算框选区域与 action 的交集
|
|
3099
3101
|
var getIntersectedActions = useCallback(function (box) {
|
|
3100
3102
|
var _containerRef$current, _containerRef$current2;
|
|
@@ -3160,6 +3162,14 @@ var useRowSelection = function useRowSelection(options) {
|
|
|
3160
3162
|
}
|
|
3161
3163
|
},
|
|
3162
3164
|
onSelectionEnd: function onSelectionEnd() {
|
|
3165
|
+
justFinishedSelectionRef.current = true;
|
|
3166
|
+
if (selectionResetTimerRef.current) {
|
|
3167
|
+
clearTimeout(selectionResetTimerRef.current);
|
|
3168
|
+
}
|
|
3169
|
+
selectionResetTimerRef.current = setTimeout(function () {
|
|
3170
|
+
justFinishedSelectionRef.current = false;
|
|
3171
|
+
selectionResetTimerRef.current = null;
|
|
3172
|
+
}, 0);
|
|
3163
3173
|
// 清除框选框
|
|
3164
3174
|
setTimeout(function () {
|
|
3165
3175
|
var selectionBoxes = document.querySelectorAll('.timeline-editor-selection-box');
|
|
@@ -3230,11 +3240,15 @@ var useRowSelection = function useRowSelection(options) {
|
|
|
3230
3240
|
document.addEventListener('keydown', handleKeyDown);
|
|
3231
3241
|
return function () {
|
|
3232
3242
|
document.removeEventListener('keydown', handleKeyDown);
|
|
3243
|
+
if (selectionResetTimerRef.current) {
|
|
3244
|
+
clearTimeout(selectionResetTimerRef.current);
|
|
3245
|
+
}
|
|
3233
3246
|
};
|
|
3234
3247
|
}, [handleKeyDown]);
|
|
3235
3248
|
return {
|
|
3236
3249
|
DragSelection: DragSelection,
|
|
3237
3250
|
selectedActionIds: Array.from(selectedActionIds),
|
|
3251
|
+
justFinishedSelectionRef: justFinishedSelectionRef,
|
|
3238
3252
|
clearSelection: clearSelection,
|
|
3239
3253
|
onClickOutside: handleClickOutside,
|
|
3240
3254
|
onCtrlClick: handleCtrlClick,
|
|
@@ -3904,6 +3918,7 @@ var EditAreaO = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
3904
3918
|
}),
|
|
3905
3919
|
DragSelection = _useRowSelection.DragSelection,
|
|
3906
3920
|
selectedActionIds = _useRowSelection.selectedActionIds,
|
|
3921
|
+
justFinishedSelectionRef = _useRowSelection.justFinishedSelectionRef,
|
|
3907
3922
|
onClickOutside = _useRowSelection.onClickOutside,
|
|
3908
3923
|
onCtrlClick = _useRowSelection.onCtrlClick,
|
|
3909
3924
|
setSelectedActionIds = _useRowSelection.setSelectedActionIds;
|
|
@@ -4172,6 +4187,11 @@ var EditAreaO = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
4172
4187
|
return /*#__PURE__*/React.createElement("div", {
|
|
4173
4188
|
ref: editAreaRef,
|
|
4174
4189
|
className: prefix('edit-area') + " ".concat((className || '').replace('timeline-editor', '') || ''),
|
|
4190
|
+
onClickCapture: function onClickCapture(e) {
|
|
4191
|
+
if (!justFinishedSelectionRef.current) return;
|
|
4192
|
+
e.preventDefault();
|
|
4193
|
+
e.stopPropagation();
|
|
4194
|
+
},
|
|
4175
4195
|
style: {
|
|
4176
4196
|
height: isMulti ? _totalHeight : 'unset',
|
|
4177
4197
|
maxHeight: isMulti ? _totalHeight : 'unset',
|
package/dist/index.js
CHANGED
|
@@ -3105,6 +3105,8 @@ var useRowSelection = function useRowSelection(options) {
|
|
|
3105
3105
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3106
3106
|
selectedActionIds = _useState2[0],
|
|
3107
3107
|
setSelectedActionIds = _useState2[1];
|
|
3108
|
+
var justFinishedSelectionRef = React.useRef(false);
|
|
3109
|
+
var selectionResetTimerRef = React.useRef(null);
|
|
3108
3110
|
// 计算框选区域与 action 的交集
|
|
3109
3111
|
var getIntersectedActions = React.useCallback(function (box) {
|
|
3110
3112
|
var _containerRef$current, _containerRef$current2;
|
|
@@ -3170,6 +3172,14 @@ var useRowSelection = function useRowSelection(options) {
|
|
|
3170
3172
|
}
|
|
3171
3173
|
},
|
|
3172
3174
|
onSelectionEnd: function onSelectionEnd() {
|
|
3175
|
+
justFinishedSelectionRef.current = true;
|
|
3176
|
+
if (selectionResetTimerRef.current) {
|
|
3177
|
+
clearTimeout(selectionResetTimerRef.current);
|
|
3178
|
+
}
|
|
3179
|
+
selectionResetTimerRef.current = setTimeout(function () {
|
|
3180
|
+
justFinishedSelectionRef.current = false;
|
|
3181
|
+
selectionResetTimerRef.current = null;
|
|
3182
|
+
}, 0);
|
|
3173
3183
|
// 清除框选框
|
|
3174
3184
|
setTimeout(function () {
|
|
3175
3185
|
var selectionBoxes = document.querySelectorAll('.timeline-editor-selection-box');
|
|
@@ -3240,11 +3250,15 @@ var useRowSelection = function useRowSelection(options) {
|
|
|
3240
3250
|
document.addEventListener('keydown', handleKeyDown);
|
|
3241
3251
|
return function () {
|
|
3242
3252
|
document.removeEventListener('keydown', handleKeyDown);
|
|
3253
|
+
if (selectionResetTimerRef.current) {
|
|
3254
|
+
clearTimeout(selectionResetTimerRef.current);
|
|
3255
|
+
}
|
|
3243
3256
|
};
|
|
3244
3257
|
}, [handleKeyDown]);
|
|
3245
3258
|
return {
|
|
3246
3259
|
DragSelection: DragSelection,
|
|
3247
3260
|
selectedActionIds: Array.from(selectedActionIds),
|
|
3261
|
+
justFinishedSelectionRef: justFinishedSelectionRef,
|
|
3248
3262
|
clearSelection: clearSelection,
|
|
3249
3263
|
onClickOutside: handleClickOutside,
|
|
3250
3264
|
onCtrlClick: handleCtrlClick,
|
|
@@ -3914,6 +3928,7 @@ var EditAreaO = /*#__PURE__*/React__default['default'].forwardRef(function (prop
|
|
|
3914
3928
|
}),
|
|
3915
3929
|
DragSelection = _useRowSelection.DragSelection,
|
|
3916
3930
|
selectedActionIds = _useRowSelection.selectedActionIds,
|
|
3931
|
+
justFinishedSelectionRef = _useRowSelection.justFinishedSelectionRef,
|
|
3917
3932
|
onClickOutside = _useRowSelection.onClickOutside,
|
|
3918
3933
|
onCtrlClick = _useRowSelection.onCtrlClick,
|
|
3919
3934
|
setSelectedActionIds = _useRowSelection.setSelectedActionIds;
|
|
@@ -4182,6 +4197,11 @@ var EditAreaO = /*#__PURE__*/React__default['default'].forwardRef(function (prop
|
|
|
4182
4197
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4183
4198
|
ref: editAreaRef,
|
|
4184
4199
|
className: prefix('edit-area') + " ".concat((className || '').replace('timeline-editor', '') || ''),
|
|
4200
|
+
onClickCapture: function onClickCapture(e) {
|
|
4201
|
+
if (!justFinishedSelectionRef.current) return;
|
|
4202
|
+
e.preventDefault();
|
|
4203
|
+
e.stopPropagation();
|
|
4204
|
+
},
|
|
4185
4205
|
style: {
|
|
4186
4206
|
height: isMulti ? _totalHeight : 'unset',
|
|
4187
4207
|
maxHeight: isMulti ? _totalHeight : 'unset',
|