publ-echo-test 0.0.106 → 0.0.107
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.
@@ -1,5 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { GridItemProps } from "./types";
|
3
3
|
import { PropsWithChildren } from "../types";
|
4
|
-
declare const GroupItem: ({ children, ...props }: PropsWithChildren<GridItemProps
|
4
|
+
declare const GroupItem: ({ children, ...props }: PropsWithChildren<GridItemProps & {
|
5
|
+
onContextGroup: (e: React.MouseEvent) => void;
|
6
|
+
}>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
5
7
|
export default GroupItem;
|
@@ -26,11 +26,10 @@ import { DraggableCore } from "../Draggable";
|
|
26
26
|
import classNames from "../../external-lib/classnames";
|
27
27
|
import { calcGridColWidth, calcGridItemPosition, calcGridItemWHPx, calcWH, calcXY, clamp, resolveRowHeight, } from "./utils/calculateUtils";
|
28
28
|
import { perc, setTopLeft, setTransform, } from "../GridLayoutEditor/utils/renderHelpers";
|
29
|
-
import { Resizable } from "../Resizable";
|
30
29
|
var GroupItem = function (_a) {
|
31
30
|
var _b;
|
32
31
|
var children = _a.children, props = __rest(_a, ["children"]);
|
33
|
-
var resizeHandle = props.resizeHandle, cols = props.cols, isDraggable = props.isDraggable, _c = props.transformScale, transformScale = _c === void 0 ? 1 : _c, isResizable = props.isResizable, useCSSTransforms = props.useCSSTransforms, className = props.className, _d = props.cancel, cancel = _d === void 0 ? "" : _d, _e = props.handle, handle = _e === void 0 ? "" : _e, x = props.x, y = props.y, z = props.z, w = props.w, h = props.h, _f = props.minH, minH = _f === void 0 ? 1 : _f, _g = props.minW, minW = _g === void 0 ? 1 : _g, _h = props.maxH, maxH = _h === void 0 ? Infinity : _h, _j = props.maxW, maxW = _j === void 0 ? Infinity : _j, i = props.i, _k = props.isHiddenVisibility, isHiddenVisibility = _k === void 0 ? false : _k, containerWidth = props.containerWidth, customColWidth = props.customColWidth, autoResize = props.autoResize;
|
32
|
+
var resizeHandle = props.resizeHandle, cols = props.cols, isDraggable = props.isDraggable, _c = props.transformScale, transformScale = _c === void 0 ? 1 : _c, isResizable = props.isResizable, useCSSTransforms = props.useCSSTransforms, className = props.className, _d = props.cancel, cancel = _d === void 0 ? "" : _d, _e = props.handle, handle = _e === void 0 ? "" : _e, x = props.x, y = props.y, z = props.z, w = props.w, h = props.h, _f = props.minH, minH = _f === void 0 ? 1 : _f, _g = props.minW, minW = _g === void 0 ? 1 : _g, _h = props.maxH, maxH = _h === void 0 ? Infinity : _h, _j = props.maxW, maxW = _j === void 0 ? Infinity : _j, i = props.i, _k = props.isHiddenVisibility, isHiddenVisibility = _k === void 0 ? false : _k, containerWidth = props.containerWidth, customColWidth = props.customColWidth, autoResize = props.autoResize, onContextGroup = props.onContextGroup;
|
34
33
|
var _l = useState(), resizing = _l[0], setResizing = _l[1];
|
35
34
|
var _m = useState(), dragging = _m[0], setDragging = _m[1];
|
36
35
|
var _o = useState(), dragStart = _o[0], setDragStart = _o[1];
|
@@ -173,33 +172,58 @@ var GroupItem = function (_a) {
|
|
173
172
|
var mixinDraggable = function (child, isDraggable) {
|
174
173
|
return (_jsx(DraggableCore, { disabled: !isDraggable, onStart: onDragStart, onDrag: onDrag, onStop: onDragStop, handle: handle, cancel: ".react-resizable-handle" + (cancel ? "," + cancel : ""), scale: transformScale, nodeRef: elementRef, children: child }));
|
175
174
|
};
|
176
|
-
/**
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
175
|
+
// /**
|
176
|
+
// * Mix a Resizable instance into a child.
|
177
|
+
// * @param {Element} child Child element.
|
178
|
+
// * @param {Object} position Position object (pixel values)
|
179
|
+
// * @return {Element} Child wrapped in Resizable.
|
180
|
+
// */
|
181
|
+
// const mixinResizable = (
|
182
|
+
// child: ReactElement<any>,
|
183
|
+
// position: Position,
|
184
|
+
// isResizable: boolean
|
185
|
+
// ): ReactElement<any> => {
|
186
|
+
// const positionParams = getPositionParams();
|
187
|
+
// // const maxWidth = calcGridItemPosition(
|
188
|
+
// // positionParams,
|
189
|
+
// // x,
|
190
|
+
// // y,
|
191
|
+
// // z,
|
192
|
+
// // cols - x, // TODO - 수정 필요
|
193
|
+
// // h
|
194
|
+
// // ).width;
|
195
|
+
// const mins = calcGridItemPosition(positionParams, x, y, z, minW, minH);
|
196
|
+
// const maxes = calcGridItemPosition(positionParams, x, y, z, maxW, maxH);
|
197
|
+
// const minConstraints = [mins.width, mins.height] as [number, number];
|
198
|
+
// const maxConstraints = [
|
199
|
+
// Math.min(maxes.width, containerWidth),
|
200
|
+
// Math.min(maxes.height, Infinity),
|
201
|
+
// ] as [number, number];
|
202
|
+
// return (
|
203
|
+
// <Resizable
|
204
|
+
// draggableOpts={{
|
205
|
+
// disabled: !isResizable,
|
206
|
+
// }}
|
207
|
+
// className={"react-resizable-hide"}
|
208
|
+
// width={position.width}
|
209
|
+
// height={position.height}
|
210
|
+
// top={position.top}
|
211
|
+
// left={position.left}
|
212
|
+
// onResizeStop={onResizeStop}
|
213
|
+
// onResizeStart={onResizeStart}
|
214
|
+
// onResize={onResize}
|
215
|
+
// minConstraints={minConstraints}
|
216
|
+
// maxConstraints={maxConstraints}
|
217
|
+
// transformScale={transformScale}
|
218
|
+
// isResizing={isResizing}
|
219
|
+
// autoResize={autoResize}
|
220
|
+
// colWidth={colWidth}
|
221
|
+
// margin={props.margin}
|
222
|
+
// >
|
223
|
+
// {child}
|
224
|
+
// </Resizable>
|
225
|
+
// );
|
226
|
+
// };
|
203
227
|
/**
|
204
228
|
* onDragStart event handler
|
205
229
|
* @param {Event} e event data
|
@@ -397,8 +421,11 @@ var GroupItem = function (_a) {
|
|
397
421
|
cssTransforms: useCSSTransforms,
|
398
422
|
}),
|
399
423
|
style: __assign(__assign(__assign({}, props.style), child.props.style), createStyle(pos)),
|
424
|
+
onContextMenu: function (e) {
|
425
|
+
onContextGroup(e);
|
426
|
+
},
|
400
427
|
});
|
401
|
-
newChild = mixinResizable(newChild, pos, isResizable);
|
428
|
+
// newChild = mixinResizable(newChild, pos, isResizable);
|
402
429
|
newChild = mixinDraggable(newChild, isDraggable);
|
403
430
|
return newChild;
|
404
431
|
};
|
@@ -2,5 +2,7 @@ import * as React from "react";
|
|
2
2
|
import type { ReactElement } from "react";
|
3
3
|
import { PropsWithChildren } from "../types";
|
4
4
|
import { ReactGridLayoutProps } from "./types";
|
5
|
-
declare const ReactGridLayout: ({ children, ...props }: PropsWithChildren<ReactGridLayoutProps
|
5
|
+
declare const ReactGridLayout: ({ children, ...props }: PropsWithChildren<ReactGridLayoutProps & {
|
6
|
+
onContextGroup?: ((e: React.MouseEvent, blockId: string, isEditingGroup: boolean) => void) | undefined;
|
7
|
+
}>) => React.ReactElement;
|
6
8
|
export default ReactGridLayout;
|
@@ -679,6 +679,9 @@ var ReactGridLayout = function (_a) {
|
|
679
679
|
var handleDoubleClick = function (e) {
|
680
680
|
onDoubleClickGroup && onDoubleClickGroup(e, block.blockId, type);
|
681
681
|
};
|
682
|
+
var handleClickContextGroup = function (e) {
|
683
|
+
(props === null || props === void 0 ? void 0 : props.onContextGroup) && props.onContextGroup(e, block.blockId, isEditingGroup);
|
684
|
+
};
|
682
685
|
return (_jsx(OutsideClickHandler, { onOutsideClick: onDoubleClickOutsideGroup, children: _jsx(GroupItem, { className: classNames({
|
683
686
|
'bulk-child-item': isInBulk,
|
684
687
|
'grid-bulk-block': block.blockId === 'BULK',
|
@@ -693,7 +696,7 @@ var ReactGridLayout = function (_a) {
|
|
693
696
|
// droppingPosition={isDroppingItem ? droppingPosition : undefined}
|
694
697
|
// resizeHandles={resizeHandlesOptions}
|
695
698
|
// resizeHandle={resizeHandle}
|
696
|
-
isHiddenVisibility: isHiddenVisibility, customColWidth: colWidth, autoResize: false, children: _jsx("div", { onClick: handleClick, onDoubleClick: handleDoubleClick }) }, block.blockId) }));
|
699
|
+
isHiddenVisibility: isHiddenVisibility, customColWidth: colWidth, autoResize: false, onContextGroup: handleClickContextGroup, children: _jsx("div", { onClick: handleClick, onDoubleClick: handleDoubleClick }) }, block.blockId) }));
|
697
700
|
};
|
698
701
|
var currentGroupBlocks = blockStructure ? findGroupBlocks(blockStructure, editingGroupBlock) : [];
|
699
702
|
return (_jsxs("div", { ref: innerRef, className: mergedClassName, style: mergedStyle, onDrop: isDroppable ? onDropHandler : noop, onDragLeave: isDroppable ? onDragLeaveHandler : noop, onDragEnter: isDroppable ? onDragEnterHandler : noop, onDragOver: isDroppable ? onDragOverHandler : noop, children: [currentGroupBlocks.map(function (each) { return processGroup(each); }), React.Children.map(children, function (child) { return processGridItem(child); }), placeholder(), activeDrag && _jsx("div", { className: "grid-guide-line-center" }), activeDrag && (_jsx("div", { className: "grid-placeholder", style: {
|