@sepveneto/dnde 0.6.4 → 0.6.5

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.
Files changed (2) hide show
  1. package/dist/editor.js +68 -10
  2. package/package.json +1 -1
package/dist/editor.js CHANGED
@@ -100383,7 +100383,12 @@ var Widget = class _Widget {
100383
100383
  }
100384
100384
  get isFixed() {
100385
100385
  var _a;
100386
- return (_a = this._data.meta) == null ? void 0 : _a.fixed;
100386
+ const fixed = (_a = this._data.meta) == null ? void 0 : _a.fixed;
100387
+ if (fixed === true) {
100388
+ return "header";
100389
+ } else {
100390
+ return fixed;
100391
+ }
100387
100392
  }
100388
100393
  get visible() {
100389
100394
  var _a, _b;
@@ -107310,11 +107315,26 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
107310
107315
  setup(__props) {
107311
107316
  const editor = useEditor();
107312
107317
  function onAdd(evt) {
107318
+ const prevNode = editor.rootNode.list[evt.newIndex - 1];
107313
107319
  const nextNode = editor.rootNode.list[evt.newIndex + 1];
107314
- if (nextNode && nextNode.widget.isFixed) {
107315
- const deletedNode = editor.rootNode.list.splice(0, 1)[0];
107320
+ if (nextNode && nextNode.widget.isFixed === "header") {
107321
+ const deletedNode = editor.rootNode.list.splice(evt.newIndex, 1)[0];
107316
107322
  if (evt.to !== evt.from) {
107317
107323
  const oldContainer = editor.nodeMap.get(evt.from.dataset.id);
107324
+ if (!oldContainer) {
107325
+ return;
107326
+ }
107327
+ oldContainer.list.splice(evt.oldIndex, 0, deletedNode);
107328
+ }
107329
+ return;
107330
+ }
107331
+ if (prevNode && prevNode.widget.isFixed === "footer") {
107332
+ const deletedNode = editor.rootNode.list.splice(evt.newIndex, 1)[0];
107333
+ if (evt.to !== evt.from) {
107334
+ const oldContainer = editor.nodeMap.get(evt.from.dataset.id);
107335
+ if (!oldContainer) {
107336
+ return;
107337
+ }
107318
107338
  oldContainer.list.splice(evt.oldIndex, 0, deletedNode);
107319
107339
  }
107320
107340
  return;
@@ -107333,9 +107353,23 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
107333
107353
  return;
107334
107354
  }
107335
107355
  if (wid === val[originIndex].wid) {
107336
- val.splice(originIndex, 1);
107356
+ const newIndex = val.findLastIndex((node) => node.wid === wid);
107357
+ const prevIndex = newIndex - 1;
107358
+ const nextIndex = newIndex + 1;
107359
+ const prevNode = val[prevIndex];
107360
+ const nextNode = val[nextIndex];
107361
+ if (prevNode && prevNode.widget.isFixed === "footer" || nextNode && nextNode.widget.isFixed === "header") ; else {
107362
+ val.splice(originIndex, 1);
107363
+ }
107337
107364
  } else {
107338
- val.splice(originIndex + 1, 1);
107365
+ const newIndex = val.findIndex((node) => node.wid === wid);
107366
+ const prevIndex = newIndex - 1;
107367
+ const nextIndex = newIndex + 1;
107368
+ const prevNode = val[prevIndex];
107369
+ const nextNode = val[nextIndex];
107370
+ if (prevNode && prevNode.widget.isFixed === "footer" || nextNode && nextNode.widget.isFixed === "header") ; else {
107371
+ val.splice(originIndex + 1, 1);
107372
+ }
107339
107373
  }
107340
107374
  nextTick().then(() => {
107341
107375
  editor.rootNode.list = val;
@@ -107376,9 +107410,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
107376
107410
  }
107377
107411
  });
107378
107412
 
107379
- const _style_0$2 = "\n.tree-panel-container[data-v-2dd120c0] {\n min-height: 500px;\n box-sizing: border-box;\n}\n.tree-panel-container[data-v-2dd120c0]:hover {\n box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);\n transition: all 0.3s ease;\n}\n\n/* 拖拽列表动画 */\n.flip-list-move[data-v-2dd120c0] {\n transition: transform 0.3s ease;\n}\n.flip-list-enter-active[data-v-2dd120c0],\n.flip-list-leave-active[data-v-2dd120c0] {\n transition: all 0.3s ease;\n}\n.flip-list-enter-from[data-v-2dd120c0],\n.flip-list-leave-to[data-v-2dd120c0] {\n opacity: 0;\n transform: translateX(30px);\n}\n\n/* 拖拽时的幽灵元素样式 */\n.dragging-ghost[data-v-2dd120c0] {\n opacity: 0.7;\n background-color: #f5f7fa;\n border: 1px dashed #409eff;\n border-radius: 4px;\n transform: scale(0.98);\n}\n";
107413
+ const _style_0$2 = "\n.tree-panel-container[data-v-abe2c450] {\n min-height: 500px;\n box-sizing: border-box;\n}\n.tree-panel-container[data-v-abe2c450]:hover {\n box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);\n transition: all 0.3s ease;\n}\n\n/* 拖拽列表动画 */\n.flip-list-move[data-v-abe2c450] {\n transition: transform 0.3s ease;\n}\n.flip-list-enter-active[data-v-abe2c450],\n.flip-list-leave-active[data-v-abe2c450] {\n transition: all 0.3s ease;\n}\n.flip-list-enter-from[data-v-abe2c450],\n.flip-list-leave-to[data-v-abe2c450] {\n opacity: 0;\n transform: translateX(30px);\n}\n\n/* 拖拽时的幽灵元素样式 */\n.dragging-ghost[data-v-abe2c450] {\n opacity: 0.7;\n background-color: #f5f7fa;\n border: 1px dashed #409eff;\n border-radius: 4px;\n transform: scale(0.98);\n}\n";
107380
107414
 
107381
- const TreePanel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["styles", [_style_0$2]], ["__scopeId", "data-v-2dd120c0"]]);
107415
+ const TreePanel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["styles", [_style_0$2]], ["__scopeId", "data-v-abe2c450"]]);
107382
107416
 
107383
107417
  const _sfc_main$3 = { };
107384
107418
 
@@ -107592,8 +107626,20 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
107592
107626
  if (evt.from !== evt.to)
107593
107627
  return;
107594
107628
  const nextNode = editor.rootNode.list[evt.draggedContext.futureIndex];
107595
- if (nextNode && nextNode.widget.isFixed) {
107596
- return false;
107629
+ const direct = evt.draggedContext.index - evt.draggedContext.futureIndex;
107630
+ if (direct > 0) {
107631
+ if (nextNode && nextNode.widget.isFixed === "header") {
107632
+ return false;
107633
+ }
107634
+ } else {
107635
+ for (let i = evt.draggedContext.futureIndex; i > 0; --i) {
107636
+ const node = editor.rootNode.list[i];
107637
+ if (!node)
107638
+ continue;
107639
+ if (node.widget.isFixed === "footer") {
107640
+ return false;
107641
+ }
107642
+ }
107597
107643
  }
107598
107644
  }
107599
107645
  function handelStart(evt) {
@@ -107603,7 +107649,19 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
107603
107649
  }
107604
107650
  function onAdd(evt) {
107605
107651
  const nextNode = editor.rootNode.list[evt.newIndex + 1];
107606
- if (nextNode && nextNode.widget.isFixed) {
107652
+ const prevNode = editor.rootNode.list[evt.newIndex - 1];
107653
+ if (nextNode && nextNode.widget.isFixed === "header") {
107654
+ const deletedNode = editor.rootNode.list.splice(evt.newIndex, 1)[0];
107655
+ if (evt.to !== evt.from) {
107656
+ const oldContainer = editor.nodeMap.get(evt.from.dataset.id);
107657
+ if (!oldContainer) {
107658
+ return;
107659
+ }
107660
+ oldContainer.list.splice(evt.oldIndex, 0, deletedNode);
107661
+ }
107662
+ return;
107663
+ }
107664
+ if (prevNode && prevNode.widget.isFixed === "footer") {
107607
107665
  const deletedNode = editor.rootNode.list.splice(evt.newIndex, 1)[0];
107608
107666
  if (evt.to !== evt.from) {
107609
107667
  const oldContainer = editor.nodeMap.get(evt.from.dataset.id);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sepveneto/dnde",
3
3
  "type": "module",
4
- "version": "0.6.4",
4
+ "version": "0.6.5",
5
5
  "description": "",
6
6
  "author": "",
7
7
  "license": "GPL",