@reltio/components 1.4.1712 → 1.4.1713
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.
|
@@ -17,9 +17,10 @@ type Props<ViewConfig = Record<string, unknown>> = {
|
|
|
17
17
|
root?: string;
|
|
18
18
|
item?: string;
|
|
19
19
|
};
|
|
20
|
+
onResize?: (layout: ReactGridLayoutItem[], oldLayoutItem: ReactGridLayoutItem, layoutItem: ReactGridLayoutItem, placeholder: ReactGridLayoutItem) => void;
|
|
20
21
|
};
|
|
21
22
|
declare const _default: React.MemoExoticComponent<{
|
|
22
|
-
({ views, layout, layoutOptions, onLayoutChanged, draggableHandle, LayoutItem, onRemove, onDrop, droppingItem, isDroppable, isStatic, classes }: Props<Record<string, unknown>>): JSX.Element;
|
|
23
|
+
({ views, layout, layoutOptions, onLayoutChanged, draggableHandle, LayoutItem, onRemove, onDrop, droppingItem, isDroppable, isStatic, classes, onResize }: Props<Record<string, unknown>>): JSX.Element;
|
|
23
24
|
displayName: string;
|
|
24
25
|
}>;
|
|
25
26
|
export default _default;
|
|
@@ -52,13 +52,13 @@ var DEFAULT_LAYOUT_OPTIONS = {
|
|
|
52
52
|
};
|
|
53
53
|
var ReltioGridLayout = function (_a) {
|
|
54
54
|
var _b;
|
|
55
|
-
var views = _a.views, layout = _a.layout, _c = _a.layoutOptions, layoutOptions = _c === void 0 ? DEFAULT_LAYOUT_OPTIONS : _c, _d = _a.onLayoutChanged, onLayoutChanged = _d === void 0 ? core_1.noop : _d, draggableHandle = _a.draggableHandle, LayoutItem = _a.LayoutItem, onRemove = _a.onRemove, onDrop = _a.onDrop, droppingItem = _a.droppingItem, isDroppable = _a.isDroppable, isStatic = _a.isStatic, classes = _a.classes;
|
|
55
|
+
var views = _a.views, layout = _a.layout, _c = _a.layoutOptions, layoutOptions = _c === void 0 ? DEFAULT_LAYOUT_OPTIONS : _c, _d = _a.onLayoutChanged, onLayoutChanged = _d === void 0 ? core_1.noop : _d, draggableHandle = _a.draggableHandle, LayoutItem = _a.LayoutItem, onRemove = _a.onRemove, onDrop = _a.onDrop, droppingItem = _a.droppingItem, isDroppable = _a.isDroppable, isStatic = _a.isStatic, classes = _a.classes, _e = _a.onResize, onResize = _e === void 0 ? core_1.noop : _e;
|
|
56
56
|
var ref = (0, react_1.useRef)();
|
|
57
57
|
var heightsMap = (0, react_1.useRef)({});
|
|
58
58
|
var styles = (0, styles_1.useStyles)();
|
|
59
|
-
var
|
|
60
|
-
var
|
|
61
|
-
var
|
|
59
|
+
var _f = (0, react_1.useState)(null), resizingItemId = _f[0], setResizingItemId = _f[1];
|
|
60
|
+
var _g = (0, react_1.useState)(null), fullscreenItemId = _g[0], setFullscreenItemId = _g[1];
|
|
61
|
+
var _h = (0, react_1.useState)(0), width = _h[0], setWidth = _h[1];
|
|
62
62
|
var cols = layoutOptions.cols, rowHeight = layoutOptions.rowHeight, margin = layoutOptions.margin;
|
|
63
63
|
var processedLayout = (0, react_1.useMemo)(function () { return (0, helpers_1.reltioLayoutToReactGridLayout)(layout); }, [layout]);
|
|
64
64
|
var onReltioLayoutChanged = (0, ramda_1.pipe)(helpers_1.reactGridLayoutToReltioLayout, (0, helpers_1.copyPropsFromPreviousLayout)(['autosizing'], layout), (0, ramda_1.ifElse)((0, ramda_1.always)(isStatic), (0, helpers_1.alignGroupedItemsHeights)(heightsMap.current), (0, helpers_1.calcLayoutItemsHeight)(heightsMap.current)), onLayoutChanged);
|
|
@@ -82,7 +82,7 @@ var ReltioGridLayout = function (_a) {
|
|
|
82
82
|
react_1.default.createElement(react_resize_detector_1.default, { refreshMode: "debounce", refreshRate: 50, handleWidth: true, onResize: function (width) { return setWidth(width); } }),
|
|
83
83
|
!!width && (react_1.default.createElement(react_grid_layout_1.default, { innerRef: ref, layout: processedLayout, cols: cols, draggableHandle: draggableHandle, autoSize: true, rowHeight: rowHeight, width: width, margin: margin, onLayoutChange: isStatic ? undefined : onReltioLayoutChanged, isResizable: !isStatic && !isFullscreenEnabled, isDraggable: !isStatic && !isFullscreenEnabled, className: (0, classnames_1.default)(classes === null || classes === void 0 ? void 0 : classes.root, styles.gridLayout, (_b = {},
|
|
84
84
|
_b[styles.gridFullscreen] = isFullscreenEnabled,
|
|
85
|
-
_b)), onDrop: handleDrop, droppingItem: droppingItem, isDroppable: !isStatic && isDroppable, onResizeStart: function (_, layoutItem) { return setResizingItemId(layoutItem.i); }, onResizeStop: function () { return setResizingItemId(null); }, "data-reltio-id": "reltio-grid-layout" }, processedLayout.map(function (layoutItem) {
|
|
85
|
+
_b)), onDrop: handleDrop, droppingItem: droppingItem, isDroppable: !isStatic && isDroppable, onResizeStart: function (_, layoutItem) { return setResizingItemId(layoutItem.i); }, onResizeStop: function () { return setResizingItemId(null); }, onResize: onResize, "data-reltio-id": "reltio-grid-layout" }, processedLayout.map(function (layoutItem) {
|
|
86
86
|
var _a;
|
|
87
87
|
var isItemFullscreen = fullscreenItemId === layoutItem.i;
|
|
88
88
|
var isResizing = resizingItemId === layoutItem.i;
|
|
@@ -17,9 +17,10 @@ type Props<ViewConfig = Record<string, unknown>> = {
|
|
|
17
17
|
root?: string;
|
|
18
18
|
item?: string;
|
|
19
19
|
};
|
|
20
|
+
onResize?: (layout: ReactGridLayoutItem[], oldLayoutItem: ReactGridLayoutItem, layoutItem: ReactGridLayoutItem, placeholder: ReactGridLayoutItem) => void;
|
|
20
21
|
};
|
|
21
22
|
declare const _default: React.MemoExoticComponent<{
|
|
22
|
-
({ views, layout, layoutOptions, onLayoutChanged, draggableHandle, LayoutItem, onRemove, onDrop, droppingItem, isDroppable, isStatic, classes }: Props<Record<string, unknown>>): JSX.Element;
|
|
23
|
+
({ views, layout, layoutOptions, onLayoutChanged, draggableHandle, LayoutItem, onRemove, onDrop, droppingItem, isDroppable, isStatic, classes, onResize }: Props<Record<string, unknown>>): JSX.Element;
|
|
23
24
|
displayName: string;
|
|
24
25
|
}>;
|
|
25
26
|
export default _default;
|
|
@@ -24,13 +24,13 @@ var DEFAULT_LAYOUT_OPTIONS = {
|
|
|
24
24
|
};
|
|
25
25
|
var ReltioGridLayout = function (_a) {
|
|
26
26
|
var _b;
|
|
27
|
-
var views = _a.views, layout = _a.layout, _c = _a.layoutOptions, layoutOptions = _c === void 0 ? DEFAULT_LAYOUT_OPTIONS : _c, _d = _a.onLayoutChanged, onLayoutChanged = _d === void 0 ? noop : _d, draggableHandle = _a.draggableHandle, LayoutItem = _a.LayoutItem, onRemove = _a.onRemove, onDrop = _a.onDrop, droppingItem = _a.droppingItem, isDroppable = _a.isDroppable, isStatic = _a.isStatic, classes = _a.classes;
|
|
27
|
+
var views = _a.views, layout = _a.layout, _c = _a.layoutOptions, layoutOptions = _c === void 0 ? DEFAULT_LAYOUT_OPTIONS : _c, _d = _a.onLayoutChanged, onLayoutChanged = _d === void 0 ? noop : _d, draggableHandle = _a.draggableHandle, LayoutItem = _a.LayoutItem, onRemove = _a.onRemove, onDrop = _a.onDrop, droppingItem = _a.droppingItem, isDroppable = _a.isDroppable, isStatic = _a.isStatic, classes = _a.classes, _e = _a.onResize, onResize = _e === void 0 ? noop : _e;
|
|
28
28
|
var ref = useRef();
|
|
29
29
|
var heightsMap = useRef({});
|
|
30
30
|
var styles = useStyles();
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
31
|
+
var _f = useState(null), resizingItemId = _f[0], setResizingItemId = _f[1];
|
|
32
|
+
var _g = useState(null), fullscreenItemId = _g[0], setFullscreenItemId = _g[1];
|
|
33
|
+
var _h = useState(0), width = _h[0], setWidth = _h[1];
|
|
34
34
|
var cols = layoutOptions.cols, rowHeight = layoutOptions.rowHeight, margin = layoutOptions.margin;
|
|
35
35
|
var processedLayout = useMemo(function () { return reltioLayoutToReactGridLayout(layout); }, [layout]);
|
|
36
36
|
var onReltioLayoutChanged = pipe(reactGridLayoutToReltioLayout, copyPropsFromPreviousLayout(['autosizing'], layout), ifElse(always(isStatic), alignGroupedItemsHeights(heightsMap.current), calcLayoutItemsHeight(heightsMap.current)), onLayoutChanged);
|
|
@@ -54,7 +54,7 @@ var ReltioGridLayout = function (_a) {
|
|
|
54
54
|
React.createElement(ReactResizeDetector, { refreshMode: "debounce", refreshRate: 50, handleWidth: true, onResize: function (width) { return setWidth(width); } }),
|
|
55
55
|
!!width && (React.createElement(GridLayout, { innerRef: ref, layout: processedLayout, cols: cols, draggableHandle: draggableHandle, autoSize: true, rowHeight: rowHeight, width: width, margin: margin, onLayoutChange: isStatic ? undefined : onReltioLayoutChanged, isResizable: !isStatic && !isFullscreenEnabled, isDraggable: !isStatic && !isFullscreenEnabled, className: classnames(classes === null || classes === void 0 ? void 0 : classes.root, styles.gridLayout, (_b = {},
|
|
56
56
|
_b[styles.gridFullscreen] = isFullscreenEnabled,
|
|
57
|
-
_b)), onDrop: handleDrop, droppingItem: droppingItem, isDroppable: !isStatic && isDroppable, onResizeStart: function (_, layoutItem) { return setResizingItemId(layoutItem.i); }, onResizeStop: function () { return setResizingItemId(null); }, "data-reltio-id": "reltio-grid-layout" }, processedLayout.map(function (layoutItem) {
|
|
57
|
+
_b)), onDrop: handleDrop, droppingItem: droppingItem, isDroppable: !isStatic && isDroppable, onResizeStart: function (_, layoutItem) { return setResizingItemId(layoutItem.i); }, onResizeStop: function () { return setResizingItemId(null); }, onResize: onResize, "data-reltio-id": "reltio-grid-layout" }, processedLayout.map(function (layoutItem) {
|
|
58
58
|
var _a;
|
|
59
59
|
var isItemFullscreen = fullscreenItemId === layoutItem.i;
|
|
60
60
|
var isResizing = resizingItemId === layoutItem.i;
|