@adaptabletools/adaptable 23.0.10 → 23.0.12
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/index.css +164 -341
- package/package.json +1 -1
- package/src/View/Components/AdaptableInput/AdaptableDateInlineInput.js +1 -1
- package/src/View/Components/AdaptableInput/index.d.ts +1 -0
- package/src/View/Components/AdaptableInput/index.js +2 -2
- package/src/View/Components/ColumnFilter/ColumnFilter.js +1 -1
- package/src/View/Components/ColumnFilter/components/ColumnFilterInput.d.ts +1 -2
- package/src/View/Components/ColumnFilter/components/FloatingFilterInputList.js +3 -3
- package/src/components/Combobox/VirtualizedList.js +7 -1
- package/src/components/Combobox/comboboxUtils.d.ts +8 -0
- package/src/components/Combobox/index.js +9 -7
- package/src/components/Datepicker/index.js +5 -0
- package/src/components/NewSelect/index.js +4 -4
- package/src/components/Tree/TreeDropdown/index.js +1 -0
- package/src/components/WindowModal/WindowModal.d.ts +6 -0
- package/src/components/WindowModal/WindowModal.js +232 -31
- package/src/components/ui/combobox.js +45 -15
- package/src/components/utils/useDraggable.d.ts +3 -1
- package/src/components/utils/useDraggable.js +67 -44
- package/src/env.js +2 -2
- package/tsconfig.esm.tsbuildinfo +1 -1
|
@@ -2,29 +2,34 @@ import { useRef, useCallback, useEffect } from 'react';
|
|
|
2
2
|
function clamp(num, min, max) {
|
|
3
3
|
return num <= min ? min : num >= max ? max : num;
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
const getTranslationBounds = (targetRect, boundingRect) => {
|
|
6
|
+
const left = boundingRect.x - targetRect.x;
|
|
7
|
+
const right = left + boundingRect.width - targetRect.width;
|
|
8
|
+
const top = boundingRect.y - targetRect.y;
|
|
9
|
+
const bottom = top + boundingRect.height - targetRect.height;
|
|
10
|
+
return { left, right, top, bottom };
|
|
11
|
+
};
|
|
12
|
+
const applyEdgeOffsetToBoundingRect = (boundingRect, edgeOffset) => {
|
|
13
|
+
if (!edgeOffset) {
|
|
14
|
+
return boundingRect;
|
|
15
|
+
}
|
|
16
|
+
return new DOMRect(boundingRect.x + edgeOffset, boundingRect.y + edgeOffset, boundingRect.width - 2 * edgeOffset, boundingRect.height - 2 * edgeOffset);
|
|
17
|
+
};
|
|
18
|
+
export default function useDraggable({ onMove, onDrop, getBoundingRect = () => document.body.getBoundingClientRect(), handleSelector, edgeOffset = 0, }) {
|
|
6
19
|
const startRef = useRef(null);
|
|
7
20
|
const handleRef = useRef(null);
|
|
8
21
|
const targetRef = useRef(null);
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (handleSelector) {
|
|
22
|
-
setTimeout(() => {
|
|
23
|
-
const node = targetRef?.current?.querySelector(handleSelector);
|
|
24
|
-
node && handleRefCallback(node);
|
|
25
|
-
}, 16);
|
|
26
|
-
}
|
|
27
|
-
}, [handleSelector]);
|
|
22
|
+
const onMoveRef = useRef(onMove);
|
|
23
|
+
const onDropRef = useRef(onDrop);
|
|
24
|
+
const getBoundingRectRef = useRef(getBoundingRect);
|
|
25
|
+
const edgeOffsetRef = useRef(edgeOffset);
|
|
26
|
+
onMoveRef.current = onMove;
|
|
27
|
+
onDropRef.current = onDrop;
|
|
28
|
+
getBoundingRectRef.current = getBoundingRect;
|
|
29
|
+
edgeOffsetRef.current = edgeOffset;
|
|
30
|
+
const getEffectiveBoundingRect = () => {
|
|
31
|
+
return applyEdgeOffsetToBoundingRect(getBoundingRectRef.current(), edgeOffsetRef.current);
|
|
32
|
+
};
|
|
28
33
|
const applyTransform = (dx, dy) => {
|
|
29
34
|
if (!targetRef.current)
|
|
30
35
|
return;
|
|
@@ -39,12 +44,19 @@ export default function useDraggable({ onMove, onDrop, getBoundingRect = () => d
|
|
|
39
44
|
dy: clamp(event.pageY - pageY, bounds.top, bounds.bottom),
|
|
40
45
|
};
|
|
41
46
|
};
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
47
|
+
const handleMouseUp = (event) => {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
50
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
51
|
+
const { dx, dy } = getTranslation(event);
|
|
52
|
+
applyTransform(0, 0);
|
|
53
|
+
onDropRef.current?.(dx, dy);
|
|
54
|
+
};
|
|
55
|
+
const handleMouseMove = (event) => {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
const { dx, dy } = getTranslation(event);
|
|
58
|
+
applyTransform(dx, dy);
|
|
59
|
+
onMoveRef.current?.(event);
|
|
48
60
|
};
|
|
49
61
|
const handleMouseDown = (event) => {
|
|
50
62
|
if (!targetRef.current)
|
|
@@ -53,37 +65,48 @@ export default function useDraggable({ onMove, onDrop, getBoundingRect = () => d
|
|
|
53
65
|
document.addEventListener('mouseup', handleMouseUp);
|
|
54
66
|
document.addEventListener('mousemove', handleMouseMove);
|
|
55
67
|
const targetRect = targetRef.current.getBoundingClientRect();
|
|
56
|
-
const boundingRect =
|
|
68
|
+
const boundingRect = getEffectiveBoundingRect();
|
|
57
69
|
startRef.current = {
|
|
58
70
|
pageX: event.pageX,
|
|
59
71
|
pageY: event.pageY,
|
|
60
72
|
bounds: getTranslationBounds(targetRect, boundingRect),
|
|
61
73
|
};
|
|
62
74
|
};
|
|
63
|
-
const handleMouseUp = (event) => {
|
|
64
|
-
event.preventDefault();
|
|
65
|
-
document.removeEventListener('mouseup', handleMouseUp);
|
|
66
|
-
document.removeEventListener('mousemove', handleMouseMove);
|
|
67
|
-
const { dx, dy } = getTranslation(event);
|
|
68
|
-
applyTransform(0, 0);
|
|
69
|
-
onDrop && onDrop(dx, dy);
|
|
70
|
-
};
|
|
71
|
-
const handleMouseMove = (event) => {
|
|
72
|
-
event.preventDefault();
|
|
73
|
-
const { dx, dy } = getTranslation(event);
|
|
74
|
-
applyTransform(dx, dy);
|
|
75
|
-
onMove && onMove(event);
|
|
76
|
-
};
|
|
77
75
|
const boundInitialPosition = () => {
|
|
78
76
|
if (!targetRef.current)
|
|
79
77
|
return;
|
|
80
78
|
const targetRect = targetRef.current.getBoundingClientRect();
|
|
81
|
-
const boundingRect =
|
|
79
|
+
const boundingRect = getEffectiveBoundingRect();
|
|
82
80
|
const bounds = getTranslationBounds(targetRect, boundingRect);
|
|
83
81
|
const dx = clamp(0, bounds.left, bounds.right);
|
|
84
82
|
const dy = clamp(0, bounds.top, bounds.bottom);
|
|
85
|
-
if (
|
|
86
|
-
|
|
83
|
+
if (onDropRef.current && (dx !== 0 || dy !== 0)) {
|
|
84
|
+
onDropRef.current(dx, dy);
|
|
85
|
+
}
|
|
87
86
|
};
|
|
87
|
+
const handleMouseDownRef = useRef(handleMouseDown);
|
|
88
|
+
handleMouseDownRef.current = handleMouseDown;
|
|
89
|
+
const stableHandleMouseDown = useCallback((event) => {
|
|
90
|
+
handleMouseDownRef.current(event);
|
|
91
|
+
}, []);
|
|
92
|
+
const handleRefCallback = useCallback((newNode) => {
|
|
93
|
+
const oldNode = handleRef.current;
|
|
94
|
+
if (oldNode) {
|
|
95
|
+
oldNode.removeEventListener('mousedown', stableHandleMouseDown);
|
|
96
|
+
}
|
|
97
|
+
if (newNode) {
|
|
98
|
+
newNode.addEventListener('mousedown', stableHandleMouseDown);
|
|
99
|
+
boundInitialPosition();
|
|
100
|
+
}
|
|
101
|
+
handleRef.current = newNode;
|
|
102
|
+
}, [stableHandleMouseDown]);
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (handleSelector) {
|
|
105
|
+
setTimeout(() => {
|
|
106
|
+
const node = targetRef?.current?.querySelector(handleSelector);
|
|
107
|
+
node && handleRefCallback(node);
|
|
108
|
+
}, 16);
|
|
109
|
+
}
|
|
110
|
+
}, [handleSelector, handleRefCallback]);
|
|
88
111
|
return { handleRef: handleRefCallback, targetRef, applyTransform };
|
|
89
112
|
}
|
package/src/env.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
|
|
3
|
-
PUBLISH_TIMESTAMP:
|
|
4
|
-
VERSION: "23.0.
|
|
3
|
+
PUBLISH_TIMESTAMP: 1784554794411 || Date.now(),
|
|
4
|
+
VERSION: "23.0.12" || '--current-version--',
|
|
5
5
|
};
|