@tmagic/editor 1.4.13 → 1.4.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.
- package/dist/tmagic-editor.js +246 -127
- package/dist/tmagic-editor.umd.cjs +244 -125
- package/package.json +9 -9
- package/src/Editor.vue +4 -0
- package/src/components/ContentMenu.vue +8 -1
- package/src/components/TreeNode.vue +7 -0
- package/src/fields/CodeSelect.vue +3 -3
- package/src/fields/DataSourceFieldSelect/FieldSelect.vue +12 -8
- package/src/fields/DataSourceFieldSelect/Index.vue +10 -9
- package/src/fields/DataSourceMethodSelect.vue +8 -8
- package/src/fields/DataSourceSelect.vue +6 -8
- package/src/hooks/use-float-box.ts +52 -12
- package/src/layouts/sidebar/ComponentListPanel.vue +30 -27
- package/src/layouts/sidebar/Sidebar.vue +24 -3
- package/src/layouts/sidebar/layer/LayerPanel.vue +1 -1
- package/src/layouts/sidebar/layer/use-click.ts +9 -0
- package/src/layouts/sidebar/layer/use-drag.ts +28 -4
- package/src/services/editor.ts +13 -2
- package/src/type.ts +5 -0
- package/types/components/TreeNode.vue.d.ts +7 -0
- package/types/hooks/use-float-box.d.ts +1 -1
- package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +1 -1
- package/types/services/ui.d.ts +2 -0
- package/types/type.d.ts +7 -0
|
@@ -433,7 +433,7 @@
|
|
|
433
433
|
{
|
|
434
434
|
type: "select",
|
|
435
435
|
name: "codeType",
|
|
436
|
-
span:
|
|
436
|
+
span: 6,
|
|
437
437
|
options: [
|
|
438
438
|
{ value: schema.HookCodeType.CODE, text: "代码块" },
|
|
439
439
|
{ value: schema.HookCodeType.DATA_SOURCE_METHOD, text: "数据源方法" }
|
|
@@ -451,7 +451,7 @@
|
|
|
451
451
|
{
|
|
452
452
|
type: "code-select-col",
|
|
453
453
|
name: "codeId",
|
|
454
|
-
span:
|
|
454
|
+
span: 18,
|
|
455
455
|
labelWidth: 0,
|
|
456
456
|
display: (mForm, { model }) => model.codeType !== schema.HookCodeType.DATA_SOURCE_METHOD,
|
|
457
457
|
notEditable: () => !services?.codeBlockService.getEditStatus()
|
|
@@ -459,7 +459,7 @@
|
|
|
459
459
|
{
|
|
460
460
|
type: "data-source-method-select",
|
|
461
461
|
name: "codeId",
|
|
462
|
-
span:
|
|
462
|
+
span: 18,
|
|
463
463
|
labelWidth: 0,
|
|
464
464
|
display: (mForm, { model }) => model.codeType === schema.HookCodeType.DATA_SOURCE_METHOD,
|
|
465
465
|
notEditable: () => !services?.dataSourceService.get("editable")
|
|
@@ -2420,9 +2420,17 @@
|
|
|
2420
2420
|
const sourceIndicesInTargetParent = [];
|
|
2421
2421
|
const sourceOutTargetParent = [];
|
|
2422
2422
|
const newLayout = await this.getLayout(targetParent);
|
|
2423
|
-
for (const config2 of configs) {
|
|
2423
|
+
forConfigs: for (const config2 of configs) {
|
|
2424
2424
|
const { parent, node: curNode } = this.getNodeInfo(config2.id, false);
|
|
2425
|
-
if (!parent || !curNode)
|
|
2425
|
+
if (!parent || !curNode) {
|
|
2426
|
+
continue;
|
|
2427
|
+
}
|
|
2428
|
+
const path = utils.getNodePath(curNode.id, parent.items);
|
|
2429
|
+
for (const node of path) {
|
|
2430
|
+
if (targetParent.id === node.id) {
|
|
2431
|
+
continue forConfigs;
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2426
2434
|
const index = getNodeIndex(curNode.id, parent);
|
|
2427
2435
|
if (parent.id === targetParent.id) {
|
|
2428
2436
|
if (typeof index !== "number" || index === -1) {
|
|
@@ -3765,20 +3773,46 @@
|
|
|
3765
3773
|
const showingBoxKeys = vue.computed(
|
|
3766
3774
|
() => Object.keys(floatBoxStates.value).filter((key) => floatBoxStates.value[key].status)
|
|
3767
3775
|
);
|
|
3768
|
-
const
|
|
3769
|
-
|
|
3776
|
+
const dragState = {
|
|
3777
|
+
startOffset: {
|
|
3778
|
+
x: 0,
|
|
3779
|
+
y: 0
|
|
3780
|
+
},
|
|
3781
|
+
isDragging: false
|
|
3782
|
+
};
|
|
3783
|
+
const dragstartHandler = (e) => {
|
|
3784
|
+
dragState.isDragging = true;
|
|
3785
|
+
dragState.startOffset.x = e.clientX;
|
|
3786
|
+
dragState.startOffset.y = e.clientY;
|
|
3787
|
+
};
|
|
3788
|
+
const effectiveDistance = 20;
|
|
3770
3789
|
const dragendHandler = (key, e) => {
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3790
|
+
if (!dragState.isDragging) return;
|
|
3791
|
+
const { startOffset } = dragState;
|
|
3792
|
+
if (Math.abs(startOffset.x - e.clientX) > effectiveDistance || Math.abs(startOffset.y - e.clientY) > effectiveDistance) {
|
|
3793
|
+
const navMenuRect = services?.uiService?.get("navMenuRect");
|
|
3794
|
+
floatBoxStates.value[key] = {
|
|
3795
|
+
left: e.clientX,
|
|
3796
|
+
top: (navMenuRect?.top ?? 0) + (navMenuRect?.height ?? 0),
|
|
3797
|
+
status: true
|
|
3798
|
+
};
|
|
3799
|
+
}
|
|
3800
|
+
dragState.isDragging = false;
|
|
3778
3801
|
};
|
|
3779
|
-
|
|
3780
|
-
if (!isDragging
|
|
3802
|
+
const dragoverHandler = (e) => {
|
|
3803
|
+
if (!dragState.isDragging) return;
|
|
3781
3804
|
e.preventDefault();
|
|
3805
|
+
};
|
|
3806
|
+
const blurHandler = () => {
|
|
3807
|
+
dragState.startOffset.x = 0;
|
|
3808
|
+
dragState.startOffset.y = 0;
|
|
3809
|
+
dragState.isDragging = false;
|
|
3810
|
+
};
|
|
3811
|
+
globalThis.document.body.addEventListener("dragover", dragoverHandler);
|
|
3812
|
+
globalThis.addEventListener("blur", blurHandler);
|
|
3813
|
+
vue.onBeforeUnmount(() => {
|
|
3814
|
+
globalThis.document.body.removeEventListener("dragover", dragoverHandler);
|
|
3815
|
+
globalThis.removeEventListener("blur", blurHandler);
|
|
3782
3816
|
});
|
|
3783
3817
|
vue.watch(
|
|
3784
3818
|
() => slideKeys.value,
|
|
@@ -4336,19 +4370,26 @@
|
|
|
4336
4370
|
},
|
|
4337
4371
|
onChange: onChangeHandler
|
|
4338
4372
|
}, null, 8, ["model-value", "disabled", "size", "options", "props"])),
|
|
4339
|
-
selectDataSourceId.value && hasDataSourceSidePanel.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.
|
|
4373
|
+
selectDataSourceId.value && hasDataSourceSidePanel.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
4340
4374
|
key: 2,
|
|
4341
|
-
|
|
4342
|
-
size: _ctx.size,
|
|
4343
|
-
onClick: _cache[0] || (_cache[0] = ($event) => editHandler(selectDataSourceId.value))
|
|
4375
|
+
content: notEditable.value ? "查看" : "编辑"
|
|
4344
4376
|
}, {
|
|
4345
4377
|
default: vue.withCtx(() => [
|
|
4346
|
-
vue.createVNode(
|
|
4347
|
-
|
|
4348
|
-
|
|
4378
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4379
|
+
class: "m-fields-select-action-button",
|
|
4380
|
+
size: _ctx.size,
|
|
4381
|
+
onClick: _cache[0] || (_cache[0] = ($event) => editHandler(selectDataSourceId.value))
|
|
4382
|
+
}, {
|
|
4383
|
+
default: vue.withCtx(() => [
|
|
4384
|
+
vue.createVNode(_sfc_main$Y, {
|
|
4385
|
+
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View)
|
|
4386
|
+
}, null, 8, ["icon"])
|
|
4387
|
+
]),
|
|
4388
|
+
_: 1
|
|
4389
|
+
}, 8, ["size"])
|
|
4349
4390
|
]),
|
|
4350
4391
|
_: 1
|
|
4351
|
-
}, 8, ["
|
|
4392
|
+
}, 8, ["content"])) : vue.createCommentVNode("", true)
|
|
4352
4393
|
]);
|
|
4353
4394
|
};
|
|
4354
4395
|
}
|
|
@@ -4479,18 +4520,26 @@
|
|
|
4479
4520
|
prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.name}`,
|
|
4480
4521
|
onChange: onChangeHandler
|
|
4481
4522
|
}, null, 40, ["config", "model", "name", "disabled", "size", "last-values", "init-values", "values", "prop"])),
|
|
4482
|
-
_ctx.config.fieldConfig ? (vue.openBlock(), vue.createBlock(vue.unref(design.
|
|
4523
|
+
_ctx.config.fieldConfig ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
4483
4524
|
key: 2,
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
size: _ctx.size,
|
|
4487
|
-
onClick: _cache[0] || (_cache[0] = ($event) => showDataSourceFieldSelect.value = !showDataSourceFieldSelect.value)
|
|
4525
|
+
disabled: showDataSourceFieldSelect.value,
|
|
4526
|
+
content: "选择数据源"
|
|
4488
4527
|
}, {
|
|
4489
4528
|
default: vue.withCtx(() => [
|
|
4490
|
-
vue.createVNode(
|
|
4529
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4530
|
+
style: { "margin-left": "5px" },
|
|
4531
|
+
type: showDataSourceFieldSelect.value ? "primary" : "default",
|
|
4532
|
+
size: _ctx.size,
|
|
4533
|
+
onClick: _cache[0] || (_cache[0] = ($event) => showDataSourceFieldSelect.value = !showDataSourceFieldSelect.value)
|
|
4534
|
+
}, {
|
|
4535
|
+
default: vue.withCtx(() => [
|
|
4536
|
+
vue.createVNode(_sfc_main$Y, { icon: vue.unref(iconsVue.Coin) }, null, 8, ["icon"])
|
|
4537
|
+
]),
|
|
4538
|
+
_: 1
|
|
4539
|
+
}, 8, ["type", "size"])
|
|
4491
4540
|
]),
|
|
4492
4541
|
_: 1
|
|
4493
|
-
}, 8, ["
|
|
4542
|
+
}, 8, ["disabled"])) : vue.createCommentVNode("", true)
|
|
4494
4543
|
]);
|
|
4495
4544
|
};
|
|
4496
4545
|
}
|
|
@@ -5193,7 +5242,7 @@
|
|
|
5193
5242
|
...paramState
|
|
5194
5243
|
}));
|
|
5195
5244
|
};
|
|
5196
|
-
const paramsConfig = vue.ref(getParamItemsConfig(props.model.dataSourceMethod));
|
|
5245
|
+
const paramsConfig = vue.ref(getParamItemsConfig(props.model[props.name || "dataSourceMethod"]));
|
|
5197
5246
|
const setParamsConfig = (dataSourceMethod, formState = {}) => {
|
|
5198
5247
|
paramsConfig.value = dataSourceMethod ? getParamItemsConfig(dataSourceMethod) : [];
|
|
5199
5248
|
if (paramsConfig.value.length) {
|
|
@@ -5245,19 +5294,26 @@
|
|
|
5245
5294
|
size: _ctx.size,
|
|
5246
5295
|
onChange: onChangeHandler
|
|
5247
5296
|
}, null, 8, ["config", "model", "size"]),
|
|
5248
|
-
_ctx.model[_ctx.name] && isCustomMethod.value && hasDataSourceSidePanel.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.
|
|
5297
|
+
_ctx.model[_ctx.name] && isCustomMethod.value && hasDataSourceSidePanel.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
5249
5298
|
key: 0,
|
|
5250
|
-
|
|
5251
|
-
size: _ctx.size,
|
|
5252
|
-
onClick: editCodeHandler
|
|
5299
|
+
content: notEditable.value ? "查看" : "编辑"
|
|
5253
5300
|
}, {
|
|
5254
5301
|
default: vue.withCtx(() => [
|
|
5255
|
-
vue.createVNode(
|
|
5256
|
-
|
|
5257
|
-
|
|
5302
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
5303
|
+
class: "m-fields-select-action-button",
|
|
5304
|
+
size: _ctx.size,
|
|
5305
|
+
onClick: editCodeHandler
|
|
5306
|
+
}, {
|
|
5307
|
+
default: vue.withCtx(() => [
|
|
5308
|
+
vue.createVNode(_sfc_main$Y, {
|
|
5309
|
+
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View)
|
|
5310
|
+
}, null, 8, ["icon"])
|
|
5311
|
+
]),
|
|
5312
|
+
_: 1
|
|
5313
|
+
}, 8, ["size"])
|
|
5258
5314
|
]),
|
|
5259
5315
|
_: 1
|
|
5260
|
-
}, 8, ["
|
|
5316
|
+
}, 8, ["content"])) : vue.createCommentVNode("", true)
|
|
5261
5317
|
]),
|
|
5262
5318
|
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$T, {
|
|
5263
5319
|
key: 0,
|
|
@@ -5595,19 +5651,26 @@
|
|
|
5595
5651
|
"last-values": _ctx.lastValues,
|
|
5596
5652
|
onChange: changeHandler
|
|
5597
5653
|
}, null, 8, ["model", "name", "size", "prop", "disabled", "config", "last-values"]),
|
|
5598
|
-
_ctx.model[_ctx.name] && hasDataSourceSidePanel.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.
|
|
5654
|
+
_ctx.model[_ctx.name] && hasDataSourceSidePanel.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
5599
5655
|
key: 0,
|
|
5600
|
-
|
|
5601
|
-
size: _ctx.size,
|
|
5602
|
-
onClick: editHandler
|
|
5656
|
+
content: notEditable.value ? "查看" : "编辑"
|
|
5603
5657
|
}, {
|
|
5604
5658
|
default: vue.withCtx(() => [
|
|
5605
|
-
vue.createVNode(
|
|
5606
|
-
|
|
5607
|
-
|
|
5659
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
5660
|
+
class: "m-fields-select-action-button",
|
|
5661
|
+
size: _ctx.size,
|
|
5662
|
+
onClick: editHandler
|
|
5663
|
+
}, {
|
|
5664
|
+
default: vue.withCtx(() => [
|
|
5665
|
+
vue.createVNode(_sfc_main$Y, {
|
|
5666
|
+
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View)
|
|
5667
|
+
}, null, 8, ["icon"])
|
|
5668
|
+
]),
|
|
5669
|
+
_: 1
|
|
5670
|
+
}, 8, ["size"])
|
|
5608
5671
|
]),
|
|
5609
5672
|
_: 1
|
|
5610
|
-
}, 8, ["
|
|
5673
|
+
}, 8, ["content"])) : vue.createCommentVNode("", true)
|
|
5611
5674
|
]);
|
|
5612
5675
|
};
|
|
5613
5676
|
}
|
|
@@ -7867,7 +7930,7 @@
|
|
|
7867
7930
|
});
|
|
7868
7931
|
};
|
|
7869
7932
|
|
|
7870
|
-
const _hoisted_1$9 = ["draggable", "data-node-id", "data-is-container"];
|
|
7933
|
+
const _hoisted_1$9 = ["draggable", "data-node-id", "data-parent-id", "data-parents-id", "data-is-container"];
|
|
7871
7934
|
const _hoisted_2$6 = { class: "tree-node-label" };
|
|
7872
7935
|
const _hoisted_3$3 = { class: "tree-node-tool" };
|
|
7873
7936
|
const _hoisted_4$3 = {
|
|
@@ -7881,6 +7944,8 @@
|
|
|
7881
7944
|
__name: "TreeNode",
|
|
7882
7945
|
props: {
|
|
7883
7946
|
data: {},
|
|
7947
|
+
parent: {},
|
|
7948
|
+
parentsId: { default: () => [] },
|
|
7884
7949
|
nodeStatusMap: {},
|
|
7885
7950
|
indent: { default: 0 }
|
|
7886
7951
|
},
|
|
@@ -7932,6 +7997,8 @@
|
|
|
7932
7997
|
class: "m-editor-tree-node",
|
|
7933
7998
|
draggable: draggable.value,
|
|
7934
7999
|
"data-node-id": _ctx.data.id,
|
|
8000
|
+
"data-parent-id": _ctx.parent?.id,
|
|
8001
|
+
"data-parents-id": _ctx.parentsId,
|
|
7935
8002
|
"data-is-container": Array.isArray(_ctx.data.items),
|
|
7936
8003
|
onDragstart: handleDragStart,
|
|
7937
8004
|
onDragleave: handleDragLeave,
|
|
@@ -7970,6 +8037,8 @@
|
|
|
7970
8037
|
return vue.openBlock(), vue.createBlock(_component_TreeNode, {
|
|
7971
8038
|
key: item.id,
|
|
7972
8039
|
data: item,
|
|
8040
|
+
parent: _ctx.data,
|
|
8041
|
+
parentsId: [..._ctx.parentsId, _ctx.data.id],
|
|
7973
8042
|
"node-status-map": _ctx.nodeStatusMap,
|
|
7974
8043
|
indent: _ctx.indent + 11
|
|
7975
8044
|
}, {
|
|
@@ -7983,7 +8052,7 @@
|
|
|
7983
8052
|
vue.renderSlot(_ctx.$slots, "tree-node-tool", { data: nodeData })
|
|
7984
8053
|
]),
|
|
7985
8054
|
_: 2
|
|
7986
|
-
}, 1032, ["data", "node-status-map", "indent"]);
|
|
8055
|
+
}, 1032, ["data", "parent", "parentsId", "node-status-map", "indent"]);
|
|
7987
8056
|
}), 128))
|
|
7988
8057
|
])) : vue.createCommentVNode("", true)
|
|
7989
8058
|
], 40, _hoisted_1$9)), [
|
|
@@ -8723,13 +8792,16 @@
|
|
|
8723
8792
|
const subMenu = vue.ref();
|
|
8724
8793
|
const visible = vue.ref(false);
|
|
8725
8794
|
const subMenuData = vue.ref([]);
|
|
8795
|
+
const zIndex = design.useZIndex();
|
|
8796
|
+
const curZIndex = vue.ref(0);
|
|
8726
8797
|
const menuPosition = vue.ref({
|
|
8727
8798
|
left: 0,
|
|
8728
8799
|
top: 0
|
|
8729
8800
|
});
|
|
8730
8801
|
const menuStyle = vue.computed(() => ({
|
|
8731
8802
|
top: `${menuPosition.value.top}px`,
|
|
8732
|
-
left: `${menuPosition.value.left}px
|
|
8803
|
+
left: `${menuPosition.value.left}px`,
|
|
8804
|
+
zIndex: curZIndex.value
|
|
8733
8805
|
}));
|
|
8734
8806
|
const contains = (el) => menu.value?.contains(el) || subMenu.value?.contains(el);
|
|
8735
8807
|
const hide = () => {
|
|
@@ -8769,6 +8841,7 @@
|
|
|
8769
8841
|
visible.value = true;
|
|
8770
8842
|
vue.nextTick(() => {
|
|
8771
8843
|
e && setPosition(e);
|
|
8844
|
+
curZIndex.value = zIndex.nextZIndex();
|
|
8772
8845
|
emit("show");
|
|
8773
8846
|
});
|
|
8774
8847
|
}, 300);
|
|
@@ -9122,6 +9195,9 @@
|
|
|
9122
9195
|
}
|
|
9123
9196
|
};
|
|
9124
9197
|
const multiSelect = async (data) => {
|
|
9198
|
+
if (utils.isPage(data) || utils.isPageFragment(data)) {
|
|
9199
|
+
return;
|
|
9200
|
+
}
|
|
9125
9201
|
const nodes = services?.editorService.get("nodes") || [];
|
|
9126
9202
|
const newNodes = [];
|
|
9127
9203
|
let isCancel = false;
|
|
@@ -9130,6 +9206,9 @@
|
|
|
9130
9206
|
isCancel = true;
|
|
9131
9207
|
return;
|
|
9132
9208
|
}
|
|
9209
|
+
if (utils.isPage(node) || utils.isPageFragment(node)) {
|
|
9210
|
+
return;
|
|
9211
|
+
}
|
|
9133
9212
|
newNodes.push(node.id);
|
|
9134
9213
|
});
|
|
9135
9214
|
if (!isCancel || newNodes.length === 0) {
|
|
@@ -9209,6 +9288,7 @@
|
|
|
9209
9288
|
const targetEl = getNodeEl(event.target);
|
|
9210
9289
|
if (!targetEl || targetEl !== event.currentTarget) return;
|
|
9211
9290
|
event.dataTransfer.effectAllowed = "move";
|
|
9291
|
+
dragState.nodeId = targetEl.dataset.nodeId;
|
|
9212
9292
|
try {
|
|
9213
9293
|
event.dataTransfer.setData(
|
|
9214
9294
|
"text/json",
|
|
@@ -9225,26 +9305,42 @@
|
|
|
9225
9305
|
if (!targetEl?.draggable) return;
|
|
9226
9306
|
const labelEl = targetEl.children[0];
|
|
9227
9307
|
if (!labelEl) return;
|
|
9308
|
+
utils.removeClassName(labelEl, "drag-before", "drag-after", "drag-inner");
|
|
9228
9309
|
const { top: targetTop, height: targetHeight } = labelEl.getBoundingClientRect();
|
|
9229
9310
|
const distance = event.clientY - targetTop;
|
|
9230
9311
|
const isContainer = targetEl.dataset.isContainer === "true";
|
|
9312
|
+
const targetNodeId = targetEl.dataset.nodeId;
|
|
9313
|
+
const { nodeId } = dragState;
|
|
9314
|
+
const parentsId = targetEl.dataset.parentsId?.split(",");
|
|
9315
|
+
if (!targetNodeId) {
|
|
9316
|
+
return;
|
|
9317
|
+
}
|
|
9318
|
+
if (parentsId) {
|
|
9319
|
+
let targetIdIndex = -1;
|
|
9320
|
+
for (let i = 0, l = parentsId.length; i < l; i++) {
|
|
9321
|
+
const id = parentsId[i];
|
|
9322
|
+
if (nodeId === id) {
|
|
9323
|
+
targetIdIndex = i;
|
|
9324
|
+
}
|
|
9325
|
+
if (parentsId.includes(`${nodeId}`) && i >= targetIdIndex) {
|
|
9326
|
+
return;
|
|
9327
|
+
}
|
|
9328
|
+
}
|
|
9329
|
+
}
|
|
9231
9330
|
if (distance < targetHeight / 3) {
|
|
9232
9331
|
dragState.dropType = "before";
|
|
9233
9332
|
utils.addClassName(labelEl, globalThis.document, "drag-before");
|
|
9234
|
-
utils.removeClassName(labelEl, "drag-after", "drag-inner");
|
|
9235
9333
|
} else if (distance > targetHeight * 2 / 3) {
|
|
9236
9334
|
dragState.dropType = "after";
|
|
9237
9335
|
utils.addClassName(labelEl, globalThis.document, "drag-after");
|
|
9238
|
-
utils.removeClassName(labelEl, "drag-before", "drag-inner");
|
|
9239
9336
|
} else if (isContainer) {
|
|
9240
9337
|
dragState.dropType = "inner";
|
|
9241
9338
|
utils.addClassName(labelEl, globalThis.document, "drag-inner");
|
|
9242
|
-
utils.removeClassName(labelEl, "drag-before", "drag-after");
|
|
9243
9339
|
}
|
|
9244
9340
|
if (!dragState.dropType) {
|
|
9245
9341
|
return;
|
|
9246
9342
|
}
|
|
9247
|
-
dragState.dragOverNodeId =
|
|
9343
|
+
dragState.dragOverNodeId = targetNodeId;
|
|
9248
9344
|
dragState.container = event.currentTarget;
|
|
9249
9345
|
event.preventDefault();
|
|
9250
9346
|
};
|
|
@@ -9655,7 +9751,7 @@
|
|
|
9655
9751
|
const stageOptions = vue.inject("stageOptions");
|
|
9656
9752
|
const stage = vue.computed(() => services?.editorService.get("stage"));
|
|
9657
9753
|
const list = vue.computed(
|
|
9658
|
-
() => services?.componentListService.getList().map((group) => ({
|
|
9754
|
+
() => (services?.componentListService.getList() || []).map((group) => ({
|
|
9659
9755
|
...group,
|
|
9660
9756
|
items: group.items.filter((item) => item.text.includes(searchText.value))
|
|
9661
9757
|
}))
|
|
@@ -9715,60 +9811,62 @@
|
|
|
9715
9811
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), null, {
|
|
9716
9812
|
default: vue.withCtx(() => [
|
|
9717
9813
|
vue.renderSlot(_ctx.$slots, "component-list-panel-header"),
|
|
9718
|
-
vue.createVNode(
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
|
|
9728
|
-
|
|
9729
|
-
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9743
|
-
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
vue.
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
vue.
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9814
|
+
vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
9815
|
+
vue.renderSlot(_ctx.$slots, "component-list", { componentGroupList: list.value }, () => [
|
|
9816
|
+
vue.createVNode(vue.unref(design.TMagicCollapse), {
|
|
9817
|
+
class: "ui-component-panel",
|
|
9818
|
+
"model-value": collapseValue.value
|
|
9819
|
+
}, {
|
|
9820
|
+
default: vue.withCtx(() => [
|
|
9821
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (group, index) => {
|
|
9822
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
9823
|
+
group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
|
|
9824
|
+
key: index,
|
|
9825
|
+
name: `${index}`
|
|
9826
|
+
}, {
|
|
9827
|
+
title: vue.withCtx(() => [
|
|
9828
|
+
vue.createVNode(_sfc_main$Y, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
|
|
9829
|
+
vue.createTextVNode(vue.toDisplayString(group.title), 1)
|
|
9830
|
+
]),
|
|
9831
|
+
default: vue.withCtx(() => [
|
|
9832
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(group.items, (item) => {
|
|
9833
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
9834
|
+
class: "component-item",
|
|
9835
|
+
draggable: "true",
|
|
9836
|
+
key: item.type,
|
|
9837
|
+
onClick: ($event) => appendComponent(item),
|
|
9838
|
+
onDragstart: ($event) => dragstartHandler(item, $event),
|
|
9839
|
+
onDragend: dragendHandler,
|
|
9840
|
+
onDrag: dragHandler
|
|
9841
|
+
}, [
|
|
9842
|
+
vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
9843
|
+
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
9844
|
+
placement: "right",
|
|
9845
|
+
disabled: !Boolean(item.desc),
|
|
9846
|
+
content: item.desc
|
|
9847
|
+
}, {
|
|
9848
|
+
default: vue.withCtx(() => [
|
|
9849
|
+
vue.createVNode(_sfc_main$Y, {
|
|
9850
|
+
icon: item.icon
|
|
9851
|
+
}, null, 8, ["icon"])
|
|
9852
|
+
]),
|
|
9853
|
+
_: 2
|
|
9854
|
+
}, 1032, ["disabled", "content"]),
|
|
9855
|
+
vue.createElementVNode("span", {
|
|
9856
|
+
title: item.text
|
|
9857
|
+
}, vue.toDisplayString(item.text), 9, _hoisted_2$3)
|
|
9858
|
+
])
|
|
9859
|
+
], 40, _hoisted_1$4);
|
|
9860
|
+
}), 128))
|
|
9861
|
+
]),
|
|
9862
|
+
_: 2
|
|
9863
|
+
}, 1032, ["name"])) : vue.createCommentVNode("", true)
|
|
9864
|
+
], 64);
|
|
9865
|
+
}), 256))
|
|
9866
|
+
]),
|
|
9867
|
+
_: 3
|
|
9868
|
+
}, 8, ["model-value"])
|
|
9869
|
+
])
|
|
9772
9870
|
]),
|
|
9773
9871
|
_: 3
|
|
9774
9872
|
});
|
|
@@ -9781,7 +9879,7 @@
|
|
|
9781
9879
|
class: "m-editor-sidebar"
|
|
9782
9880
|
};
|
|
9783
9881
|
const _hoisted_2$2 = { class: "m-editor-sidebar-header" };
|
|
9784
|
-
const _hoisted_3$1 = ["onClick", "onDragend"];
|
|
9882
|
+
const _hoisted_3$1 = ["draggable", "onClick", "onDragend"];
|
|
9785
9883
|
const _hoisted_4$1 = {
|
|
9786
9884
|
key: 1,
|
|
9787
9885
|
class: "magic-editor-tab-panel-title"
|
|
@@ -9883,6 +9981,14 @@
|
|
|
9883
9981
|
activeTabName.value = nextSlideBarItem?.text;
|
|
9884
9982
|
}
|
|
9885
9983
|
);
|
|
9984
|
+
const headerItemClickHandler = async (config, index) => {
|
|
9985
|
+
if (typeof config.beforeClick === "function") {
|
|
9986
|
+
if (await config.beforeClick(config) === false) {
|
|
9987
|
+
return;
|
|
9988
|
+
}
|
|
9989
|
+
}
|
|
9990
|
+
activeTabName.value = config.text || config.$key || `${index}`;
|
|
9991
|
+
};
|
|
9886
9992
|
__expose({
|
|
9887
9993
|
activeTabName
|
|
9888
9994
|
});
|
|
@@ -9893,10 +9999,10 @@
|
|
|
9893
9999
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(sideBarItems.value, (config, index) => {
|
|
9894
10000
|
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
9895
10001
|
class: vue.normalizeClass(["m-editor-sidebar-header-item", { "is-active": activeTabName.value === config.text }]),
|
|
9896
|
-
draggable:
|
|
10002
|
+
draggable: config.draggable ?? true,
|
|
9897
10003
|
key: config.$key ?? index,
|
|
9898
10004
|
style: vue.normalizeStyle(config.tabStyle || {}),
|
|
9899
|
-
onClick: ($event) =>
|
|
10005
|
+
onClick: ($event) => headerItemClickHandler(config, index),
|
|
9900
10006
|
onDragstart: _cache[0] || (_cache[0] = //@ts-ignore
|
|
9901
10007
|
(...args) => vue.unref(dragstartHandler) && vue.unref(dragstartHandler)(...args)),
|
|
9902
10008
|
onDragend: ($event) => vue.unref(dragendHandler)(config.$key, $event)
|
|
@@ -9916,16 +10022,26 @@
|
|
|
9916
10022
|
class: "m-editor-sidebar-content",
|
|
9917
10023
|
key: config.$key ?? index
|
|
9918
10024
|
}, [
|
|
9919
|
-
config && !vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.component), vue.mergeProps({
|
|
10025
|
+
config?.component && !vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.component), vue.mergeProps({
|
|
9920
10026
|
key: 0,
|
|
9921
10027
|
ref_for: true
|
|
9922
10028
|
}, config.props || {}, vue.toHandlers(config?.listeners || {})), vue.createSlots({ _: 2 }, [
|
|
10029
|
+
config.$key === "component-list" || config.slots?.componentList ? {
|
|
10030
|
+
name: "component-list",
|
|
10031
|
+
fn: vue.withCtx(({ componentGroupList }) => [
|
|
10032
|
+
config.$key === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list", {
|
|
10033
|
+
key: 0,
|
|
10034
|
+
componentGroupList
|
|
10035
|
+
}) : config.slots?.componentList ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.componentList), { key: 1 })) : vue.createCommentVNode("", true)
|
|
10036
|
+
]),
|
|
10037
|
+
key: "0"
|
|
10038
|
+
} : void 0,
|
|
9923
10039
|
config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
|
|
9924
10040
|
name: "component-list-panel-header",
|
|
9925
10041
|
fn: vue.withCtx(() => [
|
|
9926
10042
|
config.$key === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : config.slots?.componentListPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.componentListPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
9927
10043
|
]),
|
|
9928
|
-
key: "
|
|
10044
|
+
key: "1"
|
|
9929
10045
|
} : void 0,
|
|
9930
10046
|
config.$key === "component-list" || config.slots?.componentListItem ? {
|
|
9931
10047
|
name: "component-list-item",
|
|
@@ -9938,21 +10054,21 @@
|
|
|
9938
10054
|
component
|
|
9939
10055
|
}, null, 8, ["component"])) : vue.createCommentVNode("", true)
|
|
9940
10056
|
]),
|
|
9941
|
-
key: "
|
|
10057
|
+
key: "2"
|
|
9942
10058
|
} : void 0,
|
|
9943
10059
|
config.$key === "layer" || config.slots?.layerPanelHeader ? {
|
|
9944
10060
|
name: "layer-panel-header",
|
|
9945
10061
|
fn: vue.withCtx(() => [
|
|
9946
10062
|
config.$key === "layer" ? vue.renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : config.slots?.layerPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.layerPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
9947
10063
|
]),
|
|
9948
|
-
key: "
|
|
10064
|
+
key: "3"
|
|
9949
10065
|
} : void 0,
|
|
9950
10066
|
config.$key === "code-block" || config.slots?.codeBlockPanelHeader ? {
|
|
9951
10067
|
name: "code-block-panel-header",
|
|
9952
10068
|
fn: vue.withCtx(() => [
|
|
9953
10069
|
config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : config.slots?.codeBlockPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
9954
10070
|
]),
|
|
9955
|
-
key: "
|
|
10071
|
+
key: "4"
|
|
9956
10072
|
} : void 0,
|
|
9957
10073
|
config.$key === "code-block" || config.slots?.codeBlockPanelTool ? {
|
|
9958
10074
|
name: "code-block-panel-tool",
|
|
@@ -9963,14 +10079,14 @@
|
|
|
9963
10079
|
data
|
|
9964
10080
|
}) : config.slots?.codeBlockPanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelTool), { key: 1 })) : vue.createCommentVNode("", true)
|
|
9965
10081
|
]),
|
|
9966
|
-
key: "
|
|
10082
|
+
key: "5"
|
|
9967
10083
|
} : void 0,
|
|
9968
10084
|
config.$key === "code-block" || config.slots?.codeBlockPanelSearch ? {
|
|
9969
10085
|
name: "code-block-panel-search",
|
|
9970
10086
|
fn: vue.withCtx(() => [
|
|
9971
10087
|
config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-search", { key: 0 }) : config.slots?.codeBlockPanelSearch ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelSearch), { key: 1 })) : vue.createCommentVNode("", true)
|
|
9972
10088
|
]),
|
|
9973
|
-
key: "
|
|
10089
|
+
key: "6"
|
|
9974
10090
|
} : void 0,
|
|
9975
10091
|
config.$key === "layer" || config.slots?.layerNodeContent ? {
|
|
9976
10092
|
name: "layer-node-content",
|
|
@@ -9983,7 +10099,7 @@
|
|
|
9983
10099
|
data: nodeData
|
|
9984
10100
|
}, null, 8, ["data"])) : vue.createCommentVNode("", true)
|
|
9985
10101
|
]),
|
|
9986
|
-
key: "
|
|
10102
|
+
key: "7"
|
|
9987
10103
|
} : void 0,
|
|
9988
10104
|
config.$key === "layer" || config.slots?.layerNodeLabel ? {
|
|
9989
10105
|
name: "layer-node-label",
|
|
@@ -9996,7 +10112,7 @@
|
|
|
9996
10112
|
data: nodeData
|
|
9997
10113
|
}, null, 8, ["data"])) : vue.createCommentVNode("", true)
|
|
9998
10114
|
]),
|
|
9999
|
-
key: "
|
|
10115
|
+
key: "8"
|
|
10000
10116
|
} : void 0,
|
|
10001
10117
|
config.$key === "layer" || config.slots?.layerNodeTool ? {
|
|
10002
10118
|
name: "layer-node-tool",
|
|
@@ -10009,7 +10125,7 @@
|
|
|
10009
10125
|
data: nodeData
|
|
10010
10126
|
}, null, 8, ["data"])) : vue.createCommentVNode("", true)
|
|
10011
10127
|
]),
|
|
10012
|
-
key: "
|
|
10128
|
+
key: "9"
|
|
10013
10129
|
} : void 0,
|
|
10014
10130
|
config.$key === "data-source" || config.slots?.dataSourcePanelTool ? {
|
|
10015
10131
|
name: "data-source-panel-tool",
|
|
@@ -10019,14 +10135,14 @@
|
|
|
10019
10135
|
data
|
|
10020
10136
|
}) : config.slots?.DataSourcePanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.DataSourcePanelTool), { key: 1 })) : vue.createCommentVNode("", true)
|
|
10021
10137
|
]),
|
|
10022
|
-
key: "
|
|
10138
|
+
key: "10"
|
|
10023
10139
|
} : void 0,
|
|
10024
10140
|
config.$key === "data-source" || config.slots?.dataSourcePanelSearch ? {
|
|
10025
10141
|
name: "data-source-panel-search",
|
|
10026
10142
|
fn: vue.withCtx(() => [
|
|
10027
10143
|
config.$key === "data-source" ? vue.renderSlot(_ctx.$slots, "data-source-panel-search", { key: 0 }) : config.slots?.dataSourcePanelSearch ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.dataSourcePanelSearch), { key: 1 })) : vue.createCommentVNode("", true)
|
|
10028
10144
|
]),
|
|
10029
|
-
key: "
|
|
10145
|
+
key: "11"
|
|
10030
10146
|
} : void 0
|
|
10031
10147
|
]), 1040)) : vue.createCommentVNode("", true)
|
|
10032
10148
|
])), [
|
|
@@ -12426,6 +12542,9 @@
|
|
|
12426
12542
|
"layer-node-tool": vue.withCtx(({ data }) => [
|
|
12427
12543
|
vue.renderSlot(_ctx.$slots, "layer-node-tool", { data })
|
|
12428
12544
|
]),
|
|
12545
|
+
"component-list": vue.withCtx(({ componentGroupList }) => [
|
|
12546
|
+
vue.renderSlot(_ctx.$slots, "component-list", { componentGroupList })
|
|
12547
|
+
]),
|
|
12429
12548
|
"component-list-panel-header": vue.withCtx(() => [
|
|
12430
12549
|
vue.renderSlot(_ctx.$slots, "component-list-panel-header")
|
|
12431
12550
|
]),
|