react-science 14.0.0 → 15.0.0
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/lib/components/index.d.ts +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/split_pane/index.d.ts +3 -0
- package/lib/components/split_pane/index.d.ts.map +1 -0
- package/lib/components/split_pane/index.js +3 -0
- package/lib/components/split_pane/index.js.map +1 -0
- package/lib/components/{split-pane/SplitPane.d.ts → split_pane/split_pane.d.ts} +7 -5
- package/lib/components/split_pane/split_pane.d.ts.map +1 -0
- package/lib/components/{split-pane/SplitPane.js → split_pane/split_pane.js} +25 -32
- package/lib/components/split_pane/split_pane.js.map +1 -0
- package/lib/components/split_pane/split_pane_helpers.d.ts +9 -0
- package/lib/components/split_pane/split_pane_helpers.d.ts.map +1 -0
- package/lib/components/split_pane/split_pane_helpers.js +10 -0
- package/lib/components/split_pane/split_pane_helpers.js.map +1 -0
- package/lib/components/{split-pane/useSplitPaneSize.d.ts → split_pane/use_split_pane_size.d.ts} +5 -3
- package/lib/components/split_pane/use_split_pane_size.d.ts.map +1 -0
- package/lib/components/split_pane/use_split_pane_size.js +78 -0
- package/lib/components/split_pane/use_split_pane_size.js.map +1 -0
- package/lib/components/table/index.d.ts +1 -0
- package/lib/components/table/index.d.ts.map +1 -1
- package/lib/components/table/index.js +1 -0
- package/lib/components/table/index.js.map +1 -1
- package/lib/components/table/reorder_rows/draggable_row_context.d.ts +9 -0
- package/lib/components/table/reorder_rows/draggable_row_context.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/draggable_row_context.js +10 -0
- package/lib/components/table/reorder_rows/draggable_row_context.js.map +1 -0
- package/lib/components/table/reorder_rows/draggable_row_tr.d.ts +18 -0
- package/lib/components/table/reorder_rows/draggable_row_tr.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/draggable_row_tr.js +107 -0
- package/lib/components/table/reorder_rows/draggable_row_tr.js.map +1 -0
- package/lib/components/table/reorder_rows/drop_indicator.d.ts +18 -0
- package/lib/components/table/reorder_rows/drop_indicator.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/drop_indicator.js +19 -0
- package/lib/components/table/reorder_rows/drop_indicator.js.map +1 -0
- package/lib/components/table/reorder_rows/dropped_item_context.d.ts +3 -0
- package/lib/components/table/reorder_rows/dropped_item_context.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/dropped_item_context.js +10 -0
- package/lib/components/table/reorder_rows/dropped_item_context.js.map +1 -0
- package/lib/components/table/reorder_rows/dropped_item_provider.d.ts +5 -0
- package/lib/components/table/reorder_rows/dropped_item_provider.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/dropped_item_provider.js +8 -0
- package/lib/components/table/reorder_rows/dropped_item_provider.js.map +1 -0
- package/lib/components/table/reorder_rows/index.d.ts +5 -0
- package/lib/components/table/reorder_rows/index.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/index.js +5 -0
- package/lib/components/table/reorder_rows/index.js.map +1 -0
- package/lib/components/table/reorder_rows/item_data.d.ts +26 -0
- package/lib/components/table/reorder_rows/item_data.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/item_data.js +13 -0
- package/lib/components/table/reorder_rows/item_data.js.map +1 -0
- package/lib/components/table/reorder_rows/item_order_context.d.ts +15 -0
- package/lib/components/table/reorder_rows/item_order_context.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/item_order_context.js +10 -0
- package/lib/components/table/reorder_rows/item_order_context.js.map +1 -0
- package/lib/components/table/reorder_rows/item_order_provider.d.ts +10 -0
- package/lib/components/table/reorder_rows/item_order_provider.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/item_order_provider.js +34 -0
- package/lib/components/table/reorder_rows/item_order_provider.js.map +1 -0
- package/lib/components/table/reorder_rows/table_drag_row_handler.d.ts +2 -0
- package/lib/components/table/reorder_rows/table_drag_row_handler.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/table_drag_row_handler.js +9 -0
- package/lib/components/table/reorder_rows/table_drag_row_handler.js.map +1 -0
- package/lib/components/table/reorder_rows/use_drop_monitor.d.ts +9 -0
- package/lib/components/table/reorder_rows/use_drop_monitor.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/use_drop_monitor.js +57 -0
- package/lib/components/table/reorder_rows/use_drop_monitor.js.map +1 -0
- package/lib/components/table/table_body.d.ts +4 -1
- package/lib/components/table/table_body.d.ts.map +1 -1
- package/lib/components/table/table_body.js +20 -6
- package/lib/components/table/table_body.js.map +1 -1
- package/lib/components/table/table_root.d.ts +37 -1
- package/lib/components/table/table_root.d.ts.map +1 -1
- package/lib/components/table/table_root.js +41 -7
- package/lib/components/table/table_root.js.map +1 -1
- package/lib/components/table/table_row_cell.d.ts +2 -1
- package/lib/components/table/table_row_cell.d.ts.map +1 -1
- package/lib/components/table/table_row_cell.js +2 -2
- package/lib/components/table/table_row_cell.js.map +1 -1
- package/lib/components/table/table_utils.d.ts +11 -2
- package/lib/components/table/table_utils.d.ts.map +1 -1
- package/lib/components/table/table_utils.js.map +1 -1
- package/package.json +4 -1
- package/src/components/index.ts +1 -1
- package/src/components/split_pane/index.ts +2 -0
- package/src/components/{split-pane/SplitPane.tsx → split_pane/split_pane.tsx} +63 -56
- package/src/components/split_pane/split_pane_helpers.ts +19 -0
- package/src/components/split_pane/use_split_pane_size.tsx +120 -0
- package/src/components/table/index.ts +1 -0
- package/src/components/table/reorder_rows/draggable_row_context.ts +23 -0
- package/src/components/table/reorder_rows/draggable_row_tr.tsx +166 -0
- package/src/components/table/reorder_rows/drop_indicator.tsx +28 -0
- package/src/components/table/reorder_rows/dropped_item_context.ts +23 -0
- package/src/components/table/reorder_rows/dropped_item_provider.tsx +13 -0
- package/src/components/table/reorder_rows/index.ts +4 -0
- package/src/components/table/reorder_rows/item_data.ts +33 -0
- package/src/components/table/reorder_rows/item_order_context.ts +27 -0
- package/src/components/table/reorder_rows/item_order_provider.tsx +61 -0
- package/src/components/table/reorder_rows/table_drag_row_handler.tsx +22 -0
- package/src/components/table/reorder_rows/use_drop_monitor.ts +74 -0
- package/src/components/table/table_body.tsx +58 -9
- package/src/components/table/table_root.tsx +167 -35
- package/src/components/table/table_row_cell.tsx +5 -3
- package/src/components/table/table_utils.ts +16 -2
- package/lib/components/split-pane/SplitPane.d.ts.map +0 -1
- package/lib/components/split-pane/SplitPane.js.map +0 -1
- package/lib/components/split-pane/index.d.ts +0 -2
- package/lib/components/split-pane/index.d.ts.map +0 -1
- package/lib/components/split-pane/index.js +0 -2
- package/lib/components/split-pane/index.js.map +0 -1
- package/lib/components/split-pane/useSplitPaneSize.d.ts.map +0 -1
- package/lib/components/split-pane/useSplitPaneSize.js +0 -60
- package/lib/components/split-pane/useSplitPaneSize.js.map +0 -1
- package/src/components/split-pane/index.ts +0 -1
- package/src/components/split-pane/useSplitPaneSize.tsx +0 -99
|
@@ -10,7 +10,7 @@ export * from './hooks/index.js';
|
|
|
10
10
|
export * from './info-panel/index.js';
|
|
11
11
|
export * from './logger/index.js';
|
|
12
12
|
export * from './root-layout/index.js';
|
|
13
|
-
export * from './
|
|
13
|
+
export * from './split_pane/index.js';
|
|
14
14
|
export * from './table/index.js';
|
|
15
15
|
export * from './toolbar/index.js';
|
|
16
16
|
export * from './activity_bar/index.js';
|
package/lib/components/index.js
CHANGED
|
@@ -10,7 +10,7 @@ export * from './hooks/index.js';
|
|
|
10
10
|
export * from './info-panel/index.js';
|
|
11
11
|
export * from './logger/index.js';
|
|
12
12
|
export * from './root-layout/index.js';
|
|
13
|
-
export * from './
|
|
13
|
+
export * from './split_pane/index.js';
|
|
14
14
|
export * from './table/index.js';
|
|
15
15
|
export * from './toolbar/index.js';
|
|
16
16
|
export * from './activity_bar/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/split_pane/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/split_pane/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
import type { SplitPaneSize } from './split_pane_helpers.js';
|
|
2
3
|
export type SplitPaneDirection = 'vertical' | 'horizontal';
|
|
3
4
|
export type SplitPaneSide = 'start' | 'end';
|
|
4
|
-
export type SplitPaneSize = `${number}%` | `${number}px`;
|
|
5
|
-
export type SplitPaneType = '%' | 'px';
|
|
6
5
|
export interface SplitPaneProps {
|
|
7
6
|
/**
|
|
8
7
|
* Whether the split is done in the horizontal or vertical direction.
|
|
@@ -44,8 +43,8 @@ export interface SplitPaneProps {
|
|
|
44
43
|
* If specified, closes / opens the pane automatically once the available space
|
|
45
44
|
* for the SplitPane along the axis defined by the `direction` prop becomes
|
|
46
45
|
* smaller / larger (respectively) than this value. The value is in pixels.
|
|
47
|
-
* After the user
|
|
48
|
-
*
|
|
46
|
+
* After the user interacts with the splitter, the pane will no longer open
|
|
47
|
+
* or close automatically.
|
|
49
48
|
*/
|
|
50
49
|
closeThreshold?: number;
|
|
51
50
|
/**
|
|
@@ -62,8 +61,11 @@ export interface SplitPaneProps {
|
|
|
62
61
|
onSizeChange?: (size: SplitPaneSize) => void;
|
|
63
62
|
/**
|
|
64
63
|
* The two React elements to show on both sides of the pane.
|
|
64
|
+
* If one of the elements is `null`, the splitter will disappear and the
|
|
65
|
+
* other element will take the full space.
|
|
66
|
+
* If both elements are `null`, only a container will be rendered.
|
|
65
67
|
*/
|
|
66
68
|
children: [ReactNode, ReactNode];
|
|
67
69
|
}
|
|
68
70
|
export declare function SplitPane(props: SplitPaneProps): import("react/jsx-runtime").JSX.Element;
|
|
69
|
-
//# sourceMappingURL=
|
|
71
|
+
//# sourceMappingURL=split_pane.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split_pane.d.ts","sourceRoot":"","sources":["../../../src/components/split_pane/split_pane.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,SAAS,EAEV,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,yBAAyB,CAAC;AAI5E,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,YAAY,CAAC;AAC3D,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,KAAK,CAAC;AAE5C,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC;IAE/B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC;IAE5B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAEzC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;IAE7C;;OAEG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAE7C;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;CAClC;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CAmG9C"}
|
|
@@ -5,7 +5,8 @@ import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
|
5
5
|
import { useEffect, useReducer, useRef } from 'react';
|
|
6
6
|
import { match } from 'ts-pattern';
|
|
7
7
|
import useResizeObserver from 'use-resize-observer';
|
|
8
|
-
import {
|
|
8
|
+
import { parseSize, serializeSize } from './split_pane_helpers.js';
|
|
9
|
+
import { useSplitPaneSize } from './use_split_pane_size.js';
|
|
9
10
|
export function SplitPane(props) {
|
|
10
11
|
const { direction = 'horizontal', controlledSide = 'start', defaultSize = '50%', defaultOpen = true, open: openProp, size: sizeProp, onSizeChange, closeThreshold = null, onResize, onOpenChange, children, } = props;
|
|
11
12
|
const [isOpen, setIsOpen] = useControllableState({
|
|
@@ -18,11 +19,11 @@ export function SplitPane(props) {
|
|
|
18
19
|
defaultProp: defaultSize,
|
|
19
20
|
onChange: onSizeChange,
|
|
20
21
|
});
|
|
21
|
-
const
|
|
22
|
+
const { type: sizeType, value: splitSize } = parseSize(size ?? defaultSize);
|
|
22
23
|
// Whether the user has already interacted with the pane.
|
|
23
24
|
const [hasTouched, touch] = useReducer(() => true, false);
|
|
24
25
|
const splitterRef = useRef(null);
|
|
25
|
-
const { onPointerDown } = useSplitPaneSize({
|
|
26
|
+
const { onPointerDown, isResizing } = useSplitPaneSize({
|
|
26
27
|
controlledSide,
|
|
27
28
|
direction,
|
|
28
29
|
splitterRef,
|
|
@@ -54,31 +55,16 @@ export function SplitPane(props) {
|
|
|
54
55
|
function getSplitSideStyle(side) {
|
|
55
56
|
return getItemStyle(isOpen ?? defaultOpen, controlledSide === side, direction, splitSize, sizeType);
|
|
56
57
|
}
|
|
57
|
-
return (_jsxs(
|
|
58
|
-
display: 'flex',
|
|
59
|
-
height: '100%',
|
|
60
|
-
width: '100%',
|
|
61
|
-
[direction === 'horizontal' ? 'minWidth' : 'minHeight']: 0,
|
|
62
|
-
flexDirection: direction === 'horizontal' ? 'row' : 'column',
|
|
63
|
-
}, children: [_jsx(SplitSide, { style: getSplitSideStyle('start'), children: children[0] }), _jsx(Splitter, { onDoubleClick: handleToggle, onPointerDown: isOpen ? onPointerDown : undefined, isOpen: isOpen ?? defaultOpen, direction: direction, splitterRef: splitterRef }), _jsx(SplitSide, { style: getSplitSideStyle('end'), children: children[1] })] }));
|
|
58
|
+
return (_jsxs(SplitPaneContainer, { direction: direction, ref: rootSize.ref, children: [children[0] !== null && (_jsx(SplitSide, { style: getSplitSideStyle('start'), children: children[0] })), children[0] !== null && children[1] !== null && (_jsx(Splitter, { onDoubleClick: handleToggle, onPointerDown: isOpen ? onPointerDown : undefined, isOpen: isOpen ?? defaultOpen, isResizing: isResizing, direction: direction, splitterRef: splitterRef })), children[1] !== null && (_jsx(SplitSide, { style: getSplitSideStyle('end'), children: children[1] }))] }));
|
|
64
59
|
}
|
|
65
60
|
function Splitter(props) {
|
|
66
|
-
const { onDoubleClick, onPointerDown, direction, isOpen, splitterRef } = props;
|
|
67
|
-
return (_jsx(Split, { onDoubleClick: onDoubleClick, onPointerDown: onPointerDown, enabled: isOpen, direction: direction, ref: splitterRef, children: _jsx(SplitContent, { children: direction === 'horizontal' ? '⋮' : '⋯' }) }));
|
|
61
|
+
const { onDoubleClick, onPointerDown, direction, isOpen, isResizing, splitterRef, } = props;
|
|
62
|
+
return (_jsx(Split, { onDoubleClick: onDoubleClick, onPointerDown: onPointerDown, enabled: isOpen, direction: direction, isResizing: isResizing, ref: splitterRef, children: _jsx(SplitContent, { children: direction === 'horizontal' ? '⋮' : '⋯' }) }));
|
|
68
63
|
}
|
|
69
64
|
function SplitSide(props) {
|
|
70
65
|
const { style, children } = props;
|
|
71
66
|
return _jsx("div", { style: style, children: children });
|
|
72
67
|
}
|
|
73
|
-
function parseSize(size) {
|
|
74
|
-
const value = Number.parseFloat(size);
|
|
75
|
-
// remove numbers and dots from the string
|
|
76
|
-
const type = size.replaceAll(/[\d .]/g, '');
|
|
77
|
-
return [value, type];
|
|
78
|
-
}
|
|
79
|
-
function serializeSize(size) {
|
|
80
|
-
return `${size[0]}${size[1]}`;
|
|
81
|
-
}
|
|
82
68
|
const flexBase = 100;
|
|
83
69
|
function percentToFlex(percent) {
|
|
84
70
|
percent /= 100;
|
|
@@ -86,38 +72,37 @@ function percentToFlex(percent) {
|
|
|
86
72
|
}
|
|
87
73
|
function getItemStyle(isOpen, isControlledSide, direction, size, type) {
|
|
88
74
|
const isHorizontal = direction === 'horizontal';
|
|
75
|
+
const base = { display: 'flex', overflow: 'hidden' };
|
|
89
76
|
if (!isOpen) {
|
|
90
|
-
return isControlledSide
|
|
91
|
-
? { display: 'none' }
|
|
92
|
-
: { flex: '1 1 0%', display: 'flex' };
|
|
77
|
+
return isControlledSide ? { display: 'none' } : { flex: '1 1 0%', ...base };
|
|
93
78
|
}
|
|
94
|
-
else if (type === '%') {
|
|
79
|
+
else if (type === '%' && size !== 0) {
|
|
95
80
|
return isControlledSide
|
|
96
81
|
? {
|
|
82
|
+
...base,
|
|
97
83
|
flex: '100 0 0%',
|
|
98
|
-
display: 'flex',
|
|
99
84
|
}
|
|
100
85
|
: {
|
|
86
|
+
...base,
|
|
101
87
|
flex: `${percentToFlex(size)} 0 0%`,
|
|
102
|
-
display: 'flex',
|
|
103
88
|
[isHorizontal ? 'minWidth' : 'minHeight']: 0,
|
|
104
89
|
};
|
|
105
90
|
}
|
|
106
91
|
else {
|
|
107
92
|
return isControlledSide
|
|
108
93
|
? {
|
|
94
|
+
...base,
|
|
109
95
|
[isHorizontal ? 'width' : 'height']: size,
|
|
110
|
-
display: 'flex',
|
|
111
96
|
}
|
|
112
97
|
: {
|
|
98
|
+
...base,
|
|
113
99
|
flex: '1 1 0%',
|
|
114
|
-
display: 'flex',
|
|
115
100
|
[isHorizontal ? 'minWidth' : 'minHeight']: 0,
|
|
116
101
|
};
|
|
117
102
|
}
|
|
118
103
|
}
|
|
119
104
|
const Split = styled.div `
|
|
120
|
-
background-color: ${Colors.LIGHT_GRAY5};
|
|
105
|
+
background-color: ${(props) => props.isResizing ? Colors.LIGHT_GRAY3 : Colors.LIGHT_GRAY5};
|
|
121
106
|
display: flex;
|
|
122
107
|
justify-content: center;
|
|
123
108
|
align-items: center;
|
|
@@ -126,7 +111,7 @@ const Split = styled.div `
|
|
|
126
111
|
touch-action: none;
|
|
127
112
|
|
|
128
113
|
:hover {
|
|
129
|
-
background-color: ${Colors.LIGHT_GRAY3};
|
|
114
|
+
background-color: ${(props) => props.isResizing ? Colors.LIGHT_GRAY3 : Colors.LIGHT_GRAY4};
|
|
130
115
|
}
|
|
131
116
|
|
|
132
117
|
${(props) => match(props.direction)
|
|
@@ -140,6 +125,14 @@ const Split = styled.div `
|
|
|
140
125
|
`)
|
|
141
126
|
.exhaustive()}
|
|
142
127
|
`;
|
|
128
|
+
const SplitPaneContainer = styled.div `
|
|
129
|
+
display: flex;
|
|
130
|
+
height: 100%;
|
|
131
|
+
width: 100%;
|
|
132
|
+
overflow: hidden;
|
|
133
|
+
${(props) => props.direction === 'horizontal' ? 'min-width: 0;' : 'min-height: 0;'}
|
|
134
|
+
flex-direction: ${(props) => props.direction === 'horizontal' ? 'row' : 'column'};
|
|
135
|
+
`;
|
|
143
136
|
const SplitContent = styled.div `
|
|
144
137
|
display: flex;
|
|
145
138
|
align-items: center;
|
|
@@ -147,4 +140,4 @@ const SplitContent = styled.div `
|
|
|
147
140
|
font-size: 0.875em;
|
|
148
141
|
max-height: 100%;
|
|
149
142
|
`;
|
|
150
|
-
//# sourceMappingURL=
|
|
143
|
+
//# sourceMappingURL=split_pane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split_pane.js","sourceRoot":"","sources":["../../../src/components/split_pane/split_pane.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAO9E,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,SAAS,EA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AC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW;;;IAG5D,CAAC,KAAK,EAAE,EAAE,CACV,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC;KACnB,IAAI,CACH,YAAY,EACZ,GAAG,EAAE,CAAC;kBACI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;;OAElD,CACA;KACA,IAAI,CACH,UAAU,EACV,GAAG,EAAE,CAAC;;kBAEI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;OAClD,CACA;KACA,UAAU,EAAE;CAClB,CAAC;AAEF,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAmC;;;;;IAKpE,CAAC,KAAK,EAAE,EAAE,CACV,KAAK,CAAC,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB;oBACrD,CAAC,KAAK,EAAE,EAAE,CAC1B,KAAK,CAAC,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ;CACtD,CAAC;AAEF,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;CAM9B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type SplitPaneSize = `${number}%` | `${number}px`;
|
|
2
|
+
export type SplitPaneType = '%' | 'px';
|
|
3
|
+
export interface ParsedSplitPaneSize {
|
|
4
|
+
value: number;
|
|
5
|
+
type: SplitPaneType;
|
|
6
|
+
}
|
|
7
|
+
export declare function parseSize(size: string): ParsedSplitPaneSize;
|
|
8
|
+
export declare function serializeSize(size: ParsedSplitPaneSize): SplitPaneSize;
|
|
9
|
+
//# sourceMappingURL=split_pane_helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split_pane_helpers.d.ts","sourceRoot":"","sources":["../../../src/components/split_pane/split_pane_helpers.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,GAAG,MAAM,GAAG,GAAG,GAAG,MAAM,IAAI,CAAC;AACzD,MAAM,MAAM,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC;AAEvC,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAM3D;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,mBAAmB,GAAG,aAAa,CAEtE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function parseSize(size) {
|
|
2
|
+
const value = Number.parseFloat(size);
|
|
3
|
+
// remove numbers and dots from the string
|
|
4
|
+
const type = size.replaceAll(/[\d .]/g, '');
|
|
5
|
+
return { value, type };
|
|
6
|
+
}
|
|
7
|
+
export function serializeSize(size) {
|
|
8
|
+
return `${size.value}${size.type}`;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=split_pane_helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split_pane_helpers.js","sourceRoot":"","sources":["../../../src/components/split_pane/split_pane_helpers.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,0CAA0C;IAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE,CAAkB,CAAC;IAE7D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAyB;IACrD,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;AACrC,CAAC"}
|
package/lib/components/{split-pane/useSplitPaneSize.d.ts → split_pane/use_split_pane_size.d.ts}
RENAMED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
|
-
import type { SplitPaneDirection, SplitPaneSide
|
|
2
|
+
import type { SplitPaneDirection, SplitPaneSide } from './split_pane.js';
|
|
3
|
+
import type { ParsedSplitPaneSize, SplitPaneSize, SplitPaneType } from './split_pane_helpers.js';
|
|
3
4
|
interface UseSplitPaneSizeOptions {
|
|
4
5
|
controlledSide: SplitPaneSide;
|
|
5
6
|
direction: SplitPaneDirection;
|
|
6
7
|
splitterRef: RefObject<HTMLDivElement>;
|
|
7
8
|
sizeType: SplitPaneType;
|
|
8
|
-
onSizeChange: (newSize:
|
|
9
|
+
onSizeChange: (newSize: ParsedSplitPaneSize) => void;
|
|
9
10
|
onResize?: (newSize: SplitPaneSize) => void;
|
|
10
11
|
}
|
|
11
12
|
export declare function useSplitPaneSize(options: UseSplitPaneSizeOptions): {
|
|
12
13
|
onPointerDown: () => void;
|
|
14
|
+
isResizing: boolean;
|
|
13
15
|
};
|
|
14
16
|
export {};
|
|
15
|
-
//# sourceMappingURL=
|
|
17
|
+
//# sourceMappingURL=use_split_pane_size.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_split_pane_size.d.ts","sourceRoot":"","sources":["../../../src/components/split_pane/use_split_pane_size.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACb,aAAa,EACd,MAAM,yBAAyB,CAAC;AAGjC,UAAU,uBAAuB;IAC/B,cAAc,EAAE,aAAa,CAAC;IAC9B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,WAAW,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IACvC,QAAQ,EAAE,aAAa,CAAC;IACxB,YAAY,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACrD,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;CAC7C;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB;;;EAuFhE"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { serializeSize } from './split_pane_helpers.js';
|
|
3
|
+
export function useSplitPaneSize(options) {
|
|
4
|
+
const { controlledSide, direction, splitterRef, sizeType, onSizeChange, onResize, } = options;
|
|
5
|
+
const [isResizing, setIsResizing] = useState(false);
|
|
6
|
+
const onPointerDown = useCallback(() => {
|
|
7
|
+
setIsResizing(true);
|
|
8
|
+
}, []);
|
|
9
|
+
const onResizeRef = useRef(onResize);
|
|
10
|
+
const onSizeChangeRef = useRef(onSizeChange);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
onResizeRef.current = onResize;
|
|
13
|
+
onSizeChangeRef.current = onSizeChange;
|
|
14
|
+
}, [onResize, onSizeChange]);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (isResizing) {
|
|
17
|
+
let lastSize = null;
|
|
18
|
+
function moveCallback(event) {
|
|
19
|
+
if (!splitterRef.current)
|
|
20
|
+
return;
|
|
21
|
+
const { clientX, clientY } = event;
|
|
22
|
+
const parentDiv = splitterRef.current.parentElement;
|
|
23
|
+
const bounds = parentDiv.getBoundingClientRect();
|
|
24
|
+
const parentDimension = direction === 'horizontal'
|
|
25
|
+
? parentDiv.clientWidth
|
|
26
|
+
: parentDiv.clientHeight;
|
|
27
|
+
const client = direction === 'horizontal'
|
|
28
|
+
? clientX - bounds.left
|
|
29
|
+
: clientY - bounds.top;
|
|
30
|
+
const centralizingValue = direction === 'horizontal'
|
|
31
|
+
? splitterRef.current.clientWidth / 2
|
|
32
|
+
: splitterRef.current.clientHeight / 2;
|
|
33
|
+
const value = controlledSide === 'start' ? client : parentDimension - client;
|
|
34
|
+
if (sizeType === 'px') {
|
|
35
|
+
const newSize = getValueFromSplitter(value - centralizingValue, {
|
|
36
|
+
min: 0,
|
|
37
|
+
max: parentDimension,
|
|
38
|
+
});
|
|
39
|
+
lastSize = { value: newSize, type: sizeType };
|
|
40
|
+
onSizeChangeRef.current?.(lastSize);
|
|
41
|
+
}
|
|
42
|
+
else if (sizeType === '%') {
|
|
43
|
+
const valueDiff = (value / parentDimension) * 100;
|
|
44
|
+
const newSize = getValueFromSplitter(valueDiff, {
|
|
45
|
+
min: 0,
|
|
46
|
+
max: 100,
|
|
47
|
+
});
|
|
48
|
+
lastSize = { value: newSize, type: sizeType };
|
|
49
|
+
onSizeChangeRef.current?.(lastSize);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function upCallback() {
|
|
53
|
+
setIsResizing(false);
|
|
54
|
+
if (lastSize) {
|
|
55
|
+
onResizeRef.current?.(serializeSize(lastSize));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
window.addEventListener('pointermove', moveCallback);
|
|
59
|
+
window.addEventListener('pointerup', upCallback);
|
|
60
|
+
return () => {
|
|
61
|
+
window.removeEventListener('pointermove', moveCallback);
|
|
62
|
+
window.removeEventListener('pointerup', upCallback);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}, [isResizing, controlledSide, direction, sizeType, splitterRef]);
|
|
66
|
+
return {
|
|
67
|
+
onPointerDown,
|
|
68
|
+
isResizing,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function getValueFromSplitter(value, options) {
|
|
72
|
+
const newValue = Math.round((value + Number.EPSILON) * 100) / 100;
|
|
73
|
+
return getMinMax(newValue, options);
|
|
74
|
+
}
|
|
75
|
+
function getMinMax(value, options) {
|
|
76
|
+
return Math.min(Math.max(value, options.min), options.max);
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=use_split_pane_size.js.map
|
|
@@ -0,0 +1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"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/table/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/table/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/table/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { DraggableItemState } from './item_data.js';
|
|
3
|
+
export interface DraggableRowContext {
|
|
4
|
+
state: DraggableItemState;
|
|
5
|
+
dragHandleRef: RefObject<HTMLButtonElement>;
|
|
6
|
+
}
|
|
7
|
+
export declare const draggableRowContext: import("react").Context<DraggableRowContext | null>;
|
|
8
|
+
export declare function useTableDraggableRowContext(): DraggableRowContext;
|
|
9
|
+
//# sourceMappingURL=draggable_row_context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draggable_row_context.d.ts","sourceRoot":"","sources":["../../../../src/components/table/reorder_rows/draggable_row_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,aAAa,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC;CAC7C;AAED,eAAO,MAAM,mBAAmB,qDAE/B,CAAC;AAEF,wBAAgB,2BAA2B,wBAQ1C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const draggableRowContext = createContext(null);
|
|
3
|
+
export function useTableDraggableRowContext() {
|
|
4
|
+
const context = useContext(draggableRowContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
throw new Error('useDraggableItemContext must be used within an ItemContextProvider');
|
|
7
|
+
}
|
|
8
|
+
return context;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=draggable_row_context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draggable_row_context.js","sourceRoot":"","sources":["../../../../src/components/table/reorder_rows/draggable_row_context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AASlD,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAC9C,IAAI,CACL,CAAC;AAEF,MAAM,UAAU,2BAA2B;IACzC,MAAM,OAAO,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Row, RowData } from '@tanstack/react-table';
|
|
2
|
+
import type { TableRowPreviewRenderer, TableRowTrProps } from '../table_utils.js';
|
|
3
|
+
export interface TableDraggableRowTrProps<TData extends RowData> {
|
|
4
|
+
/**
|
|
5
|
+
* Props to be spread on the `tr` element.
|
|
6
|
+
*/
|
|
7
|
+
trProps: TableRowTrProps;
|
|
8
|
+
/**
|
|
9
|
+
* Row data.
|
|
10
|
+
*/
|
|
11
|
+
row: Row<TData>;
|
|
12
|
+
/**
|
|
13
|
+
* Preview of the row being dragged.
|
|
14
|
+
*/
|
|
15
|
+
renderRowPreview: TableRowPreviewRenderer<TData>;
|
|
16
|
+
}
|
|
17
|
+
export declare function TableDraggableRowTr<TData extends RowData>(props: TableDraggableRowTrProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=draggable_row_tr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draggable_row_tr.d.ts","sourceRoot":"","sources":["../../../../src/components/table/reorder_rows/draggable_row_tr.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAK1D,OAAO,KAAK,EACV,uBAAuB,EACvB,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAS3B,MAAM,WAAW,wBAAwB,CAAC,KAAK,SAAS,OAAO;IAC7D;;OAEG;IACH,OAAO,EAAE,eAAe,CAAC;IACzB;;OAEG;IACH,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IAChB;;OAEG;IACH,gBAAgB,EAAE,uBAAuB,CAAC,KAAK,CAAC,CAAC;CAClD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,SAAS,OAAO,EACvD,KAAK,EAAE,wBAAwB,CAAC,KAAK,CAAC,2CA0GvC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
3
|
+
import { draggable, dropTargetForElements, } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
4
|
+
import { pointerOutsideOfPreview } from '@atlaskit/pragmatic-drag-and-drop/element/pointer-outside-of-preview';
|
|
5
|
+
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
|
|
6
|
+
import { attachClosestEdge, extractClosestEdge, } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
7
|
+
import { Colors } from '@blueprintjs/core';
|
|
8
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
9
|
+
import { createPortal } from 'react-dom';
|
|
10
|
+
import { assert } from '../../utils/index.js';
|
|
11
|
+
import { draggableRowContext } from './draggable_row_context.js';
|
|
12
|
+
import { useDroppedItemContext } from './dropped_item_context.js';
|
|
13
|
+
import { getItemData, isItemData } from './item_data.js';
|
|
14
|
+
import { useItemOrder } from './item_order_context.js';
|
|
15
|
+
export function TableDraggableRowTr(props) {
|
|
16
|
+
const { trProps, row, renderRowPreview } = props;
|
|
17
|
+
const { instanceId } = useItemOrder();
|
|
18
|
+
const innerRef = useRef(null);
|
|
19
|
+
const [state, setState] = useState(idleState);
|
|
20
|
+
const [droppedItemId, setDroppedItemId] = useDroppedItemContext();
|
|
21
|
+
const dragHandleRef = useRef(null);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const trElement = innerRef.current;
|
|
24
|
+
assert(trElement, 'tr ref is null');
|
|
25
|
+
assert(dragHandleRef.current, 'dragHandleRef is null');
|
|
26
|
+
function canDrop({ source }) {
|
|
27
|
+
return (isItemData(source.data) &&
|
|
28
|
+
source.data.instanceId === instanceId &&
|
|
29
|
+
source.data.id !== row.id);
|
|
30
|
+
}
|
|
31
|
+
const data = getItemData(row, instanceId);
|
|
32
|
+
return combine(draggable({
|
|
33
|
+
element: trElement,
|
|
34
|
+
dragHandle: dragHandleRef.current,
|
|
35
|
+
getInitialData: () => data,
|
|
36
|
+
onGenerateDragPreview({ nativeSetDragImage }) {
|
|
37
|
+
setCustomNativeDragPreview({
|
|
38
|
+
nativeSetDragImage,
|
|
39
|
+
getOffset: pointerOutsideOfPreview({
|
|
40
|
+
x: '8px',
|
|
41
|
+
y: '8px',
|
|
42
|
+
}),
|
|
43
|
+
render({ container }) {
|
|
44
|
+
setState({ type: 'preview', container });
|
|
45
|
+
return () => setState(draggingState);
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
onDragStart() {
|
|
50
|
+
setState(draggingState);
|
|
51
|
+
},
|
|
52
|
+
onDrop() {
|
|
53
|
+
setState(idleState);
|
|
54
|
+
},
|
|
55
|
+
}), dropTargetForElements({
|
|
56
|
+
element: trElement,
|
|
57
|
+
canDrop,
|
|
58
|
+
getIsSticky: () => false,
|
|
59
|
+
getData({ input }) {
|
|
60
|
+
return attachClosestEdge(data, {
|
|
61
|
+
element: trElement,
|
|
62
|
+
input,
|
|
63
|
+
allowedEdges: ['top', 'bottom'],
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
onDrag({ self }) {
|
|
67
|
+
const closestEdge = extractClosestEdge(self.data);
|
|
68
|
+
setState((current) => {
|
|
69
|
+
if (current.type === 'is-over' &&
|
|
70
|
+
current.closestEdge === closestEdge) {
|
|
71
|
+
return current;
|
|
72
|
+
}
|
|
73
|
+
return { type: 'is-over', closestEdge };
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
onDragLeave() {
|
|
77
|
+
setState(idleState);
|
|
78
|
+
},
|
|
79
|
+
onDrop() {
|
|
80
|
+
setState(idleState);
|
|
81
|
+
},
|
|
82
|
+
}));
|
|
83
|
+
}, [row, instanceId]);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (droppedItemId === row.id && innerRef.current) {
|
|
86
|
+
triggerPostFlash(innerRef.current);
|
|
87
|
+
setDroppedItemId(undefined);
|
|
88
|
+
}
|
|
89
|
+
}, [droppedItemId, row.id, setDroppedItemId]);
|
|
90
|
+
const value = useMemo(() => {
|
|
91
|
+
return {
|
|
92
|
+
dragHandleRef,
|
|
93
|
+
state,
|
|
94
|
+
};
|
|
95
|
+
}, [state]);
|
|
96
|
+
return (_jsxs(_Fragment, { children: [_jsx(draggableRowContext.Provider, { value: value, children: _jsx("tr", { ...trProps, ref: innerRef }) }), state.type === 'preview' &&
|
|
97
|
+
createPortal(renderRowPreview(row), state.container)] }));
|
|
98
|
+
}
|
|
99
|
+
const idleState = { type: 'idle' };
|
|
100
|
+
const draggingState = { type: 'dragging' };
|
|
101
|
+
function triggerPostFlash(element) {
|
|
102
|
+
element.animate([{ backgroundColor: Colors.BLUE5, opacity: 0.5 }, { opacity: 0.5 }], {
|
|
103
|
+
duration: 250,
|
|
104
|
+
iterations: 1,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=draggable_row_tr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draggable_row_tr.js","sourceRoot":"","sources":["../../../../src/components/table/reorder_rows/draggable_row_tr.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AAEpE,OAAO,EACL,SAAS,EACT,qBAAqB,GACtB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sEAAsE,CAAC;AAC/G,OAAO,EAAE,0BAA0B,EAAE,MAAM,0EAA0E,CAAC;AACtH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAO9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAiBvD,MAAM,UAAU,mBAAmB,CACjC,KAAsC;IAEtC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,gBAAgB,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EAAE,CAAC;YACjD,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACnC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,EAAE,CAAC,aAAa,EAAE,GAAG,CAAC,EAAE,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAE9C,MAAM,KAAK,GAAG,OAAO,CAAsB,GAAG,EAAE;QAC9C,OAAO;YACL,aAAa;YACb,KAAK;SACN,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CACL,8BACE,KAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACxC,gBAAQ,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAI,GACL,EAC9B,KAAK,CAAC,IAAI,KAAK,SAAS;gBACvB,YAAY,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,IACrD,CACJ,CAAC;AACJ,CAAC;AAED,MAAM,SAAS,GAAuB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACvD,MAAM,aAAa,GAAuB,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAE/D,SAAS,gBAAgB,CAAC,OAAoB;IAC5C,OAAO,CAAC,OAAO,CACb,CAAC,EAAE,eAAe,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EACnE;QACE,QAAQ,EAAE,GAAG;QACb,UAAU,EAAE,CAAC;KACd,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/types';
|
|
2
|
+
export interface TableDropIndicatorProps {
|
|
3
|
+
/**
|
|
4
|
+
* The edge (top or bottom) on which to render the drop indicator
|
|
5
|
+
* with respect to the nearest relatively positioned element.
|
|
6
|
+
*/
|
|
7
|
+
edge: Edge;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* An absolutely positioned line which indicates where a dragged item will
|
|
11
|
+
* be dropped.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export declare const TableDropIndicator: import("@emotion/styled").StyledComponent<{
|
|
15
|
+
theme?: import("@emotion/react").Theme;
|
|
16
|
+
as?: React.ElementType;
|
|
17
|
+
} & TableDropIndicatorProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
18
|
+
//# sourceMappingURL=drop_indicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop_indicator.d.ts","sourceRoot":"","sources":["../../../../src/components/table/reorder_rows/drop_indicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gDAAgD,CAAC;AAI3E,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,IAAI,EAAE,IAAI,CAAC;CACZ;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;SAEvB,MACN,WAAU;mIAOX,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Colors } from '@blueprintjs/core';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
/**
|
|
4
|
+
* An absolutely positioned line which indicates where a dragged item will
|
|
5
|
+
* be dropped.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export const TableDropIndicator = styled.div `
|
|
9
|
+
position: absolute;
|
|
10
|
+
z-index: 1;
|
|
11
|
+
background-color: ${Colors.BLUE3};
|
|
12
|
+
height: 2px;
|
|
13
|
+
left: 0;
|
|
14
|
+
right: 0;
|
|
15
|
+
pointer-events: none;
|
|
16
|
+
${(props) => props.edge === 'top' && 'top: -1px;'}
|
|
17
|
+
${(props) => props.edge === 'bottom' && 'bottom: -1px;'}
|
|
18
|
+
`;
|
|
19
|
+
//# sourceMappingURL=drop_indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop_indicator.js","sourceRoot":"","sources":["../../../../src/components/table/reorder_rows/drop_indicator.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAUrC;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAyB;;;sBAG/C,MAAM,CAAC,KAAK;;;;;IAK9B,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,YAAY;IAC/C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,eAAe;CACxD,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const droppedItemContext: import("react").Context<[string | undefined, import("react").Dispatch<import("react").SetStateAction<string | undefined>>] | null>;
|
|
2
|
+
export declare function useDroppedItemContext(): [string | undefined, import("react").Dispatch<import("react").SetStateAction<string | undefined>>];
|
|
3
|
+
//# sourceMappingURL=dropped_item_context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropped_item_context.d.ts","sourceRoot":"","sources":["../../../../src/components/table/reorder_rows/dropped_item_context.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,kBAAkB,oIAE9B,CAAC;AAEF,wBAAgB,qBAAqB,uGAUpC"}
|