@tmagic/stage 1.1.0-beta.9 → 1.1.2

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.
@@ -392,10 +392,12 @@
392
392
  return;
393
393
  const { beforeTranslate } = drag;
394
394
  this.dragStatus = StageDragStatus.ING;
395
- this.moveableHelper?.onResize(e);
396
395
  if (this.mode === Mode.SORTABLE) {
397
396
  this.target.style.top = "0px";
397
+ this.dragEl.style.width = `${width}px`;
398
+ this.dragEl.style.height = `${height}px`;
398
399
  } else {
400
+ this.moveableHelper?.onResize(e);
399
401
  this.target.style.left = `${frame.left + beforeTranslate[0]}px`;
400
402
  this.target.style.top = `${frame.top + beforeTranslate[1]}px`;
401
403
  }
@@ -600,6 +602,7 @@
600
602
  return {};
601
603
  const isAbsolute = this.mode === Mode.ABSOLUTE;
602
604
  const isFixed = this.mode === Mode.FIXED;
605
+ const isSortable = this.mode === Mode.SORTABLE;
603
606
  let { moveableOptions = {} } = this.core.config;
604
607
  if (typeof moveableOptions === "function") {
605
608
  moveableOptions = moveableOptions(this.core);
@@ -646,7 +649,7 @@
646
649
  top: 0,
647
650
  left: -1,
648
651
  right: this.container.clientWidth - 1,
649
- bottom: this.container.clientHeight,
652
+ bottom: isSortable ? void 0 : this.container.clientHeight,
650
653
  ...moveableOptions.bounds || {}
651
654
  },
652
655
  ...options,
@@ -1175,9 +1178,7 @@
1175
1178
  createAuto: true
1176
1179
  });
1177
1180
  const frames = [];
1178
- this.moveableForMulti.on("dragGroupStart", (params) => {
1179
- const { events } = params;
1180
- this.multiMoveableHelper?.onDragGroupStart(params);
1181
+ const setFrames = (events) => {
1181
1182
  events.forEach((ev) => {
1182
1183
  const matchEventTarget = this.targetList.find((targetItem) => targetItem.id === ev.target.id.replace(DRAG_EL_ID_PREFIX, ""));
1183
1184
  if (!matchEventTarget)
@@ -1188,6 +1189,39 @@
1188
1189
  id: matchEventTarget.id
1189
1190
  });
1190
1191
  });
1192
+ };
1193
+ this.moveableForMulti.on("resizeGroupStart", (params) => {
1194
+ const { events } = params;
1195
+ this.multiMoveableHelper?.onResizeGroupStart(params);
1196
+ setFrames(events);
1197
+ this.dragStatus = StageDragStatus.START;
1198
+ }).on("resizeGroup", (params) => {
1199
+ const { events } = params;
1200
+ events.forEach((ev) => {
1201
+ const { width, height, beforeTranslate } = ev.drag;
1202
+ const frameSnapShot = frames.find((frameItem) => frameItem.id === ev.target.id.replace(DRAG_EL_ID_PREFIX, ""));
1203
+ if (!frameSnapShot)
1204
+ return;
1205
+ const targeEl = this.targetList.find((targetItem) => targetItem.id === ev.target.id.replace(DRAG_EL_ID_PREFIX, ""));
1206
+ if (!targeEl)
1207
+ return;
1208
+ const isParentIncluded = this.targetList.find((targetItem) => targetItem.id === targeEl.parentElement?.id);
1209
+ if (!isParentIncluded) {
1210
+ targeEl.style.left = `${frameSnapShot.left + beforeTranslate[0]}px`;
1211
+ targeEl.style.top = `${frameSnapShot.top + beforeTranslate[1]}px`;
1212
+ }
1213
+ targeEl.style.width = `${width}px`;
1214
+ targeEl.style.height = `${height}px`;
1215
+ });
1216
+ this.multiMoveableHelper?.onResizeGroup(params);
1217
+ this.dragStatus = StageDragStatus.ING;
1218
+ }).on("resizeGroupEnd", () => {
1219
+ this.update(true);
1220
+ this.dragStatus = StageDragStatus.END;
1221
+ }).on("dragGroupStart", (params) => {
1222
+ const { events } = params;
1223
+ this.multiMoveableHelper?.onDragGroupStart(params);
1224
+ setFrames(events);
1191
1225
  this.dragStatus = StageDragStatus.START;
1192
1226
  }).on("dragGroup", (params) => {
1193
1227
  const { events } = params;
@@ -1284,7 +1318,7 @@
1284
1318
  defaultGroupRotate: 0,
1285
1319
  defaultGroupOrigin: "50% 50%",
1286
1320
  draggable: true,
1287
- resizable: false,
1321
+ resizable: true,
1288
1322
  throttleDrag: 0,
1289
1323
  startDragRotate: 0,
1290
1324
  throttleDragRotate: 0,
@@ -1305,7 +1339,7 @@
1305
1339
  }
1306
1340
  }
1307
1341
 
1308
- 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";
1342
+ 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";
1309
1343
 
1310
1344
  class StageRender extends EventEmitter.EventEmitter {
1311
1345
  contentWindow = null;