@tmagic/stage 1.1.0-beta.9 → 1.1.0

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.
@@ -386,10 +386,12 @@ class StageDragResize extends EventEmitter {
386
386
  return;
387
387
  const { beforeTranslate } = drag;
388
388
  this.dragStatus = StageDragStatus.ING;
389
- this.moveableHelper?.onResize(e);
390
389
  if (this.mode === Mode.SORTABLE) {
391
390
  this.target.style.top = "0px";
391
+ this.dragEl.style.width = `${width}px`;
392
+ this.dragEl.style.height = `${height}px`;
392
393
  } else {
394
+ this.moveableHelper?.onResize(e);
393
395
  this.target.style.left = `${frame.left + beforeTranslate[0]}px`;
394
396
  this.target.style.top = `${frame.top + beforeTranslate[1]}px`;
395
397
  }
@@ -594,6 +596,7 @@ class StageDragResize extends EventEmitter {
594
596
  return {};
595
597
  const isAbsolute = this.mode === Mode.ABSOLUTE;
596
598
  const isFixed = this.mode === Mode.FIXED;
599
+ const isSortable = this.mode === Mode.SORTABLE;
597
600
  let { moveableOptions = {} } = this.core.config;
598
601
  if (typeof moveableOptions === "function") {
599
602
  moveableOptions = moveableOptions(this.core);
@@ -640,7 +643,7 @@ class StageDragResize extends EventEmitter {
640
643
  top: 0,
641
644
  left: -1,
642
645
  right: this.container.clientWidth - 1,
643
- bottom: this.container.clientHeight,
646
+ bottom: isSortable ? void 0 : this.container.clientHeight,
644
647
  ...moveableOptions.bounds || {}
645
648
  },
646
649
  ...options,
@@ -1169,9 +1172,7 @@ class StageMultiDragResize extends EventEmitter {
1169
1172
  createAuto: true
1170
1173
  });
1171
1174
  const frames = [];
1172
- this.moveableForMulti.on("dragGroupStart", (params) => {
1173
- const { events } = params;
1174
- this.multiMoveableHelper?.onDragGroupStart(params);
1175
+ const setFrames = (events) => {
1175
1176
  events.forEach((ev) => {
1176
1177
  const matchEventTarget = this.targetList.find((targetItem) => targetItem.id === ev.target.id.replace(DRAG_EL_ID_PREFIX, ""));
1177
1178
  if (!matchEventTarget)
@@ -1182,6 +1183,39 @@ class StageMultiDragResize extends EventEmitter {
1182
1183
  id: matchEventTarget.id
1183
1184
  });
1184
1185
  });
1186
+ };
1187
+ this.moveableForMulti.on("resizeGroupStart", (params) => {
1188
+ const { events } = params;
1189
+ this.multiMoveableHelper?.onResizeGroupStart(params);
1190
+ setFrames(events);
1191
+ this.dragStatus = StageDragStatus.START;
1192
+ }).on("resizeGroup", (params) => {
1193
+ const { events } = params;
1194
+ events.forEach((ev) => {
1195
+ const { width, height, beforeTranslate } = ev.drag;
1196
+ const frameSnapShot = frames.find((frameItem) => frameItem.id === ev.target.id.replace(DRAG_EL_ID_PREFIX, ""));
1197
+ if (!frameSnapShot)
1198
+ return;
1199
+ const targeEl = this.targetList.find((targetItem) => targetItem.id === ev.target.id.replace(DRAG_EL_ID_PREFIX, ""));
1200
+ if (!targeEl)
1201
+ return;
1202
+ const isParentIncluded = this.targetList.find((targetItem) => targetItem.id === targeEl.parentElement?.id);
1203
+ if (!isParentIncluded) {
1204
+ targeEl.style.left = `${frameSnapShot.left + beforeTranslate[0]}px`;
1205
+ targeEl.style.top = `${frameSnapShot.top + beforeTranslate[1]}px`;
1206
+ }
1207
+ targeEl.style.width = `${width}px`;
1208
+ targeEl.style.height = `${height}px`;
1209
+ });
1210
+ this.multiMoveableHelper?.onResizeGroup(params);
1211
+ this.dragStatus = StageDragStatus.ING;
1212
+ }).on("resizeGroupEnd", () => {
1213
+ this.update(true);
1214
+ this.dragStatus = StageDragStatus.END;
1215
+ }).on("dragGroupStart", (params) => {
1216
+ const { events } = params;
1217
+ this.multiMoveableHelper?.onDragGroupStart(params);
1218
+ setFrames(events);
1185
1219
  this.dragStatus = StageDragStatus.START;
1186
1220
  }).on("dragGroup", (params) => {
1187
1221
  const { events } = params;
@@ -1278,7 +1312,7 @@ class StageMultiDragResize extends EventEmitter {
1278
1312
  defaultGroupRotate: 0,
1279
1313
  defaultGroupOrigin: "50% 50%",
1280
1314
  draggable: true,
1281
- resizable: false,
1315
+ resizable: true,
1282
1316
  throttleDrag: 0,
1283
1317
  startDragRotate: 0,
1284
1318
  throttleDragRotate: 0,
@@ -1299,7 +1333,7 @@ class StageMultiDragResize extends EventEmitter {
1299
1333
  }
1300
1334
  }
1301
1335
 
1302
- const style = ".tmagic-stage-container-highlight::after {\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background-color: #000;\n opacity: .1;\n pointer-events: none;\n}\n";
1336
+ const style = ".tmagic-stage-container-highlight::after {\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background-color: #000;\n opacity: .1;\n pointer-events: none;\n}\n\n.magic-ui-container.magic-layout-relative {\n min-height: 50px;\n}\n";
1303
1337
 
1304
1338
  class StageRender extends EventEmitter {
1305
1339
  contentWindow = null;