publ-echo 0.0.120 → 0.0.122
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/css/gle-styles.css +1 -0
- package/dist/lib/GridItem/GridItem.d.ts +3 -3
- package/dist/lib/GridItem/GridItem.js +242 -31
- package/dist/lib/GridItem/GridItemCopy.d.ts +5 -0
- package/dist/lib/GridItem/GridItemCopy.js +613 -0
- package/dist/lib/GridItem/GroupItem.d.ts +3 -3
- package/dist/lib/GridItem/GroupItem.js +38 -38
- package/dist/lib/GridItem/types.d.ts +8 -4
- package/dist/lib/GridItem/utils/calculateUtils.d.ts +9 -1
- package/dist/lib/GridItem/utils/calculateUtils.js +27 -0
- package/dist/lib/GridLayoutEditor/Placeholder.d.ts +20 -0
- package/dist/lib/GridLayoutEditor/Placeholder.js +62 -0
- package/dist/lib/GridLayoutEditor/ReactGridLayout.js +92 -36
- package/dist/lib/GridLayoutEditor/ResponsiveGridLayout.d.ts +2 -2
- package/dist/lib/GridLayoutEditor/ResponsiveGridLayout.js +8 -8
- package/dist/lib/GridLayoutEditor/group.d.ts +17 -0
- package/dist/lib/GridLayoutEditor/group.js +19 -0
- package/dist/lib/GridLayoutEditor/types.d.ts +14 -9
- package/dist/lib/GridLayoutEditor/utils/renderHelpers.js +3 -1
- package/dist/lib/Resizable/Resizable.d.ts +3 -3
- package/dist/lib/Resizable/Resizable.js +132 -35
- package/package.json +1 -1
|
@@ -21,11 +21,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import { useLayoutEffect, useRef, useState } from
|
|
25
|
-
import { cloneLayout, noop, synchronizeLayoutWithChildren, } from
|
|
26
|
-
import { findOrGenerateResponsiveLayout, getBreakpointFromWidth, getColsFromBreakpoint, } from
|
|
27
|
-
import isEqual from
|
|
28
|
-
import ReactGridLayout from
|
|
24
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
25
|
+
import { cloneLayout, noop, synchronizeLayoutWithChildren, } from "./utils/renderHelpers";
|
|
26
|
+
import { findOrGenerateResponsiveLayout, getBreakpointFromWidth, getColsFromBreakpoint, } from "./utils/responsiveUtils";
|
|
27
|
+
import isEqual from "../../external-lib/lodash.isEqual";
|
|
28
|
+
import ReactGridLayout from "./ReactGridLayout";
|
|
29
29
|
/**
|
|
30
30
|
* Get a value of margin or containerPadding.
|
|
31
31
|
*
|
|
@@ -44,7 +44,7 @@ export var ResponsiveGridLayout = function (_a) {
|
|
|
44
44
|
var breakpoint = getBreakpointFromWidth(breakpoints, width);
|
|
45
45
|
var colNo = getColsFromBreakpoint(breakpoint, cols);
|
|
46
46
|
var compactType = props.compactType;
|
|
47
|
-
var initialLayout = findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, breakpoint, colNo, compactType ||
|
|
47
|
+
var initialLayout = findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, breakpoint, colNo, compactType || "vertical", false);
|
|
48
48
|
return {
|
|
49
49
|
layout: initialLayout,
|
|
50
50
|
layouts: layouts,
|
|
@@ -95,8 +95,8 @@ export var ResponsiveGridLayout = function (_a) {
|
|
|
95
95
|
breakpoints[newBreakpoint] > breakpoints[lastBreakpoint];
|
|
96
96
|
var isNewLayout = layouts[newBreakpoint] == null;
|
|
97
97
|
var overlap = !!props.allowOverlap && (!isNewLayout || newBreakpointIsBiggerOrEqual); // allow resize overlap only if we are going into a larger screen
|
|
98
|
-
var layout = findOrGenerateResponsiveLayout(newLayouts, breakpoints, newBreakpoint, lastBreakpoint, newCols, compactType ||
|
|
99
|
-
layout = synchronizeLayoutWithChildren(layout, children, newCols, compactType ||
|
|
98
|
+
var layout = findOrGenerateResponsiveLayout(newLayouts, breakpoints, newBreakpoint, lastBreakpoint, newCols, compactType || "vertical", overlap);
|
|
99
|
+
layout = synchronizeLayoutWithChildren(layout, children, newCols, compactType || "vertical", overlap);
|
|
100
100
|
newLayouts[newBreakpoint] = layout;
|
|
101
101
|
setState({
|
|
102
102
|
breakpoint: newBreakpoint,
|
|
@@ -22,6 +22,8 @@ export type ComponentBlock = {
|
|
|
22
22
|
zOrderDesktopInternal: number | null;
|
|
23
23
|
zOrderMobileInternal: number | null;
|
|
24
24
|
componentBlockId: number;
|
|
25
|
+
isHeightVariableDesktop: boolean;
|
|
26
|
+
isHeightVariableMobile: boolean;
|
|
25
27
|
};
|
|
26
28
|
export type GroupBlock = {
|
|
27
29
|
blockId: string;
|
|
@@ -29,6 +31,8 @@ export type GroupBlock = {
|
|
|
29
31
|
zOrderDesktopInternal: number | null;
|
|
30
32
|
zOrderMobileInternal: number | null;
|
|
31
33
|
children: (ComponentBlock | GroupBlock)[];
|
|
34
|
+
isHeightVariableDesktop: boolean;
|
|
35
|
+
isHeightVariableMobile: boolean;
|
|
32
36
|
};
|
|
33
37
|
export type RootBlock = {
|
|
34
38
|
blockId: "ROOT";
|
|
@@ -36,6 +40,8 @@ export type RootBlock = {
|
|
|
36
40
|
zOrderDesktopInternal: number | null;
|
|
37
41
|
zOrderMobileInternal: number | null;
|
|
38
42
|
children: (ComponentBlock | GroupBlock)[];
|
|
43
|
+
isHeightVariableDesktop: boolean;
|
|
44
|
+
isHeightVariableMobile: boolean;
|
|
39
45
|
};
|
|
40
46
|
export type BulkBlockInternal = {
|
|
41
47
|
blockId: "BULK";
|
|
@@ -43,6 +49,8 @@ export type BulkBlockInternal = {
|
|
|
43
49
|
zOrderDesktopInternal: number;
|
|
44
50
|
zOrderMobileInternal: number;
|
|
45
51
|
children: (ComponentBlock | GroupBlock)[];
|
|
52
|
+
isHeightVariableDesktop: boolean;
|
|
53
|
+
isHeightVariableMobile: boolean;
|
|
46
54
|
};
|
|
47
55
|
export declare const findBlockByBlockId: (block: Block, blockId: string) => Block | null;
|
|
48
56
|
export declare const findDirectChildrenCbIds: (block: Block, targetId: string) => number[];
|
|
@@ -54,5 +62,14 @@ export declare const addBulkToTarget: (block: Block, targetId: string, bulkBlock
|
|
|
54
62
|
export declare function getBlockWorkDirPath(blockStructure: Block, targetBlockId: string): string;
|
|
55
63
|
export declare function formatBlockIdToCbId(blockId: string): number | null;
|
|
56
64
|
export declare function formatCbIdToBlockId(cbId: number): string;
|
|
65
|
+
export declare function getBlockIdKind(blockId: string): {
|
|
66
|
+
type: "GB";
|
|
67
|
+
blockId: string;
|
|
68
|
+
cbId: string | null;
|
|
69
|
+
} | {
|
|
70
|
+
type: "CB";
|
|
71
|
+
blockId: string;
|
|
72
|
+
cbId: string;
|
|
73
|
+
} | null;
|
|
57
74
|
export declare function findParentGroupBlock(current: Block, targetBlockId: string): GroupBlock | null;
|
|
58
75
|
export declare function findOneComponentBlock(current: Block, targetBlockId: string): number | null;
|
|
@@ -217,6 +217,8 @@ export var addBulkToTarget = function (block, targetId, bulkBlockIds) {
|
|
|
217
217
|
zOrderDesktopInternal: zOrderDesktopInternal,
|
|
218
218
|
zOrderMobileInternal: zOrderMobileInternal,
|
|
219
219
|
children: bulkBlocks,
|
|
220
|
+
isHeightVariableDesktop: false,
|
|
221
|
+
isHeightVariableMobile: false,
|
|
220
222
|
};
|
|
221
223
|
// Add the bulkBlock to the target's children
|
|
222
224
|
targetBlock.children.push(bulkBlock);
|
|
@@ -248,6 +250,23 @@ export function formatBlockIdToCbId(blockId) {
|
|
|
248
250
|
export function formatCbIdToBlockId(cbId) {
|
|
249
251
|
return "CB_".concat(cbId);
|
|
250
252
|
}
|
|
253
|
+
export function getBlockIdKind(blockId) {
|
|
254
|
+
if (/^GB_.+$/i.test(blockId)) {
|
|
255
|
+
return {
|
|
256
|
+
type: "GB",
|
|
257
|
+
cbId: null,
|
|
258
|
+
blockId: blockId,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
if (/^CB_\d+$/i.test(blockId)) {
|
|
262
|
+
return {
|
|
263
|
+
type: "CB",
|
|
264
|
+
cbId: formatBlockIdToCbId(blockId).toString(),
|
|
265
|
+
blockId: blockId,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
251
270
|
// export const findAccessibleChildrenBlocks = (
|
|
252
271
|
// block: Block,
|
|
253
272
|
// targetGroupId: string,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DragEvent, ReactElement, RefObject } from
|
|
2
|
-
import { ResizeHandleAxis, ResizeHandleType } from
|
|
3
|
-
import { ResizeEventType } from
|
|
4
|
-
import { Block } from
|
|
5
|
-
export type CompactType =
|
|
1
|
+
import { DragEvent, ReactElement, RefObject } from "react";
|
|
2
|
+
import { ResizeHandleAxis, ResizeHandleType } from "../Resizable/types";
|
|
3
|
+
import { ResizeEventType } from "../GridItem/types";
|
|
4
|
+
import { Block } from "./group";
|
|
5
|
+
export type CompactType = "vertical" | "horizontal";
|
|
6
6
|
export type LayoutItem = {
|
|
7
7
|
w: number;
|
|
8
8
|
h: number;
|
|
@@ -22,6 +22,9 @@ export type LayoutItem = {
|
|
|
22
22
|
isBounded?: boolean;
|
|
23
23
|
groupLayouts?: LayoutItem[];
|
|
24
24
|
autoResize?: boolean;
|
|
25
|
+
isHeightVariableDesktop?: boolean;
|
|
26
|
+
isHeightVariableMobile?: boolean;
|
|
27
|
+
heightFitContent?: boolean;
|
|
25
28
|
};
|
|
26
29
|
export type Layout = LayoutItem[];
|
|
27
30
|
export type DroppedEvent = {
|
|
@@ -35,6 +38,7 @@ export type UpdatedItem = {
|
|
|
35
38
|
y: number;
|
|
36
39
|
};
|
|
37
40
|
export type ReactGridLayoutProps = {
|
|
41
|
+
selectedBlockId: string | null;
|
|
38
42
|
sectionId: string;
|
|
39
43
|
children: ReactElement<any> | ReactElement[];
|
|
40
44
|
className?: string;
|
|
@@ -82,12 +86,13 @@ export type ReactGridLayoutProps = {
|
|
|
82
86
|
onFitToContent?: OnFitContentCallBack;
|
|
83
87
|
blockStructure?: Block;
|
|
84
88
|
onDoubleClickGroup?: (e: React.MouseEvent, id: string, type: string) => void;
|
|
85
|
-
selectedGroupBlock?:
|
|
86
|
-
editingGroupBlock?:
|
|
89
|
+
selectedGroupBlock?: "ROOT" | string;
|
|
90
|
+
editingGroupBlock?: "ROOT" | string;
|
|
87
91
|
onClickGroup?: (e: React.MouseEvent, id: string, type: string) => void;
|
|
88
92
|
bulkIds?: string[];
|
|
89
93
|
onDoubleClickOutsideGroup: () => void;
|
|
90
94
|
onContextGroup?: (e: React.MouseEvent, blockId: string, isEditingGroup: boolean) => void;
|
|
95
|
+
device: "DESKTOP" | "MOBILE";
|
|
91
96
|
};
|
|
92
97
|
export type DragOverEvent = MouseEvent & {
|
|
93
98
|
nativeEvent: {
|
|
@@ -143,7 +148,7 @@ export type ResponsiveGridLayoutStateType = {
|
|
|
143
148
|
layout: Layout;
|
|
144
149
|
layouts?: ResponsiveLayout<string>;
|
|
145
150
|
};
|
|
146
|
-
type CoreType = Omit<ReactGridLayoutProps,
|
|
151
|
+
type CoreType = Omit<ReactGridLayoutProps, "cols" | "layout" | "margin" | "containerPadding" | "transformScale" | "onLayoutChange" | "isHiddenVisibility">;
|
|
147
152
|
export type ResponsiveGridLayoutProps = {
|
|
148
153
|
breakpoint?: Breakpoint;
|
|
149
154
|
breakpoints?: Breakpoints<Breakpoint>;
|
|
@@ -157,7 +162,7 @@ export type ResponsiveGridLayoutProps = {
|
|
|
157
162
|
zoom?: number;
|
|
158
163
|
} & CoreType;
|
|
159
164
|
export type Breakpoint = string;
|
|
160
|
-
export type DefaultBreakpoints =
|
|
165
|
+
export type DefaultBreakpoints = "lg" | "md" | "sm" | "xs" | "xxs";
|
|
161
166
|
export type ResponsiveLayout<T extends Breakpoint> = Record<T, Layout>;
|
|
162
167
|
export type Breakpoints<T extends Breakpoint> = Record<T, number>;
|
|
163
168
|
export type OnLayoutChangeCallback = (properties: {
|
|
@@ -565,7 +565,9 @@ function log() {
|
|
|
565
565
|
}
|
|
566
566
|
export var noop = function (_args) { return undefined; };
|
|
567
567
|
export function getBoundingArea(layout, ids) {
|
|
568
|
-
var layoutItems = ids
|
|
568
|
+
var layoutItems = ids
|
|
569
|
+
.map(function (id) { return getLayoutItem(layout, id); })
|
|
570
|
+
.filter(function (item) { return item !== undefined; });
|
|
569
571
|
if (layoutItems.length === 0) {
|
|
570
572
|
return null;
|
|
571
573
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { PropsWithChildren } from
|
|
3
|
-
import { ResizableProps } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PropsWithChildren } from "../Draggable/types";
|
|
3
|
+
import { ResizableProps } from "./types";
|
|
4
4
|
type Props = ResizableProps;
|
|
5
5
|
declare const Resizable: ({ children, axis, handleSize, lockAspectRatio, minConstraints, maxConstraints, resizeHandles, transformScale, isResizing, autoResize, colWidth, margin, ...props }: PropsWithChildren<Props>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
6
6
|
export default Resizable;
|
|
@@ -31,12 +31,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
31
31
|
};
|
|
32
32
|
import { createElement as _createElement } from "react";
|
|
33
33
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
34
|
-
import React, { useEffect, useRef, } from
|
|
35
|
-
import { cloneElement } from
|
|
36
|
-
import { DraggableCore } from
|
|
37
|
-
import classNames from
|
|
34
|
+
import React, { useEffect, useRef, } from "react";
|
|
35
|
+
import { cloneElement } from "./utils/cloneElement";
|
|
36
|
+
import { DraggableCore } from "../Draggable";
|
|
37
|
+
import classNames from "../../external-lib/classnames";
|
|
38
38
|
var Resizable = function (_a) {
|
|
39
|
-
var children = _a.children, _b = _a.axis, axis = _b === void 0 ?
|
|
39
|
+
var children = _a.children, _b = _a.axis, axis = _b === void 0 ? "both" : _b, _c = _a.handleSize, handleSize = _c === void 0 ? [20, 20] : _c, _d = _a.lockAspectRatio, lockAspectRatio = _d === void 0 ? false : _d, _e = _a.minConstraints, minConstraints = _e === void 0 ? [20, 20] : _e, _f = _a.maxConstraints, maxConstraints = _f === void 0 ? [Infinity, Infinity] : _f, _g = _a.resizeHandles, resizeHandles = _g === void 0 ? ["se"] : _g, _h = _a.transformScale, transformScale = _h === void 0 ? 1 : _h, isResizing = _a.isResizing, autoResize = _a.autoResize, colWidth = _a.colWidth, margin = _a.margin, props = __rest(_a, ["children", "axis", "handleSize", "lockAspectRatio", "minConstraints", "maxConstraints", "resizeHandles", "transformScale", "isResizing", "autoResize", "colWidth", "margin"]);
|
|
40
40
|
var handleRefs = useRef({
|
|
41
41
|
s: useRef(null),
|
|
42
42
|
n: useRef(null),
|
|
@@ -66,17 +66,22 @@ var Resizable = function (_a) {
|
|
|
66
66
|
extendedHeightRef.current = null;
|
|
67
67
|
minWidth.current = 0;
|
|
68
68
|
shouldShrinkRef.current = false;
|
|
69
|
+
minHeight.current = 0;
|
|
69
70
|
return;
|
|
70
71
|
}
|
|
71
72
|
if (!elementRef.current) {
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
74
|
-
var placeholder = document.querySelector(
|
|
75
|
+
var placeholder = document.querySelector(".placeholder");
|
|
75
76
|
if (!placeholder) {
|
|
76
77
|
return;
|
|
77
78
|
}
|
|
78
79
|
var target = (_a = placeholder.children[0].children[0].children[0]) !== null && _a !== void 0 ? _a : placeholder.children[0].children[0];
|
|
79
|
-
|
|
80
|
+
var isCCBLayoutbox = target.classList.contains("ccb-layout-box");
|
|
81
|
+
if (isCCBLayoutbox) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (target.clientHeight && !isCCBLayoutbox) {
|
|
80
85
|
minHeight.current = target.clientHeight;
|
|
81
86
|
}
|
|
82
87
|
// target.clientHeight -> 실제 "노드"의 height. (gridItem아닌)
|
|
@@ -91,8 +96,8 @@ var Resizable = function (_a) {
|
|
|
91
96
|
target.clientHeight < elementRef.current.clientHeight) {
|
|
92
97
|
minHeight.current = target.clientHeight;
|
|
93
98
|
}
|
|
94
|
-
var minWidthStyle = target.computedStyleMap().get(
|
|
95
|
-
if (typeof minWidthStyle.value ===
|
|
99
|
+
var minWidthStyle = target.computedStyleMap().get("min-width");
|
|
100
|
+
if (typeof minWidthStyle.value === "number" && margin && colWidth) {
|
|
96
101
|
var minWidthBase = minWidthStyle.value;
|
|
97
102
|
var minColWidth = (minWidthBase + margin[0]) / (colWidth + margin[0]);
|
|
98
103
|
var minW = Math.ceil(minColWidth);
|
|
@@ -100,6 +105,96 @@ var Resizable = function (_a) {
|
|
|
100
105
|
minWidth.current = Math.round(minWidthPx);
|
|
101
106
|
}
|
|
102
107
|
}, [isResizing, autoResize, children, elementRef]);
|
|
108
|
+
useEffect(function () {
|
|
109
|
+
if (!autoResize) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (!isResizing) {
|
|
113
|
+
extendedHeightRef.current = null;
|
|
114
|
+
minWidth.current = 0;
|
|
115
|
+
shouldShrinkRef.current = false;
|
|
116
|
+
minHeight.current = 0;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (!elementRef.current) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
setTimeout(function () {
|
|
123
|
+
var _a;
|
|
124
|
+
var placeholder = document.querySelector(".placeholder");
|
|
125
|
+
if (!placeholder) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
var target = (_a = placeholder.children[0].children[0].children[0]) !== null && _a !== void 0 ? _a : placeholder.children[0].children[0];
|
|
129
|
+
// const oneComposition = target.querySelector(".composition-container");
|
|
130
|
+
var isCCBLayoutbox = target.classList.contains("ccb-layout-box");
|
|
131
|
+
var layoutBox = target.children[0];
|
|
132
|
+
var contentsWrapper = layoutBox.children[0];
|
|
133
|
+
var oneComposition = contentsWrapper.querySelector(".composition-container");
|
|
134
|
+
// const oneComposition =
|
|
135
|
+
// contentsWrapper.children[0].children[0].children[0].children[2];
|
|
136
|
+
if (!isCCBLayoutbox || !oneComposition) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (isCCBLayoutbox && oneComposition) {
|
|
140
|
+
var minCellWidth = 10;
|
|
141
|
+
var numberOfItems = Number(target.getAttribute("data-number-of-items"));
|
|
142
|
+
var numberOfColumns = Number(target.getAttribute("data-number-of-columns"));
|
|
143
|
+
var rowGap = Number(target.getAttribute("data-row-gap"));
|
|
144
|
+
var columnGap = Number(target.getAttribute("data-column-gap"));
|
|
145
|
+
var insetTop = Number(target.getAttribute("data-inset-top"));
|
|
146
|
+
var insetBottom = Number(target.getAttribute("data-inset-bottom"));
|
|
147
|
+
var compositionCols = Number(oneComposition.getAttribute("data-cols"));
|
|
148
|
+
// const compositionRows = Number(
|
|
149
|
+
// oneComposition.getAttribute("data-rows")!
|
|
150
|
+
// );
|
|
151
|
+
var oneCompositionMinWidth = minCellWidth * compositionCols + 20; /* 20px padding */
|
|
152
|
+
// let oneCompositionMinHeight =
|
|
153
|
+
// minColHeight * compositionRows + 20; /* 20px padding */
|
|
154
|
+
// const contentsWrapper = placeholder.querySelector(
|
|
155
|
+
// ".cb-contentslist-wrapper"
|
|
156
|
+
// );
|
|
157
|
+
if (contentsWrapper) {
|
|
158
|
+
var gridWrapperInnerH = contentsWrapper.clientHeight;
|
|
159
|
+
var oneCompositionH = oneComposition.scrollHeight;
|
|
160
|
+
console.log("scrollHeight", oneCompositionH);
|
|
161
|
+
console.log("clientHeight", oneComposition.clientHeight);
|
|
162
|
+
console.log("gap", oneCompositionH - oneComposition.clientHeight);
|
|
163
|
+
var compositionBGwrapperPaddingT = Number(oneComposition.getAttribute("data-wrapper-paddingt"));
|
|
164
|
+
var compositionBGwrapperPaddingB = Number(oneComposition.getAttribute("data-wrapper-paddingb"));
|
|
165
|
+
var compositionBGwrapperPaddingL = Number(oneComposition.getAttribute("data-wrapper-paddingl"));
|
|
166
|
+
var compositionBGwrapperPaddingR = Number(oneComposition.getAttribute("data-wrapper-paddingr"));
|
|
167
|
+
var oneCompositionMinHeight = oneCompositionH +
|
|
168
|
+
compositionBGwrapperPaddingT +
|
|
169
|
+
compositionBGwrapperPaddingB;
|
|
170
|
+
var styles = getComputedStyle(target);
|
|
171
|
+
var paddingL = parseFloat(styles.paddingLeft);
|
|
172
|
+
var paddingR = parseFloat(styles.paddingRight);
|
|
173
|
+
var paddingT = parseFloat(styles.paddingTop);
|
|
174
|
+
var paddingB = parseFloat(styles.paddingBottom);
|
|
175
|
+
var paddingLR = paddingL + paddingR;
|
|
176
|
+
var paddingTB = paddingT + paddingB;
|
|
177
|
+
var compositionWrapperPaddingLR = (compositionBGwrapperPaddingL + compositionBGwrapperPaddingR) *
|
|
178
|
+
numberOfColumns;
|
|
179
|
+
var listMinWidth = oneCompositionMinWidth * numberOfColumns +
|
|
180
|
+
(numberOfColumns - 1) * columnGap +
|
|
181
|
+
paddingLR +
|
|
182
|
+
compositionWrapperPaddingLR;
|
|
183
|
+
var numberOfRows = Math.ceil(numberOfItems / numberOfColumns);
|
|
184
|
+
var gridWrapperTotalH = gridWrapperInnerH + insetTop + insetBottom;
|
|
185
|
+
var listMinHeight = oneCompositionMinHeight * numberOfRows +
|
|
186
|
+
(numberOfRows - 1) * rowGap +
|
|
187
|
+
paddingTB +
|
|
188
|
+
insetTop +
|
|
189
|
+
insetBottom;
|
|
190
|
+
if (listMinHeight > gridWrapperTotalH) {
|
|
191
|
+
minHeight.current = listMinHeight;
|
|
192
|
+
}
|
|
193
|
+
minWidth.current = listMinWidth;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}, 0);
|
|
197
|
+
}, [isResizing, autoResize, children, elementRef]);
|
|
103
198
|
var resetData = function () {
|
|
104
199
|
lastHandleRectRef.current = null;
|
|
105
200
|
slack.current = null;
|
|
@@ -143,6 +238,7 @@ var Resizable = function (_a) {
|
|
|
143
238
|
height = Math.min(maxConstraints[1], height);
|
|
144
239
|
}
|
|
145
240
|
slack.current = [slackW + (oldW - width), slackH + (oldH - height)];
|
|
241
|
+
console.log("minH", minHeight.current);
|
|
146
242
|
return [width, height];
|
|
147
243
|
};
|
|
148
244
|
var checkTopLeft = function (deltaX, deltaY, top, left, width, height, handleAxis) {
|
|
@@ -157,28 +253,28 @@ var Resizable = function (_a) {
|
|
|
157
253
|
var resizableLeft = startPosition.current.left + (startSize.current.width - width);
|
|
158
254
|
var resizableTop = startPosition.current.top + (startSize.current.height - height);
|
|
159
255
|
if (deltaX < 0) {
|
|
160
|
-
if (handleAxis ===
|
|
256
|
+
if (handleAxis === "nw" || handleAxis === "w" || handleAxis === "sw") {
|
|
161
257
|
if (currentSumOfLeftAndWidth > startSumOfLeftAndWidth) {
|
|
162
258
|
newLeft = Math.min(left, resizableLeft);
|
|
163
259
|
}
|
|
164
260
|
}
|
|
165
261
|
}
|
|
166
262
|
if (deltaY < 0) {
|
|
167
|
-
if (handleAxis ===
|
|
263
|
+
if (handleAxis === "nw" || handleAxis === "n" || handleAxis === "ne") {
|
|
168
264
|
if (currentSumOfTopAndHeight > startSumOfTopAndHeight) {
|
|
169
265
|
newTop = Math.min(top, resizableTop);
|
|
170
266
|
}
|
|
171
267
|
}
|
|
172
268
|
}
|
|
173
269
|
if (deltaX > 0) {
|
|
174
|
-
if (handleAxis ===
|
|
270
|
+
if (handleAxis === "nw" || handleAxis === "w" || handleAxis === "sw") {
|
|
175
271
|
if (width >= minConstraints[0]) {
|
|
176
272
|
newLeft = Math.max(left, resizableLeft);
|
|
177
273
|
}
|
|
178
274
|
}
|
|
179
275
|
}
|
|
180
276
|
if (deltaY > 0) {
|
|
181
|
-
if (handleAxis ===
|
|
277
|
+
if (handleAxis === "nw" || handleAxis === "n" || handleAxis === "ne") {
|
|
182
278
|
if (height >= minConstraints[1]) {
|
|
183
279
|
newTop = Math.max(top, resizableTop);
|
|
184
280
|
}
|
|
@@ -191,7 +287,7 @@ var Resizable = function (_a) {
|
|
|
191
287
|
var _b, _c;
|
|
192
288
|
var _d, _e, _f, _g, _h, _j;
|
|
193
289
|
var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
|
|
194
|
-
if (handlerName ===
|
|
290
|
+
if (handlerName === "onResizeStart") {
|
|
195
291
|
var position = { top: (_d = props.top) !== null && _d !== void 0 ? _d : 0, left: (_e = props.left) !== null && _e !== void 0 ? _e : 0 };
|
|
196
292
|
startPosition.current = position;
|
|
197
293
|
startSize.current = {
|
|
@@ -200,12 +296,12 @@ var Resizable = function (_a) {
|
|
|
200
296
|
};
|
|
201
297
|
resetData();
|
|
202
298
|
}
|
|
203
|
-
var canDragX = (axis ===
|
|
204
|
-
handleAxis !==
|
|
205
|
-
handleAxis !==
|
|
206
|
-
var canDragY = (axis ===
|
|
207
|
-
handleAxis !==
|
|
208
|
-
handleAxis !==
|
|
299
|
+
var canDragX = (axis === "both" || axis === "x") &&
|
|
300
|
+
handleAxis !== "n" &&
|
|
301
|
+
handleAxis !== "s";
|
|
302
|
+
var canDragY = (axis === "both" || axis === "y") &&
|
|
303
|
+
handleAxis !== "e" &&
|
|
304
|
+
handleAxis !== "w";
|
|
209
305
|
if (!canDragX && !canDragY)
|
|
210
306
|
return;
|
|
211
307
|
var axisV = handleAxis[0];
|
|
@@ -223,34 +319,35 @@ var Resizable = function (_a) {
|
|
|
223
319
|
// }
|
|
224
320
|
// }
|
|
225
321
|
lastHandleRectRef.current = handleRect;
|
|
226
|
-
if (axisH ===
|
|
322
|
+
if (axisH === "w") {
|
|
227
323
|
deltaX = -deltaX;
|
|
228
324
|
}
|
|
229
|
-
if (axisV ===
|
|
325
|
+
if (axisV === "n") {
|
|
230
326
|
deltaY = -deltaY;
|
|
231
327
|
}
|
|
232
328
|
var width = props.width + (canDragX ? deltaX / transformScale : 0);
|
|
233
329
|
var height = props.height + (canDragY ? deltaY / transformScale : 0);
|
|
234
330
|
var left = (_h = props === null || props === void 0 ? void 0 : props.left) !== null && _h !== void 0 ? _h : 0;
|
|
235
331
|
var top = (_j = props === null || props === void 0 ? void 0 : props.top) !== null && _j !== void 0 ? _j : 0;
|
|
236
|
-
if (axisV ===
|
|
332
|
+
if (axisV === "n") {
|
|
237
333
|
top = top - deltaY;
|
|
238
334
|
}
|
|
239
|
-
if (axisH ===
|
|
335
|
+
if (axisH === "w") {
|
|
240
336
|
left = left - deltaX;
|
|
241
337
|
}
|
|
242
338
|
_b = checkConstraints(width, height), width = _b[0], height = _b[1];
|
|
243
339
|
if (autoResize && minHeight.current === height) {
|
|
244
340
|
handleAxis = removeNorthHandle(handleAxis);
|
|
245
341
|
}
|
|
342
|
+
console.log("deltax deltay", deltaX, deltaY);
|
|
246
343
|
_c = checkTopLeft(deltaX, deltaY, top, left, width, height, handleAxis), top = _c[0], left = _c[1];
|
|
247
344
|
var isDimensionsChanged = width !== props.width || height !== props.height;
|
|
248
|
-
var cb = typeof props[handlerName] ===
|
|
249
|
-
var isCbSkipped = handlerName ===
|
|
345
|
+
var cb = typeof props[handlerName] === "function" ? props[handlerName] : null;
|
|
346
|
+
var isCbSkipped = handlerName === "onResize" && !isDimensionsChanged;
|
|
250
347
|
if (cb && !isCbSkipped) {
|
|
251
348
|
cb(e, { node: node, size: { width: width, height: height, top: top, left: left }, handle: handleAxis });
|
|
252
349
|
}
|
|
253
|
-
if (handlerName ===
|
|
350
|
+
if (handlerName === "onResizeStop") {
|
|
254
351
|
startPosition.current = null;
|
|
255
352
|
startSize.current = null;
|
|
256
353
|
resetData();
|
|
@@ -261,27 +358,27 @@ var Resizable = function (_a) {
|
|
|
261
358
|
if (!handle) {
|
|
262
359
|
return (_jsx("span", { className: "react-resizable-handle react-resizable-handle-".concat(handleAxis), ref: ref }));
|
|
263
360
|
}
|
|
264
|
-
if (typeof handle ===
|
|
361
|
+
if (typeof handle === "function") {
|
|
265
362
|
return handle(handleAxis, ref);
|
|
266
363
|
}
|
|
267
|
-
var isDOMElement = typeof handle.type ===
|
|
364
|
+
var isDOMElement = typeof handle.type === "string";
|
|
268
365
|
var props = __assign({ ref: ref }, (isDOMElement ? {} : { handleAxis: handleAxis }));
|
|
269
366
|
return React.cloneElement(handle, props);
|
|
270
367
|
};
|
|
271
|
-
return cloneElement(children, __assign(__assign({}, restProps), { className: classNames(className !== null && className !== void 0 ? className :
|
|
368
|
+
return cloneElement(children, __assign(__assign({}, restProps), { className: classNames(className !== null && className !== void 0 ? className : "react-resizable"), children: __spreadArray([
|
|
272
369
|
// ...children.props.children,
|
|
273
370
|
React.Children.map(children.props.children, function (child) { return child; })
|
|
274
371
|
], resizeHandles.map(function (handleAxis) {
|
|
275
372
|
var ref = (handleRefs === null || handleRefs === void 0 ? void 0 : handleRefs.current) && handleRefs.current[handleAxis];
|
|
276
|
-
return (_createElement(DraggableCore, __assign({}, draggableOpts, { nodeRef: ref, key: "resizableHandle-".concat(handleAxis), onStop: resizeHandler(
|
|
373
|
+
return (_createElement(DraggableCore, __assign({}, draggableOpts, { nodeRef: ref, key: "resizableHandle-".concat(handleAxis), onStop: resizeHandler("onResizeStop", handleAxis), onStart: resizeHandler("onResizeStart", handleAxis), onDrag: resizeHandler("onResize", handleAxis) }), renderResizeHandle(handleAxis, ref)));
|
|
277
374
|
}), true) }));
|
|
278
375
|
};
|
|
279
376
|
function removeNorthHandle(axis) {
|
|
280
377
|
switch (axis) {
|
|
281
|
-
case
|
|
282
|
-
return
|
|
283
|
-
case
|
|
284
|
-
return
|
|
378
|
+
case "ne":
|
|
379
|
+
return "e";
|
|
380
|
+
case "nw":
|
|
381
|
+
return "w";
|
|
285
382
|
default:
|
|
286
383
|
return axis;
|
|
287
384
|
}
|