@tmagic/editor 1.3.13 → 1.3.15

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.
@@ -1,16 +1,16 @@
1
- import { defineComponent, ref, watch, onMounted, onBeforeUnmount, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx, Fragment, resolveDynamicComponent, createTextVNode, createCommentVNode, toRaw, nextTick, mergeProps, toDisplayString, renderList, createStaticVNode, watchEffect, withModifiers, renderSlot, normalizeProps, resolveDirective, withDirectives, createSlots, markRaw, getCurrentInstance, vShow, provide, Transition, toHandlers, mergeDefaults } from 'vue';
1
+ import { defineComponent, ref, watch, onMounted, onBeforeUnmount, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx, Fragment, resolveDynamicComponent, createTextVNode, createCommentVNode, toRaw, nextTick, mergeProps, toDisplayString, renderList, createStaticVNode, watchEffect, withModifiers, renderSlot, toHandlers, resolveDirective, withDirectives, createSlots, markRaw, getCurrentInstance, vShow, provide, Transition, mergeDefaults } from 'vue';
2
2
  import { FullScreen, Edit, View, Coin, Delete, Plus, Close, ArrowDown, ArrowLeftBold, ArrowRightBold, CaretBottom, DocumentCopy, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, ArrowRight, CopyDocument, Files, Hide, Goods, List, EditPen, CloseBold, Top, Bottom } from '@element-plus/icons-vue';
3
3
  import { throttle, isEmpty, cloneDeep, mergeWith, isObject, uniq, get, map, has, pick, keys } from 'lodash-es';
4
4
  import serialize from 'serialize-javascript';
5
5
  import { TMagicButton, TMagicCard, tMagicMessage, TMagicDialog, TMagicTag, tMagicMessageBox, TMagicIcon, getConfig as getConfig$1, TMagicSwitch, TMagicInput, TMagicTooltip, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicPopover, TMagicScrollbar, TMagicCollapse, TMagicCollapseItem } from '@tmagic/design';
6
6
  import { emmetHTML, emmetCSS } from 'emmet-monaco-es';
7
7
  import * as monaco from 'monaco-editor';
8
- import { HookType, NodeType, ActionType } from '@tmagic/schema';
9
- import { MFormBox, MFormDrawer, MForm, createValues, MSelect } from '@tmagic/form';
8
+ import { HookCodeType, HookType, NodeType, ActionType } from '@tmagic/schema';
9
+ import { MFormBox, MFormDrawer, MForm, filterFunction, createValues, MSelect } from '@tmagic/form';
10
10
  import { MagicTable } from '@tmagic/table';
11
11
  import { guid, isPage, isPageFragment, isPop, getNodePath, isNumber, toLine, getValueByKeyPath, setValueByKeyPath, getDefaultValueFromFields, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, addClassName, removeClassName, removeClassNameByClassName, convertToNumber, getNodes } from '@tmagic/utils';
12
12
  import Gesto from 'gesto';
13
- import Moveable from 'moveable';
13
+ import VanillaMoveable from 'moveable';
14
14
  import { Watcher, DepTargetType, createRelatedCompTarget, createCodeBlockTarget, createDataSourceTarget, createDataSourceMethodTarget, createDataSourceCondTarget } from '@tmagic/dep';
15
15
  export { DepTargetType } from '@tmagic/dep';
16
16
  import StageCore, { GuidesType, getOffset, calcValueByFontsize, RenderType, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
@@ -362,13 +362,58 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
362
362
  name: "hookData",
363
363
  enableToggleMode: false,
364
364
  expandAll: true,
365
- titleKey: "codeId",
365
+ title: (mForm, { model, index }) => {
366
+ if (model.codeType === HookCodeType.DATA_SOURCE_METHOD) {
367
+ if (Array.isArray(model.codeId)) {
368
+ if (model.codeId.length < 2) {
369
+ return index;
370
+ }
371
+ const ds = services?.dataSourceService.getDataSourceById(model.codeId[0]);
372
+ return `${ds?.title} / ${model.codeId[1]}`;
373
+ }
374
+ return Array.isArray(model.codeId) ? model.codeId.join("/") : index;
375
+ }
376
+ return model.codeId || index;
377
+ },
366
378
  items: [
367
379
  {
368
- type: "code-select-col",
369
- name: "codeId",
370
- labelWidth: 0,
371
- disabled: () => !services?.codeBlockService.getEditStatus()
380
+ type: "row",
381
+ items: [
382
+ {
383
+ type: "select",
384
+ name: "codeType",
385
+ span: 8,
386
+ options: [
387
+ { value: HookCodeType.CODE, text: "代码块" },
388
+ { value: HookCodeType.DATA_SOURCE_METHOD, text: "数据源方法" }
389
+ ],
390
+ defaultValue: "code",
391
+ onChange: (mForm, v, { model }) => {
392
+ if (v === HookCodeType.DATA_SOURCE_METHOD) {
393
+ model.codeId = [];
394
+ } else {
395
+ model.codeId = "";
396
+ }
397
+ return v;
398
+ }
399
+ },
400
+ {
401
+ type: "code-select-col",
402
+ name: "codeId",
403
+ span: 16,
404
+ labelWidth: 0,
405
+ display: (mForm, { model }) => model.codeType !== HookCodeType.DATA_SOURCE_METHOD,
406
+ notEditable: () => !services?.codeBlockService.getEditStatus()
407
+ },
408
+ {
409
+ type: "data-source-method-select",
410
+ name: "codeId",
411
+ span: 16,
412
+ labelWidth: 0,
413
+ display: (mForm, { model }) => model.codeType === HookCodeType.DATA_SOURCE_METHOD,
414
+ notEditable: () => !services?.dataSourceService.get("editable")
415
+ }
416
+ ]
372
417
  }
373
418
  ]
374
419
  }));
@@ -3387,8 +3432,10 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
3387
3432
  },
3388
3433
  emits: ["change"],
3389
3434
  setup(__props, { emit: __emit }) {
3435
+ const mForm = inject("mForm");
3390
3436
  const services = inject("services");
3391
3437
  const emit = __emit;
3438
+ const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
3392
3439
  const props = __props;
3393
3440
  const getParamItemsConfig = (codeId) => {
3394
3441
  if (!codeDsl.value || !codeId)
@@ -3415,6 +3462,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
3415
3462
  const selectConfig = {
3416
3463
  type: "select",
3417
3464
  name: props.name,
3465
+ disable: props.disabled,
3418
3466
  options: () => {
3419
3467
  if (codeDsl.value) {
3420
3468
  return map(codeDsl.value, (value, key) => ({
@@ -3454,13 +3502,13 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
3454
3502
  _ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$O, {
3455
3503
  key: 0,
3456
3504
  class: "icon",
3457
- icon: !_ctx.disabled ? unref(Edit) : unref(View),
3505
+ icon: !notEditable.value ? unref(Edit) : unref(View),
3458
3506
  onClick: _cache[0] || (_cache[0] = ($event) => unref(editCode)(_ctx.model[_ctx.name]))
3459
3507
  }, null, 8, ["icon"])) : createCommentVNode("", true)
3460
3508
  ]),
3461
3509
  paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$P, {
3462
- key: 0,
3463
3510
  name: "params",
3511
+ key: _ctx.model[_ctx.name],
3464
3512
  model: _ctx.model,
3465
3513
  size: _ctx.size,
3466
3514
  "params-config": paramsConfig.value,
@@ -3470,7 +3518,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
3470
3518
  key: 1,
3471
3519
  ref_key: "codeBlockEditor",
3472
3520
  ref: codeBlockEditor,
3473
- disabled: _ctx.disabled,
3521
+ disabled: notEditable.value,
3474
3522
  content: unref(codeConfig),
3475
3523
  onSubmit: unref(submitCodeBlockHandler)
3476
3524
  }, null, 8, ["disabled", "content", "onSubmit"])) : createCommentVNode("", true)
@@ -4265,15 +4313,22 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
4265
4313
  },
4266
4314
  emits: ["change"],
4267
4315
  setup(__props, { emit: __emit }) {
4316
+ const mForm = inject("mForm");
4268
4317
  const services = inject("services");
4269
4318
  const emit = __emit;
4270
4319
  const dataSourceService = services?.dataSourceService;
4271
4320
  const props = __props;
4321
+ const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
4272
4322
  const dataSources = computed(() => dataSourceService?.get("dataSources"));
4273
- const getParamItemsConfig = ([dataSourceId, medthodName] = ["", ""]) => {
4323
+ const isCustomMethod = computed(() => {
4324
+ const [id, name] = props.model[props.name];
4325
+ const dataSource = dataSourceService?.getDataSourceById(id);
4326
+ return Boolean(dataSource?.methods.find((method) => method.name === name));
4327
+ });
4328
+ const getParamItemsConfig = ([dataSourceId, methodName] = ["", ""]) => {
4274
4329
  if (!dataSourceId)
4275
4330
  return [];
4276
- const paramStatements = dataSources.value?.find((item) => item.id === dataSourceId)?.methods?.find((item) => item.name === medthodName)?.params;
4331
+ const paramStatements = dataSources.value?.find((item) => item.id === dataSourceId)?.methods?.find((item) => item.name === methodName)?.params;
4277
4332
  if (!paramStatements)
4278
4333
  return [];
4279
4334
  return paramStatements.map((paramState) => ({
@@ -4307,6 +4362,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
4307
4362
  type: "cascader",
4308
4363
  name: props.name,
4309
4364
  options: methodsOptions.value,
4365
+ disable: props.disabled,
4310
4366
  onChange: (formState, dataSourceMethod) => {
4311
4367
  setParamsConfig(dataSourceMethod, formState);
4312
4368
  return dataSourceMethod;
@@ -4338,10 +4394,10 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
4338
4394
  model: _ctx.model,
4339
4395
  onChange: onChangeHandler
4340
4396
  }, null, 8, ["config", "model"]),
4341
- _ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$O, {
4397
+ _ctx.model[_ctx.name] && isCustomMethod.value ? (openBlock(), createBlock(_sfc_main$O, {
4342
4398
  key: 0,
4343
4399
  class: "icon",
4344
- icon: !_ctx.disabled ? unref(Edit) : unref(View),
4400
+ icon: !notEditable.value ? unref(Edit) : unref(View),
4345
4401
  onClick: editCodeHandler
4346
4402
  }, null, 8, ["icon"])) : createCommentVNode("", true)
4347
4403
  ]),
@@ -4358,7 +4414,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
4358
4414
  key: 1,
4359
4415
  ref_key: "codeBlockEditor",
4360
4416
  ref: codeBlockEditor,
4361
- disabled: _ctx.disabled,
4417
+ disabled: notEditable.value,
4362
4418
  content: unref(codeConfig),
4363
4419
  onSubmit: submitCodeBlockHandler
4364
4420
  }, null, 8, ["disabled", "content"])) : createCommentVNode("", true)
@@ -4771,7 +4827,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
4771
4827
  type: "code-select-col",
4772
4828
  text: "代码块",
4773
4829
  name: "codeId",
4774
- disabled: () => !codeBlockService?.getEditStatus(),
4830
+ notEditable: () => !codeBlockService?.getEditStatus(),
4775
4831
  display: (mForm, { model }) => model.actionType === ActionType.CODE
4776
4832
  };
4777
4833
  return { ...defaultCodeActionConfig, ...props.config.codeActionConfig };
@@ -4781,6 +4837,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
4781
4837
  type: "data-source-method-select",
4782
4838
  text: "数据源方法",
4783
4839
  name: "dataSourceMethod",
4840
+ notEditable: () => !services?.dataSourceService.get("editable"),
4784
4841
  display: (mForm, { model }) => model.actionType === ActionType.DATA_SOURCE
4785
4842
  };
4786
4843
  return { ...defaultDataSourceActionConfig, ...props.config.dataSourceActionConfig };
@@ -5676,7 +5733,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
5676
5733
  ])
5677
5734
  ]),
5678
5735
  _: 1
5679
- }, 8, ["disabled"])) : _ctx.data.type === "component" ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.data.component), normalizeProps(mergeProps({ key: 4 }, _ctx.data.props || {})), null, 16)) : createCommentVNode("", true)
5736
+ }, 8, ["disabled"])) : _ctx.data.type === "component" ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.data.component), mergeProps({ key: 4 }, _ctx.data.props || {}, toHandlers(_ctx.data.listeners || {})), null, 16)) : createCommentVNode("", true)
5680
5737
  ], 34)) : createCommentVNode("", true);
5681
5738
  };
5682
5739
  }
@@ -5952,7 +6009,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
5952
6009
  );
5953
6010
  watch(active, (active2) => {
5954
6011
  if (active2 === NodeType.PAGE) {
5955
- if (!activePage.value) {
6012
+ if (!activePage.value && !pageList.value.length) {
5956
6013
  editorService?.selectRoot();
5957
6014
  return;
5958
6015
  }
@@ -5960,11 +6017,11 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
5960
6017
  return;
5961
6018
  }
5962
6019
  if (active2 === NodeType.PAGE_FRAGMENT) {
5963
- if (!activePageFragment.value) {
6020
+ if (!activePageFragment.value && !pageFragmentList.value.length) {
5964
6021
  editorService?.selectRoot();
5965
6022
  return;
5966
6023
  }
5967
- switchPage(activePageFragment.value);
6024
+ switchPage(activePageFragment.value || pageFragmentList.value[0].id);
5968
6025
  }
5969
6026
  });
5970
6027
  const switchPage = (id) => {
@@ -6511,108 +6568,141 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
6511
6568
  }
6512
6569
  });
6513
6570
 
6571
+ const _hoisted_1$a = { class: "m-editor-float-box-body" };
6572
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
6573
+ __name: "FloatingBox",
6574
+ props: {
6575
+ visible: { type: Boolean, default: false },
6576
+ position: { default: () => ({ left: 0, top: 0 }) },
6577
+ rect: { default: () => ({ width: "auto", height: "auto" }) },
6578
+ title: { default: "" }
6579
+ },
6580
+ emits: ["update:visible"],
6581
+ setup(__props, { expose: __expose, emit: __emit }) {
6582
+ const props = __props;
6583
+ const emit = __emit;
6584
+ const target = ref();
6585
+ const dragTarget = ref();
6586
+ const style = computed(() => ({
6587
+ left: `${props.position.left}px`,
6588
+ top: `${props.position.top}px`,
6589
+ width: typeof props.rect.width === "string" ? props.rect.width : `${props.rect.width}px`,
6590
+ height: typeof props.rect.height === "string" ? props.rect.height : `${props.rect.height}px`
6591
+ }));
6592
+ let moveable = null;
6593
+ const initMoveable = () => {
6594
+ moveable = new VanillaMoveable(globalThis.document.body, {
6595
+ className: "m-editor-floating-box-moveable",
6596
+ target: target.value,
6597
+ draggable: true,
6598
+ resizable: true,
6599
+ edge: true,
6600
+ keepRatio: false,
6601
+ origin: false,
6602
+ snappable: true,
6603
+ dragTarget: dragTarget.value,
6604
+ dragTargetSelf: false,
6605
+ linePadding: 10,
6606
+ controlPadding: 10
6607
+ });
6608
+ moveable.on("drag", (e) => {
6609
+ e.target.style.transform = e.transform;
6610
+ });
6611
+ moveable.on("resize", (e) => {
6612
+ e.target.style.width = `${e.width}px`;
6613
+ e.target.style.height = `${e.height}px`;
6614
+ e.target.style.transform = e.drag.transform;
6615
+ });
6616
+ };
6617
+ const destroyMoveable = () => {
6618
+ moveable?.destroy();
6619
+ moveable = null;
6620
+ };
6621
+ watch(
6622
+ () => props.visible,
6623
+ async (visible) => {
6624
+ if (visible) {
6625
+ await nextTick();
6626
+ initMoveable();
6627
+ } else {
6628
+ destroyMoveable();
6629
+ }
6630
+ },
6631
+ {
6632
+ immediate: true
6633
+ }
6634
+ );
6635
+ onBeforeUnmount(() => {
6636
+ destroyMoveable();
6637
+ });
6638
+ const closeHandler = () => {
6639
+ emit("update:visible", false);
6640
+ };
6641
+ __expose({
6642
+ target
6643
+ });
6644
+ return (_ctx, _cache) => {
6645
+ return _ctx.visible ? (openBlock(), createBlock(Teleport, {
6646
+ key: 0,
6647
+ to: "body"
6648
+ }, [
6649
+ createElementVNode("div", {
6650
+ ref_key: "target",
6651
+ ref: target,
6652
+ class: "m-editor-float-box",
6653
+ style: normalizeStyle(style.value)
6654
+ }, [
6655
+ createElementVNode("div", {
6656
+ ref_key: "dragTarget",
6657
+ ref: dragTarget,
6658
+ class: "m-editor-float-box-title"
6659
+ }, [
6660
+ renderSlot(_ctx.$slots, "title", {}, () => [
6661
+ createElementVNode("span", null, toDisplayString(_ctx.title), 1)
6662
+ ]),
6663
+ createElementVNode("div", null, [
6664
+ createVNode(unref(TMagicButton), {
6665
+ link: "",
6666
+ size: "small",
6667
+ icon: unref(Close),
6668
+ onClick: closeHandler
6669
+ }, null, 8, ["icon"])
6670
+ ])
6671
+ ], 512),
6672
+ createElementVNode("div", _hoisted_1$a, [
6673
+ renderSlot(_ctx.$slots, "body")
6674
+ ])
6675
+ ], 4)
6676
+ ])) : createCommentVNode("", true);
6677
+ };
6678
+ }
6679
+ });
6680
+
6514
6681
  const useFloatBox = (slideKeys) => {
6515
- const services = inject("services");
6516
- const moveable = ref();
6517
- const floatBox = ref();
6518
- const floatBoxStates = computed(() => services?.uiService.get("floatBox"));
6519
- const curKey = ref("");
6520
- const target = computed(
6521
- () => floatBox.value ? floatBox.value.find((item) => item.classList.contains(`m-editor-float-box-${curKey.value}`)) : void 0
6682
+ const floatBoxStates = ref(
6683
+ slideKeys.value.reduce(
6684
+ (total, cur) => ({
6685
+ ...total,
6686
+ [cur]: {
6687
+ status: false,
6688
+ top: 0,
6689
+ left: 0
6690
+ }
6691
+ }),
6692
+ {}
6693
+ )
6522
6694
  );
6523
6695
  const showingBoxKeys = computed(
6524
- () => [...floatBoxStates.value?.keys() ?? []].filter((key) => floatBoxStates.value?.get(key)?.status)
6696
+ () => Object.keys(floatBoxStates.value).filter((key) => floatBoxStates.value[key].status)
6525
6697
  );
6526
6698
  const isDraging = ref(false);
6527
- const showFloatBox = async (key) => {
6528
- const curBoxStatus = floatBoxStates.value?.get(curKey.value)?.status;
6529
- if (curKey.value === key && curBoxStatus)
6530
- return;
6531
- curKey.value = key;
6532
- setSlideState(key, {
6533
- zIndex: getMaxZIndex() + 1,
6534
- status: true
6535
- });
6536
- await nextTick();
6537
- if (moveable.value) {
6538
- moveable.value.target = target.value;
6539
- moveable.value.dragTarget = getDragTarget();
6540
- moveable.value.updateRect();
6541
- } else {
6542
- initFloatBoxMoveable();
6543
- }
6544
- };
6545
- const setSlideState = (key, data) => {
6546
- const slideState = floatBoxStates.value?.get(key);
6547
- if (!slideState)
6548
- return;
6549
- floatBoxStates.value?.set(key, {
6550
- ...slideState,
6551
- ...data
6552
- });
6553
- };
6554
- const getDragTarget = (key) => `.m-editor-float-box-header-${key ?? curKey.value}`;
6555
- const closeFloatBox = (key) => {
6556
- setSlideState(key, {
6557
- status: false
6558
- });
6559
- if (!floatBoxStates.value?.values)
6560
- return;
6561
- const keys = [...floatBoxStates.value?.keys()];
6562
- const values = [...floatBoxStates.value?.values()];
6563
- const lastFloatBoxLen = values.filter((state) => state.status).length;
6564
- if (lastFloatBoxLen === 0) {
6565
- moveable.value?.destroy();
6566
- moveable.value = void 0;
6567
- return;
6568
- }
6569
- if (key === curKey.value) {
6570
- const zIndexList = values.filter((item) => item.status).map((item) => item.zIndex);
6571
- const maxZIndex = Math.max(...zIndexList);
6572
- const key2 = keys.find((key3) => floatBoxStates.value?.get(key3)?.zIndex === maxZIndex);
6573
- if (!key2)
6574
- return;
6575
- showFloatBox(key2);
6576
- }
6577
- };
6578
- const getMaxZIndex = () => {
6579
- if (!floatBoxStates.value?.values())
6580
- return 0;
6581
- const list = [...floatBoxStates.value?.values()].map((state) => state.zIndex);
6582
- return Math.max(...list) ?? 0;
6583
- };
6584
- const initFloatBoxMoveable = () => {
6585
- const dragTarget = getDragTarget();
6586
- moveable.value = new Moveable(document.body, {
6587
- target: target.value,
6588
- draggable: true,
6589
- resizable: true,
6590
- edge: true,
6591
- keepRatio: false,
6592
- origin: false,
6593
- snappable: true,
6594
- dragTarget,
6595
- dragTargetSelf: false,
6596
- linePadding: 10,
6597
- controlPadding: 10,
6598
- elementGuidelines: [...floatBoxStates.value?.keys() ?? []].map((key) => getDragTarget(key)),
6599
- bounds: { left: 0, top: 0, right: 0, bottom: 0, position: "css" }
6600
- });
6601
- moveable.value.on("drag", (e) => {
6602
- e.target.style.transform = e.transform;
6603
- });
6604
- moveable.value.on("resize", (e) => {
6605
- e.target.style.width = `${e.width}px`;
6606
- e.target.style.height = `${e.height}px`;
6607
- e.target.style.transform = e.drag.transform;
6608
- });
6609
- };
6699
+ const dragstartHandler = () => isDraging.value = true;
6610
6700
  const dragendHandler = (key, e) => {
6611
- setSlideState(key, {
6701
+ floatBoxStates.value[key] = {
6612
6702
  left: e.clientX,
6613
- top: e.clientY
6614
- });
6615
- showFloatBox(key);
6703
+ top: e.clientY,
6704
+ status: true
6705
+ };
6616
6706
  isDraging.value = false;
6617
6707
  };
6618
6708
  document.body.addEventListener("dragover", (e) => {
@@ -6620,11 +6710,18 @@ const useFloatBox = (slideKeys) => {
6620
6710
  return;
6621
6711
  e.preventDefault();
6622
6712
  });
6623
- const dragstartHandler = () => isDraging.value = true;
6624
6713
  watch(
6625
6714
  () => slideKeys.value,
6626
6715
  () => {
6627
- services?.uiService.setFloatBox(slideKeys.value);
6716
+ for (const key in slideKeys.value) {
6717
+ if (floatBoxStates.value[key])
6718
+ continue;
6719
+ floatBoxStates.value[key] = {
6720
+ status: false,
6721
+ top: 0,
6722
+ left: 0
6723
+ };
6724
+ }
6628
6725
  },
6629
6726
  {
6630
6727
  deep: true,
@@ -6632,17 +6729,14 @@ const useFloatBox = (slideKeys) => {
6632
6729
  }
6633
6730
  );
6634
6731
  return {
6635
- showFloatBox,
6636
- closeFloatBox,
6637
6732
  dragstartHandler,
6638
6733
  dragendHandler,
6639
6734
  floatBoxStates,
6640
- floatBox,
6641
6735
  showingBoxKeys
6642
6736
  };
6643
6737
  };
6644
6738
 
6645
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
6739
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
6646
6740
  ...{
6647
6741
  name: "MEditorSearchInput"
6648
6742
  },
@@ -6693,14 +6787,14 @@ const updateStatus = (nodeStatusMap, id, status) => {
6693
6787
  });
6694
6788
  };
6695
6789
 
6696
- const _hoisted_1$a = ["draggable", "data-node-id", "data-is-container"];
6790
+ const _hoisted_1$9 = ["draggable", "data-node-id", "data-is-container"];
6697
6791
  const _hoisted_2$6 = { class: "tree-node-label" };
6698
6792
  const _hoisted_3$3 = { class: "tree-node-tool" };
6699
6793
  const _hoisted_4$3 = {
6700
6794
  key: 0,
6701
6795
  class: "m-editor-tree-node-children"
6702
6796
  };
6703
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
6797
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6704
6798
  ...{
6705
6799
  name: "MEditorTreeNode"
6706
6800
  },
@@ -6810,18 +6904,18 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
6810
6904
  }, 1032, ["data", "node-status-map", "indent"]);
6811
6905
  }), 128))
6812
6906
  ])) : createCommentVNode("", true)
6813
- ], 40, _hoisted_1$a)), [
6907
+ ], 40, _hoisted_1$9)), [
6814
6908
  [vShow, visible.value]
6815
6909
  ]);
6816
6910
  };
6817
6911
  }
6818
6912
  });
6819
6913
 
6820
- const _hoisted_1$9 = {
6914
+ const _hoisted_1$8 = {
6821
6915
  key: 1,
6822
6916
  class: "m-editor-tree-empty"
6823
6917
  };
6824
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
6918
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6825
6919
  ...{
6826
6920
  name: "MEditorTree"
6827
6921
  },
@@ -6845,7 +6939,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6845
6939
  onDragover: handleDragOver
6846
6940
  }, [
6847
6941
  _ctx.data?.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.data, (item) => {
6848
- return openBlock(), createBlock(_sfc_main$o, {
6942
+ return openBlock(), createBlock(_sfc_main$n, {
6849
6943
  key: item.id,
6850
6944
  data: item,
6851
6945
  indent: _ctx.indent,
@@ -6862,7 +6956,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6862
6956
  ]),
6863
6957
  _: 2
6864
6958
  }, 1032, ["data", "indent", "node-status-map"]);
6865
- }), 128)) : (openBlock(), createElementBlock("div", _hoisted_1$9, [
6959
+ }), 128)) : (openBlock(), createElementBlock("div", _hoisted_1$8, [
6866
6960
  createElementVNode("p", null, toDisplayString(_ctx.emptyText), 1)
6867
6961
  ]))
6868
6962
  ], 32);
@@ -6942,7 +7036,7 @@ const useNodeStatus$1 = (nodeData) => {
6942
7036
  };
6943
7037
  };
6944
7038
 
6945
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
7039
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
6946
7040
  ...{
6947
7041
  name: "MEditorCodeBlockList"
6948
7042
  },
@@ -7024,7 +7118,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
7024
7118
  filter: filterTextChangeHandler
7025
7119
  });
7026
7120
  return (_ctx, _cache) => {
7027
- return openBlock(), createBlock(_sfc_main$n, {
7121
+ return openBlock(), createBlock(_sfc_main$m, {
7028
7122
  data: codeList.value,
7029
7123
  "node-status-map": unref(nodeStatusMap),
7030
7124
  onNodeClick: clickHandler
@@ -7080,8 +7174,8 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
7080
7174
  }
7081
7175
  });
7082
7176
 
7083
- const _hoisted_1$8 = { class: "search-wrapper" };
7084
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
7177
+ const _hoisted_1$7 = { class: "search-wrapper" };
7178
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
7085
7179
  ...{
7086
7180
  name: "MEditorCodeBlockListPanel"
7087
7181
  },
@@ -7103,8 +7197,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
7103
7197
  createVNode(unref(TMagicScrollbar), { class: "m-editor-code-block-list m-editor-layer-panel" }, {
7104
7198
  default: withCtx(() => [
7105
7199
  renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
7106
- createElementVNode("div", _hoisted_1$8, [
7107
- createVNode(_sfc_main$p, { onSearch: filterTextChangeHandler }),
7200
+ createElementVNode("div", _hoisted_1$7, [
7201
+ createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
7108
7202
  editable.value ? (openBlock(), createBlock(unref(TMagicButton), {
7109
7203
  key: 0,
7110
7204
  class: "create-code-button",
@@ -7120,7 +7214,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
7120
7214
  renderSlot(_ctx.$slots, "code-block-panel-search")
7121
7215
  ])
7122
7216
  ]),
7123
- createVNode(_sfc_main$m, {
7217
+ createVNode(_sfc_main$l, {
7124
7218
  ref_key: "codeBlockList",
7125
7219
  ref: codeBlockList,
7126
7220
  "custom-error": _ctx.customError,
@@ -7152,7 +7246,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
7152
7246
  }
7153
7247
  });
7154
7248
 
7155
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
7249
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
7156
7250
  ...{
7157
7251
  name: "MEditorDataSourceConfigPanel"
7158
7252
  },
@@ -7208,7 +7302,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
7208
7302
  }
7209
7303
  });
7210
7304
 
7211
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
7305
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7212
7306
  ...{
7213
7307
  name: "MEditorDataSourceList"
7214
7308
  },
@@ -7297,7 +7391,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
7297
7391
  filter: filterTextChangeHandler
7298
7392
  });
7299
7393
  return (_ctx, _cache) => {
7300
- return openBlock(), createBlock(_sfc_main$n, {
7394
+ return openBlock(), createBlock(_sfc_main$m, {
7301
7395
  data: list.value,
7302
7396
  "node-status-map": unref(nodeStatusMap),
7303
7397
  onNodeClick: clickHandler
@@ -7350,9 +7444,9 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
7350
7444
  }
7351
7445
  });
7352
7446
 
7353
- const _hoisted_1$7 = { class: "search-wrapper" };
7447
+ const _hoisted_1$6 = { class: "search-wrapper" };
7354
7448
  const _hoisted_2$5 = { class: "data-source-list-panel-add-menu" };
7355
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
7449
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
7356
7450
  ...{
7357
7451
  name: "MEditorDataSourceListPanel"
7358
7452
  },
@@ -7416,8 +7510,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7416
7510
  return openBlock(), createElementBlock(Fragment, null, [
7417
7511
  createVNode(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-layer-panel" }, {
7418
7512
  default: withCtx(() => [
7419
- createElementVNode("div", _hoisted_1$7, [
7420
- createVNode(_sfc_main$p, { onSearch: filterTextChangeHandler }),
7513
+ createElementVNode("div", _hoisted_1$6, [
7514
+ createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
7421
7515
  editable.value ? (openBlock(), createBlock(unref(TMagicPopover), {
7422
7516
  key: 0,
7423
7517
  placement: "right"
@@ -7452,14 +7546,14 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7452
7546
  _: 1
7453
7547
  })) : createCommentVNode("", true)
7454
7548
  ]),
7455
- createVNode(_sfc_main$j, {
7549
+ createVNode(_sfc_main$i, {
7456
7550
  onEdit: editHandler,
7457
7551
  onRemove: removeHandler
7458
7552
  })
7459
7553
  ]),
7460
7554
  _: 1
7461
7555
  }),
7462
- createVNode(_sfc_main$k, {
7556
+ createVNode(_sfc_main$j, {
7463
7557
  ref_key: "editDialog",
7464
7558
  ref: editDialog,
7465
7559
  disabled: !editable.value,
@@ -7473,7 +7567,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7473
7567
  }
7474
7568
  });
7475
7569
 
7476
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
7570
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
7477
7571
  ...{
7478
7572
  name: "MEditorContentMenu"
7479
7573
  },
@@ -7639,7 +7733,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
7639
7733
  }
7640
7734
  });
7641
7735
 
7642
- const _hoisted_1$6 = {
7736
+ const _hoisted_1$5 = {
7643
7737
  width: "1em",
7644
7738
  height: "1em",
7645
7739
  viewBox: "0 0 16 16",
@@ -7659,14 +7753,14 @@ const _hoisted_4$2 = [
7659
7753
  _hoisted_2$4,
7660
7754
  _hoisted_3$2
7661
7755
  ];
7662
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
7756
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7663
7757
  ...{
7664
7758
  name: "MEditorFolderMinusIcon"
7665
7759
  },
7666
7760
  __name: "FolderMinusIcon",
7667
7761
  setup(__props) {
7668
7762
  return (_ctx, _cache) => {
7669
- return openBlock(), createElementBlock("svg", _hoisted_1$6, _hoisted_4$2);
7763
+ return openBlock(), createElementBlock("svg", _hoisted_1$5, _hoisted_4$2);
7670
7764
  };
7671
7765
  }
7672
7766
  });
@@ -7744,7 +7838,7 @@ const useMoveToMenu = (services) => {
7744
7838
  };
7745
7839
  };
7746
7840
 
7747
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
7841
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
7748
7842
  ...{
7749
7843
  name: "MEditorLayerMenu"
7750
7844
  },
@@ -7811,7 +7905,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7811
7905
  {
7812
7906
  type: "button",
7813
7907
  text: "全部折叠",
7814
- icon: _sfc_main$g,
7908
+ icon: _sfc_main$f,
7815
7909
  display: () => isPage(node.value) || isPageFragment(node.value),
7816
7910
  handler: () => {
7817
7911
  emit("collapse-all");
@@ -7840,7 +7934,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7840
7934
  show
7841
7935
  });
7842
7936
  return (_ctx, _cache) => {
7843
- return openBlock(), createBlock(_sfc_main$h, {
7937
+ return openBlock(), createBlock(_sfc_main$g, {
7844
7938
  "menu-data": menuData.value,
7845
7939
  ref_key: "menu",
7846
7940
  ref: menu,
@@ -7850,7 +7944,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7850
7944
  }
7851
7945
  });
7852
7946
 
7853
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
7947
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
7854
7948
  __name: "LayerNodeTool",
7855
7949
  props: {
7856
7950
  data: {}
@@ -7947,7 +8041,7 @@ const useClick = (services, isCtrlKeyDown, nodeStatusMap) => {
7947
8041
  return {
7948
8042
  menu,
7949
8043
  nodeClickHandler,
7950
- nodeContentmenuHandler(event, data) {
8044
+ nodeContentMenuHandler(event, data) {
7951
8045
  event.preventDefault();
7952
8046
  const nodes = services?.editorService.get("nodes") || [];
7953
8047
  if (nodes.length < 2 || !nodes.includes(data)) {
@@ -8273,12 +8367,12 @@ const useNodeStatus = (services) => {
8273
8367
  () => page.value ? nodeStatusMaps.value.get(page.value.id) : /* @__PURE__ */ new Map()
8274
8368
  );
8275
8369
  watch(
8276
- page,
8277
- (page2) => {
8278
- if (!page2) {
8370
+ () => page.value?.id,
8371
+ (pageId) => {
8372
+ if (!pageId) {
8279
8373
  return;
8280
8374
  }
8281
- nodeStatusMaps.value.set(page2.id, createPageNodeStatus(page2, nodeStatusMaps.value.get(page2.id)));
8375
+ nodeStatusMaps.value.set(pageId, createPageNodeStatus(page.value, nodeStatusMaps.value.get(pageId)));
8282
8376
  },
8283
8377
  {
8284
8378
  immediate: true
@@ -8306,6 +8400,8 @@ const useNodeStatus = (services) => {
8306
8400
  );
8307
8401
  services?.editorService.on("add", (newNodes) => {
8308
8402
  newNodes.forEach((node) => {
8403
+ if (isPage(node) || isPageFragment(node))
8404
+ return;
8309
8405
  traverseNode(node, (node2) => {
8310
8406
  nodeStatusMap.value?.set(node2.id, {
8311
8407
  visible: true,
@@ -8329,7 +8425,7 @@ const useNodeStatus = (services) => {
8329
8425
  };
8330
8426
  };
8331
8427
 
8332
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
8428
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
8333
8429
  ...{
8334
8430
  name: "MEditorLayerPanel"
8335
8431
  },
@@ -8371,15 +8467,15 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
8371
8467
  const {
8372
8468
  menu,
8373
8469
  nodeClickHandler,
8374
- nodeContentmenuHandler,
8470
+ nodeContentMenuHandler,
8375
8471
  highlightHandler: mouseenterHandler
8376
8472
  } = useClick(services, isCtrlKeyDown, nodeStatusMap);
8377
8473
  return (_ctx, _cache) => {
8378
8474
  return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-layer-panel" }, {
8379
8475
  default: withCtx(() => [
8380
8476
  renderSlot(_ctx.$slots, "layer-panel-header"),
8381
- createVNode(_sfc_main$p, { onSearch: unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
8382
- page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$n, {
8477
+ createVNode(_sfc_main$o, { onSearch: unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
8478
+ page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$m, {
8383
8479
  key: 0,
8384
8480
  tabindex: "-1",
8385
8481
  ref_key: "tree",
@@ -8390,7 +8486,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
8390
8486
  onNodeDragstart: unref(handleDragStart),
8391
8487
  onNodeDragleave: unref(handleDragLeave),
8392
8488
  onNodeDragend: unref(handleDragEnd),
8393
- onNodeContextmenu: unref(nodeContentmenuHandler),
8489
+ onNodeContextmenu: unref(nodeContentMenuHandler),
8394
8490
  onNodeMouseenter: unref(mouseenterHandler),
8395
8491
  onNodeClick: unref(nodeClickHandler)
8396
8492
  }, {
@@ -8399,7 +8495,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
8399
8495
  ]),
8400
8496
  "tree-node-tool": withCtx(({ data: nodeData2 }) => [
8401
8497
  renderSlot(_ctx.$slots, "layer-node-tool", { data: nodeData2 }, () => [
8402
- createVNode(_sfc_main$e, { data: nodeData2 }, null, 8, ["data"])
8498
+ createVNode(_sfc_main$d, { data: nodeData2 }, null, 8, ["data"])
8403
8499
  ])
8404
8500
  ]),
8405
8501
  "tree-node-label": withCtx(({ data: nodeData2 }) => [
@@ -8408,7 +8504,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
8408
8504
  _: 3
8409
8505
  }, 8, ["data", "node-status-map", "onNodeDragover", "onNodeDragstart", "onNodeDragleave", "onNodeDragend", "onNodeContextmenu", "onNodeMouseenter", "onNodeClick"])) : createCommentVNode("", true),
8410
8506
  (openBlock(), createBlock(Teleport, { to: "body" }, [
8411
- createVNode(_sfc_main$f, {
8507
+ createVNode(_sfc_main$e, {
8412
8508
  ref_key: "menu",
8413
8509
  ref: menu,
8414
8510
  "layer-content-menu": _ctx.layerContentMenu,
@@ -8423,9 +8519,9 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
8423
8519
  }
8424
8520
  });
8425
8521
 
8426
- const _hoisted_1$5 = ["onClick", "onDragstart"];
8522
+ const _hoisted_1$4 = ["onClick", "onDragstart"];
8427
8523
  const _hoisted_2$3 = ["title"];
8428
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
8524
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8429
8525
  ...{
8430
8526
  name: "MEditorComponentListPanel"
8431
8527
  },
@@ -8505,7 +8601,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
8505
8601
  "model-value": collapseValue.value
8506
8602
  }, {
8507
8603
  default: withCtx(() => [
8508
- createVNode(_sfc_main$p, { onSearch: filterTextChangeHandler }),
8604
+ createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
8509
8605
  (openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (group, index) => {
8510
8606
  return openBlock(), createElementBlock(Fragment, null, [
8511
8607
  group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
@@ -8544,7 +8640,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
8544
8640
  title: item.text
8545
8641
  }, toDisplayString(item.text), 9, _hoisted_2$3)
8546
8642
  ])
8547
- ], 40, _hoisted_1$5);
8643
+ ], 40, _hoisted_1$4);
8548
8644
  }), 128))
8549
8645
  ]),
8550
8646
  _: 2
@@ -8561,7 +8657,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
8561
8657
  }
8562
8658
  });
8563
8659
 
8564
- const _hoisted_1$4 = {
8660
+ const _hoisted_1$3 = {
8565
8661
  key: 0,
8566
8662
  class: "m-editor-sidebar"
8567
8663
  };
@@ -8571,10 +8667,8 @@ const _hoisted_4$1 = {
8571
8667
  key: 1,
8572
8668
  class: "magic-editor-tab-panel-title"
8573
8669
  };
8574
- const _hoisted_5$1 = { class: "m-editor-float-box-list" };
8575
- const _hoisted_6 = ["onClick"];
8576
- const _hoisted_7 = { class: "m-editor-float-box-body" };
8577
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
8670
+ const _hoisted_5$1 = { class: "m-editor-slide-list-box" };
8671
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
8578
8672
  ...{
8579
8673
  name: "MEditorSidebar"
8580
8674
  },
@@ -8595,7 +8689,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8595
8689
  type: "component",
8596
8690
  icon: Goods,
8597
8691
  text: "组件",
8598
- component: _sfc_main$c,
8692
+ component: _sfc_main$b,
8599
8693
  slots: {}
8600
8694
  },
8601
8695
  layer: {
@@ -8607,7 +8701,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8607
8701
  layerContentMenu: props.layerContentMenu,
8608
8702
  customContentMenu: props.customContentMenu
8609
8703
  },
8610
- component: _sfc_main$d,
8704
+ component: _sfc_main$c,
8611
8705
  slots: {}
8612
8706
  },
8613
8707
  "code-block": {
@@ -8615,26 +8709,16 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8615
8709
  type: "component",
8616
8710
  icon: EditPen,
8617
8711
  text: "代码编辑",
8618
- component: _sfc_main$l,
8619
- slots: {},
8620
- boxComponentConfig: {
8621
- props: {
8622
- slideType: "box"
8623
- }
8624
- }
8712
+ component: _sfc_main$k,
8713
+ slots: {}
8625
8714
  },
8626
8715
  "data-source": {
8627
8716
  $key: "data-source",
8628
8717
  type: "component",
8629
8718
  icon: Coin,
8630
8719
  text: "数据源",
8631
- component: _sfc_main$i,
8632
- slots: {},
8633
- boxComponentConfig: {
8634
- props: {
8635
- slideType: "box"
8636
- }
8637
- }
8720
+ component: _sfc_main$h,
8721
+ slots: {}
8638
8722
  }
8639
8723
  };
8640
8724
  return typeof data === "string" ? map[data] : data;
@@ -8647,7 +8731,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8647
8731
  }
8648
8732
  );
8649
8733
  const slideKeys = computed(() => sideBarItems.value.map((sideBarItem) => sideBarItem.$key));
8650
- const { showFloatBox, closeFloatBox, dragstartHandler, dragendHandler, floatBoxStates, floatBox, showingBoxKeys } = useFloatBox(slideKeys);
8734
+ const { dragstartHandler, dragendHandler, floatBoxStates, showingBoxKeys } = useFloatBox(slideKeys);
8651
8735
  watch(
8652
8736
  () => showingBoxKeys.value.length,
8653
8737
  () => {
@@ -8671,7 +8755,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8671
8755
  });
8672
8756
  return (_ctx, _cache) => {
8673
8757
  return openBlock(), createElementBlock(Fragment, null, [
8674
- _ctx.data.type === "tabs" && _ctx.data.items.length ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
8758
+ _ctx.data.type === "tabs" && _ctx.data.items.length ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
8675
8759
  createElementVNode("div", _hoisted_2$2, [
8676
8760
  (openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
8677
8761
  return withDirectives((openBlock(), createElementBlock("div", {
@@ -8689,7 +8773,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8689
8773
  }, null, 8, ["icon"])) : createCommentVNode("", true),
8690
8774
  config.text ? (openBlock(), createElementBlock("div", _hoisted_4$1, toDisplayString(config.text), 1)) : createCommentVNode("", true)
8691
8775
  ], 42, _hoisted_3$1)), [
8692
- [vShow, !unref(floatBoxStates)?.get(config.$key)?.status]
8776
+ [vShow, !unref(floatBoxStates)[config.$key]?.status]
8693
8777
  ]);
8694
8778
  }), 128))
8695
8779
  ]),
@@ -8698,7 +8782,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8698
8782
  class: "m-editor-sidebar-content",
8699
8783
  key: config.$key ?? index
8700
8784
  }, [
8701
- config && !unref(floatBoxStates)?.get(config.$key)?.status ? (openBlock(), createBlock(resolveDynamicComponent(config.component), mergeProps({ key: 0 }, config.props || {}, toHandlers(config?.listeners || {})), createSlots({ _: 2 }, [
8785
+ config && !unref(floatBoxStates)[config.$key]?.status ? (openBlock(), createBlock(resolveDynamicComponent(config.component), mergeProps({ key: 0 }, config.props || {}, toHandlers(config?.listeners || {})), createSlots({ _: 2 }, [
8702
8786
  config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
8703
8787
  name: "component-list-panel-header",
8704
8788
  fn: withCtx(() => [
@@ -8800,39 +8884,27 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8800
8884
  }), 128))
8801
8885
  ])) : createCommentVNode("", true),
8802
8886
  (openBlock(), createBlock(Teleport, { to: "body" }, [
8803
- createElementVNode("div", _hoisted_5$1, [
8804
- (openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
8805
- return withDirectives((openBlock(), createElementBlock("div", {
8887
+ (openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
8888
+ return openBlock(), createElementBlock(Fragment, null, [
8889
+ unref(floatBoxStates)[config.$key]?.status ? (openBlock(), createBlock(_sfc_main$p, {
8806
8890
  key: config.$key ?? index,
8807
- ref_for: true,
8808
- ref_key: "floatBox",
8809
- ref: floatBox,
8810
- class: normalizeClass(["m-editor-float-box", `m-editor-float-box-${config.$key}`]),
8811
- style: normalizeStyle({
8812
- left: `${unref(floatBoxStates)?.get(config.$key)?.left}px`,
8813
- top: `${unref(floatBoxStates)?.get(config.$key)?.top}px`,
8814
- zIndex: unref(floatBoxStates)?.get(config.$key)?.zIndex
8815
- })
8816
- }, [
8817
- createElementVNode("div", {
8818
- class: normalizeClass(["m-editor-float-box-header", `m-editor-float-box-header-${config.$key}`]),
8819
- onClick: ($event) => unref(showFloatBox)(config.$key)
8820
- }, [
8821
- createElementVNode("div", null, toDisplayString(config.text), 1),
8822
- createVNode(_sfc_main$O, {
8823
- class: "m-editor-float-box-close",
8824
- icon: unref(Close),
8825
- onClick: withModifiers(($event) => unref(closeFloatBox)(config.$key), ["stop"])
8826
- }, null, 8, ["icon", "onClick"])
8827
- ], 10, _hoisted_6),
8828
- createElementVNode("div", _hoisted_7, [
8829
- config && unref(floatBoxStates)?.get(config.$key)?.status ? (openBlock(), createBlock(resolveDynamicComponent(config.boxComponentConfig?.component || config.component), mergeProps({ key: 0 }, config.boxComponentConfig?.props || config.props || {}, toHandlers(config?.listeners || {})), null, 16)) : createCommentVNode("", true)
8830
- ])
8831
- ], 6)), [
8832
- [vShow, unref(floatBoxStates)?.get(config.$key)?.status]
8833
- ]);
8834
- }), 128))
8835
- ])
8891
+ visible: unref(floatBoxStates)[config.$key].status,
8892
+ "onUpdate:visible": ($event) => unref(floatBoxStates)[config.$key].status = $event,
8893
+ title: config.text,
8894
+ position: {
8895
+ left: unref(floatBoxStates)[config.$key].left,
8896
+ top: unref(floatBoxStates)[config.$key].top
8897
+ }
8898
+ }, {
8899
+ body: withCtx(() => [
8900
+ createElementVNode("div", _hoisted_5$1, [
8901
+ config && unref(floatBoxStates)[config.$key].status ? (openBlock(), createBlock(resolveDynamicComponent(config.boxComponentConfig?.component || config.component), mergeProps({ key: 0 }, config.boxComponentConfig?.props || config.props || {}, toHandlers(config?.listeners || {})), null, 16)) : createCommentVNode("", true)
8902
+ ])
8903
+ ]),
8904
+ _: 2
8905
+ }, 1032, ["visible", "onUpdate:visible", "title", "position"])) : createCommentVNode("", true)
8906
+ ], 64);
8907
+ }), 256))
8836
8908
  ]))
8837
8909
  ], 64);
8838
8910
  };
@@ -8967,7 +9039,7 @@ class ScrollViewer extends EventEmitter {
8967
9039
  };
8968
9040
  }
8969
9041
 
8970
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
9042
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
8971
9043
  ...{
8972
9044
  name: "MEditorScrollBar"
8973
9045
  },
@@ -9055,7 +9127,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
9055
9127
  }
9056
9128
  });
9057
9129
 
9058
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
9130
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
9059
9131
  ...{
9060
9132
  name: "MEditorScrollViewer"
9061
9133
  },
@@ -9142,14 +9214,14 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
9142
9214
  renderSlot(_ctx.$slots, "default")
9143
9215
  ], 4),
9144
9216
  renderSlot(_ctx.$slots, "content"),
9145
- scrollHeight.value > _ctx.wrapHeight ? (openBlock(), createBlock(_sfc_main$a, {
9217
+ scrollHeight.value > _ctx.wrapHeight ? (openBlock(), createBlock(_sfc_main$9, {
9146
9218
  key: 0,
9147
9219
  "scroll-size": scrollHeight.value,
9148
9220
  pos: vOffset.value,
9149
9221
  size: _ctx.wrapHeight,
9150
9222
  onScroll: vScrollHandler
9151
9223
  }, null, 8, ["scroll-size", "pos", "size"])) : createCommentVNode("", true),
9152
- scrollWidth.value > _ctx.wrapWidth ? (openBlock(), createBlock(_sfc_main$a, {
9224
+ scrollWidth.value > _ctx.wrapWidth ? (openBlock(), createBlock(_sfc_main$9, {
9153
9225
  key: 1,
9154
9226
  "is-horizontal": true,
9155
9227
  "scroll-size": scrollWidth.value,
@@ -9365,116 +9437,6 @@ const useStage = (stageOptions) => {
9365
9437
  return stage;
9366
9438
  };
9367
9439
 
9368
- const _hoisted_1$3 = { class: "m-editor-float-box-body" };
9369
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
9370
- __name: "FloatingBox",
9371
- props: {
9372
- visible: { type: Boolean, default: false },
9373
- position: { default: () => ({ left: 0, top: 0 }) },
9374
- rect: { default: () => ({ width: "auto", height: "auto" }) },
9375
- title: { default: "" }
9376
- },
9377
- emits: ["update:visible"],
9378
- setup(__props, { expose: __expose, emit: __emit }) {
9379
- const props = __props;
9380
- const emit = __emit;
9381
- const target = ref();
9382
- const dragTarget = ref();
9383
- const style = computed(() => ({
9384
- left: `${props.position.left}px`,
9385
- top: `${props.position.top}px`,
9386
- width: typeof props.rect.width === "string" ? props.rect.width : `${props.rect.width}px`,
9387
- height: typeof props.rect.height === "string" ? props.rect.height : `${props.rect.height}px`
9388
- }));
9389
- let moveable = null;
9390
- const initMoveable = () => {
9391
- moveable = new Moveable(globalThis.document.body, {
9392
- className: "m-editor-floating-box-moveable",
9393
- target: target.value,
9394
- draggable: true,
9395
- resizable: true,
9396
- edge: true,
9397
- keepRatio: false,
9398
- origin: false,
9399
- snappable: true,
9400
- dragTarget: dragTarget.value,
9401
- dragTargetSelf: false,
9402
- linePadding: 10,
9403
- controlPadding: 10
9404
- });
9405
- moveable.on("drag", (e) => {
9406
- e.target.style.transform = e.transform;
9407
- });
9408
- moveable.on("resize", (e) => {
9409
- e.target.style.width = `${e.width}px`;
9410
- e.target.style.height = `${e.height}px`;
9411
- e.target.style.transform = e.drag.transform;
9412
- });
9413
- };
9414
- const destroyMoveable = () => {
9415
- moveable?.destroy();
9416
- moveable = null;
9417
- };
9418
- watch(
9419
- () => props.visible,
9420
- async (visible) => {
9421
- if (visible) {
9422
- await nextTick();
9423
- initMoveable();
9424
- } else {
9425
- destroyMoveable();
9426
- }
9427
- },
9428
- {
9429
- immediate: true
9430
- }
9431
- );
9432
- onBeforeUnmount(() => {
9433
- destroyMoveable();
9434
- });
9435
- const closeHandler = () => {
9436
- emit("update:visible", false);
9437
- };
9438
- __expose({
9439
- target
9440
- });
9441
- return (_ctx, _cache) => {
9442
- return _ctx.visible ? (openBlock(), createBlock(Teleport, {
9443
- key: 0,
9444
- to: "body"
9445
- }, [
9446
- createElementVNode("div", {
9447
- ref_key: "target",
9448
- ref: target,
9449
- class: "m-editor-float-box",
9450
- style: normalizeStyle(style.value)
9451
- }, [
9452
- createElementVNode("div", {
9453
- ref_key: "dragTarget",
9454
- ref: dragTarget,
9455
- class: "m-editor-float-box-title"
9456
- }, [
9457
- renderSlot(_ctx.$slots, "title", {}, () => [
9458
- createElementVNode("span", null, toDisplayString(_ctx.title), 1)
9459
- ]),
9460
- createElementVNode("div", null, [
9461
- createVNode(unref(TMagicButton), {
9462
- link: "",
9463
- size: "small",
9464
- icon: unref(Close),
9465
- onClick: closeHandler
9466
- }, null, 8, ["icon"])
9467
- ])
9468
- ], 512),
9469
- createElementVNode("div", _hoisted_1$3, [
9470
- renderSlot(_ctx.$slots, "body")
9471
- ])
9472
- ], 4)
9473
- ])) : createCommentVNode("", true);
9474
- };
9475
- }
9476
- });
9477
-
9478
9440
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
9479
9441
  __name: "NodeListMenu",
9480
9442
  setup(__props) {
@@ -9557,7 +9519,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
9557
9519
  ]),
9558
9520
  _: 1
9559
9521
  })) : createCommentVNode("", true),
9560
- page.value && unref(nodeStatusMap) && buttonVisible.value ? (openBlock(), createBlock(_sfc_main$8, {
9522
+ page.value && unref(nodeStatusMap) && buttonVisible.value ? (openBlock(), createBlock(_sfc_main$p, {
9561
9523
  key: 1,
9562
9524
  ref_key: "box",
9563
9525
  ref: box,
@@ -9567,7 +9529,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
9567
9529
  position: menuPosition.value
9568
9530
  }, {
9569
9531
  body: withCtx(() => [
9570
- createVNode(_sfc_main$n, {
9532
+ createVNode(_sfc_main$m, {
9571
9533
  class: "m-editor-node-list-menu magic-editor-layer-tree",
9572
9534
  data: nodeData.value,
9573
9535
  "node-status-map": unref(nodeStatusMap),
@@ -9816,7 +9778,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9816
9778
  };
9817
9779
  __expose({ show });
9818
9780
  return (_ctx, _cache) => {
9819
- return openBlock(), createBlock(_sfc_main$h, {
9781
+ return openBlock(), createBlock(_sfc_main$g, {
9820
9782
  "menu-data": menuData.value,
9821
9783
  ref_key: "menu",
9822
9784
  ref: menu
@@ -9977,7 +9939,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
9977
9939
  }
9978
9940
  };
9979
9941
  return (_ctx, _cache) => {
9980
- return openBlock(), createBlock(_sfc_main$9, {
9942
+ return openBlock(), createBlock(_sfc_main$8, {
9981
9943
  class: "m-editor-stage",
9982
9944
  ref_key: "stageWrap",
9983
9945
  ref: stageWrap,
@@ -11163,7 +11125,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
11163
11125
  ]),
11164
11126
  sidebar: withCtx(() => [
11165
11127
  renderSlot(_ctx.$slots, "sidebar", { editorService: unref(editorService) }, () => [
11166
- createVNode(_sfc_main$b, {
11128
+ createVNode(_sfc_main$a, {
11167
11129
  data: _ctx.sidebar,
11168
11130
  "layer-content-menu": _ctx.layerContentMenu,
11169
11131
  "custom-content-menu": _ctx.customContentMenu
@@ -11287,4 +11249,4 @@ const index = {
11287
11249
  }
11288
11250
  };
11289
11251
 
11290
- export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$Q as CodeBlockEditor, _sfc_main$m as CodeBlockList, _sfc_main$l as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$R as CodeSelect, _sfc_main$N as CodeSelectCol, ColumnLayout, _sfc_main$c as ComponentListPanel, _sfc_main$h as ContentMenu, _sfc_main$L as DataSourceFieldSelect, _sfc_main$M as DataSourceFields, _sfc_main$K as DataSourceInput, _sfc_main$I as DataSourceMethodSelect, _sfc_main$J as DataSourceMethods, _sfc_main$H as DataSourceMocks, _sfc_main$G as DataSourceSelect, DragType, _sfc_main$F as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$O as Icon, KeyBindingCommand, _sfc_main$D as KeyValue, Keys, LayerOffset, _sfc_main$d as LayerPanel, Layout, _sfc_main$z as LayoutContainer, _sfc_main$C as PageFragmentSelect, _sfc_main$q as PropsPanel, _sfc_main$A as Resizer, _sfc_main$z as SplitView, _sfc_main$U as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$y as ToolButton, UI_SELECT_MODE_EVENT_NAME, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setChildrenLayout, setConfig, setLayout, stageOverlayService, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useFloatBox, useStage, warn };
11252
+ export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$Q as CodeBlockEditor, _sfc_main$l as CodeBlockList, _sfc_main$k as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$R as CodeSelect, _sfc_main$N as CodeSelectCol, ColumnLayout, _sfc_main$b as ComponentListPanel, _sfc_main$g as ContentMenu, _sfc_main$L as DataSourceFieldSelect, _sfc_main$M as DataSourceFields, _sfc_main$K as DataSourceInput, _sfc_main$I as DataSourceMethodSelect, _sfc_main$J as DataSourceMethods, _sfc_main$H as DataSourceMocks, _sfc_main$G as DataSourceSelect, DragType, _sfc_main$F as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$O as Icon, KeyBindingCommand, _sfc_main$D as KeyValue, Keys, LayerOffset, _sfc_main$c as LayerPanel, Layout, _sfc_main$z as LayoutContainer, _sfc_main$C as PageFragmentSelect, _sfc_main$q as PropsPanel, _sfc_main$A as Resizer, _sfc_main$z as SplitView, _sfc_main$U as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$y as ToolButton, UI_SELECT_MODE_EVENT_NAME, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setChildrenLayout, setConfig, setLayout, stageOverlayService, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useFloatBox, useStage, warn };