publ-echo-test 0.0.225 → 0.0.226

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.
@@ -138,7 +138,6 @@ var GridItem = function (_a) {
138
138
  var callback = function (mutationsList) {
139
139
  for (var _i = 0, mutationsList_2 = mutationsList; _i < mutationsList_2.length; _i++) {
140
140
  var mutation = mutationsList_2[_i];
141
- console.log('mutation', mutation);
142
141
  var isSizeChanged = mutation.attributeName === 'data-min-width' || mutation.attributeName === 'data-min-height';
143
142
  var keepWidth = true;
144
143
  var hasPaddingChanged = false;
@@ -154,9 +153,6 @@ var GridItem = function (_a) {
154
153
  var width = targetNode.clientWidth;
155
154
  if (!isSizeChanged && mutation.target instanceof Element) {
156
155
  var styles = getComputedStyle(mutation.target);
157
- // const minWidth = parseFloat(styles.minWidth);
158
- console.log('minWidth', minWidth, 'width', width);
159
- console.log('minHeight', minHeight, 'height', height);
160
156
  if (minWidth > width) {
161
157
  keepWidth = false;
162
158
  }
@@ -207,6 +203,38 @@ var GridItem = function (_a) {
207
203
  observer.disconnect();
208
204
  };
209
205
  }, [autoResize, isSelected, isDragging, isResizing, props.w, props.h, x, y]);
206
+ useEffect(function () {
207
+ var _a, _b, _c, _d, _e;
208
+ if (!isSelected || !autoResize) {
209
+ return;
210
+ }
211
+ var targetNode = (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.children[0].children[0].children[0];
212
+ if (!targetNode || isDragging || isResizing) {
213
+ return;
214
+ }
215
+ if (targetNode.id !== 'contentslist-box') {
216
+ return;
217
+ }
218
+ var minWidth = Number((_c = (_b = targetNode.dataset) === null || _b === void 0 ? void 0 : _b.minWidth) !== null && _c !== void 0 ? _c : 0);
219
+ var minHeight = Number((_e = (_d = targetNode.dataset) === null || _d === void 0 ? void 0 : _d.minHeight) !== null && _e !== void 0 ? _e : 0);
220
+ var _f = calcWH(getPositionParams(), {
221
+ width: minWidth,
222
+ height: minHeight,
223
+ }, x, y, 'e', props.w, props.h, false), w = _f.w, h = _f.h;
224
+ var prevW = props.w;
225
+ var prevH = props.h;
226
+ if (prevW > w) {
227
+ w = prevW;
228
+ }
229
+ if (prevH > h) {
230
+ h = prevH;
231
+ }
232
+ if (prevH === h && prevW === w) {
233
+ return;
234
+ }
235
+ props.onFitToContent &&
236
+ props.onFitToContent(i, w, h, x, y, { hasPaddingChanged: false });
237
+ }, [isSelected, autoResize]);
210
238
  // const moveDroppingItem = (prevProps: GridItemProps) => {
211
239
  // const { droppingPosition } = props;
212
240
  // if (!droppingPosition) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.225",
3
+ "version": "0.0.226",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",