publ-echo-test 0.0.208 → 0.0.210

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.
@@ -36,6 +36,7 @@ var GridItem = function (_a) {
36
36
  var _o = useState(), dragStart = _o[0], setDragStart = _o[1];
37
37
  var _p = useState(false), isDragging = _p[0], setIsDragging = _p[1];
38
38
  var _q = useState(false), isResizing = _q[0], setIsResizing = _q[1];
39
+ var _r = useState(false), pointerEventsNone = _r[0], setPointerEventsNone = _r[1];
39
40
  var elementRef = useRef(null);
40
41
  var isSelected = (_b = elementRef.current) === null || _b === void 0 ? void 0 : _b.classList.contains('react-grid-item-selected');
41
42
  useEffect(function () {
@@ -53,90 +54,65 @@ var GridItem = function (_a) {
53
54
  var prevPaddingB = parseFloat(getComputedStyle(targetNode).paddingBottom);
54
55
  // MutationObserver 콜백 함수
55
56
  var callback = function (mutationsList) {
56
- var _a, _b;
57
- try {
58
- for (var _i = 0, mutationsList_1 = mutationsList; _i < mutationsList_1.length; _i++) {
59
- var mutation = mutationsList_1[_i];
60
- if (mutation.type === 'attributes') {
61
- var oldClass = mutation.oldValue || '';
62
- var newClass = (_b = (_a = mutation.target) === null || _a === void 0 ? void 0 : _a.getAttribute('class')) !== null && _b !== void 0 ? _b : '';
63
- // hover로 인해 "hovered" 클래스가 추가된 경우
64
- if (!oldClass.includes('hovered') && newClass.includes('hovered')) {
65
- console.log('Hover 상태로 변경됨');
66
- return;
67
- }
68
- // hover에서 벗어난 경우
69
- if (oldClass.includes('hovered') && !newClass.includes('hovered')) {
70
- console.log('Hover 상태 해제됨');
71
- return;
72
- }
57
+ for (var _i = 0, mutationsList_1 = mutationsList; _i < mutationsList_1.length; _i++) {
58
+ var mutation = mutationsList_1[_i];
59
+ var isCharacterChanged = mutation.type === 'characterData';
60
+ var keepWidth = true;
61
+ var hasPaddingChanged = false;
62
+ var height = isCharacterChanged
63
+ ? mutation.target.parentNode.clientHeight
64
+ : mutation.target.clientHeight;
65
+ var width = targetNode.clientWidth;
66
+ if (!isCharacterChanged && mutation.target instanceof Element) {
67
+ var styles = getComputedStyle(mutation.target);
68
+ var minWidth = parseFloat(styles.minWidth);
69
+ if (minWidth > width) {
70
+ keepWidth = false;
73
71
  }
74
- var isCharacterChanged = mutation.type === 'characterData';
75
- var keepWidth = true;
76
- var hasPaddingChanged = false;
77
- var height = isCharacterChanged
78
- ? mutation.target.parentNode.clientHeight
79
- : mutation.target.clientHeight;
80
- var width = targetNode.clientWidth;
81
- if (!isCharacterChanged && mutation.target instanceof Element) {
82
- var styles = getComputedStyle(mutation.target);
83
- var minWidth = parseFloat(styles.minWidth);
84
- if (minWidth > width) {
85
- keepWidth = false;
86
- }
87
- // NOTE: POC
88
- var paddingL = parseFloat(styles.paddingLeft);
89
- var paddingR = parseFloat(styles.paddingRight);
90
- var paddingT = parseFloat(styles.paddingTop);
91
- var paddingB = parseFloat(styles.paddingBottom);
92
- if (prevPaddingL !== paddingL ||
93
- prevPaddingR !== paddingR ||
94
- prevPaddingT !== paddingT ||
95
- prevPaddingB !== paddingB) {
96
- hasPaddingChanged = true;
97
- keepWidth = false;
98
- }
72
+ // NOTE: POC
73
+ var paddingL = parseFloat(styles.paddingLeft);
74
+ var paddingR = parseFloat(styles.paddingRight);
75
+ var paddingT = parseFloat(styles.paddingTop);
76
+ var paddingB = parseFloat(styles.paddingBottom);
77
+ if (prevPaddingL !== paddingL ||
78
+ prevPaddingR !== paddingR ||
79
+ prevPaddingT !== paddingT ||
80
+ prevPaddingB !== paddingB) {
81
+ hasPaddingChanged = true;
82
+ keepWidth = false;
99
83
  }
100
- var prevW = props.w;
101
- var prevH = props.h;
102
- var _c = calcWH(getPositionParams(), {
103
- width: width,
104
- height: height,
105
- }, x, y, 'e', props.w, props.h, false), w_1 = _c.w, h_1 = _c.h;
106
- if (keepWidth) {
107
- w_1 = prevW;
108
- }
109
- if (prevH > h_1) {
110
- h_1 = prevH;
111
- }
112
- var _d = getResizableXYPosition('e', w_1, h_1, prevW, prevH), newX = _d.newX, newY = _d.newY;
113
- if (prevH === h_1 && prevW === w_1 && newX === x && newY === y) {
114
- return;
115
- }
116
- props.onFitToContent &&
117
- props.onFitToContent(i, w_1, h_1, newX, newY, { hasPaddingChanged: hasPaddingChanged });
118
84
  }
119
- }
120
- catch (e) {
121
- console.error(e);
85
+ var prevW = props.w;
86
+ var prevH = props.h;
87
+ var _a = calcWH(getPositionParams(), {
88
+ width: width,
89
+ height: height,
90
+ }, x, y, 'e', props.w, props.h, false), w_1 = _a.w, h_1 = _a.h;
91
+ if (keepWidth) {
92
+ w_1 = prevW;
93
+ }
94
+ if (prevH > h_1) {
95
+ h_1 = prevH;
96
+ }
97
+ var _b = getResizableXYPosition('e', w_1, h_1, prevW, prevH), newX = _b.newX, newY = _b.newY;
98
+ if (prevH === h_1 && prevW === w_1 && newX === x && newY === y) {
99
+ return;
100
+ }
101
+ props.onFitToContent &&
102
+ props.onFitToContent(i, w_1, h_1, newX, newY, { hasPaddingChanged: hasPaddingChanged });
122
103
  }
123
104
  };
124
105
  // MutationObserver 인스턴스 생성
125
106
  var observer = new MutationObserver(callback);
126
107
  // 관찰할 DOM 변이 설정
127
- var config = {
128
- characterData: true,
129
- attributes: true,
130
- subtree: true,
131
- attributeOldValue: true,
132
- };
108
+ var config = { characterData: true, attributes: true, subtree: true };
133
109
  // 대상 노드와 설정으로 관찰 시작
134
110
  observer.observe(targetNode, config);
135
111
  // 정리 함수에서 MutationObserver 해제
136
112
  return function () {
137
113
  observer.disconnect();
138
114
  };
139
- }, [autoResize, isSelected, isResizing, props.w, props.h, x, y]);
115
+ }, [autoResize, isSelected, isDragging, isResizing, props.w, props.h, x, y]);
140
116
  // const moveDroppingItem = (prevProps: GridItemProps) => {
141
117
  // const { droppingPosition } = props;
142
118
  // if (!droppingPosition) return;
@@ -13,10 +13,10 @@ var OutsideClickHandler = function (_a) {
13
13
  useEffect(function () {
14
14
  var handleClickOutside = function (e) {
15
15
  var target = e.target;
16
- console.log(target);
17
16
  if (target.closest('.editable-grid-item') ||
18
17
  target.closest('.group') ||
19
- target.closest('.placeholder')) {
18
+ target.closest('.placeholder') ||
19
+ target.closest('.react-group-block')) {
20
20
  return;
21
21
  }
22
22
  if (wrapperRef.current &&
@@ -31,7 +31,7 @@ var OutsideClickHandler = function (_a) {
31
31
  }
32
32
  return function () {
33
33
  if (selectedSection) {
34
- selectedSection.addEventListener('dblclick', handleClickOutside);
34
+ selectedSection.removeEventListener('dblclick', handleClickOutside);
35
35
  }
36
36
  };
37
37
  }, [onOutsideClick]);
@@ -692,7 +692,7 @@ var ReactGridLayout = function (_a) {
692
692
  return zIndexMap.EDITING_GROUP_CHILD + zOrder;
693
693
  }
694
694
  if (!isRoot && type === 'GROUP_BLOCK') {
695
- return zIndexMap.EDITING_GROUP;
695
+ return zIndexMap.EDITING_GROUP_CHILD + zOrder;
696
696
  }
697
697
  if (type === 'GROUP_BLOCK') {
698
698
  return zIndexMap.GROUP;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.208",
3
+ "version": "0.0.210",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",