@tmagic/editor 1.3.0-beta.3 → 1.3.0-beta.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.
- package/dist/style.css +4 -4
- package/dist/tmagic-editor.js +181 -157
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +180 -155
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +10 -10
- package/src/components/Icon.vue +5 -1
- package/src/fields/CodeSelectCol.vue +1 -2
- package/src/fields/DataSourceMethodSelect.vue +0 -3
- package/src/fields/EventSelect.vue +4 -5
- package/src/fields/UISelect.vue +3 -3
- package/src/hooks/use-stage.ts +7 -2
- package/src/layouts/sidebar/ComponentListPanel.vue +4 -3
- package/src/layouts/sidebar/layer/LayerNode.vue +7 -5
- package/src/layouts/sidebar/layer/LayerPanel.vue +4 -2
- package/src/layouts/sidebar/layer/use-keybinding.ts +11 -8
- package/src/layouts/sidebar/layer/use-node-status.ts +9 -5
- package/src/layouts/workspace/viewer/Stage.vue +2 -1
- package/src/theme/event.scss +1 -3
- package/src/theme/framework.scss +0 -2
- package/src/theme/layer-panel.scss +4 -0
- package/src/type.ts +19 -0
- package/src/utils/keybinding-config.ts +31 -26
- package/src/utils/props.ts +1 -0
- package/types/layouts/sidebar/layer/LayerNode.vue.d.ts +1 -1
- package/types/layouts/sidebar/layer/use-keybinding.d.ts +3 -2
- package/types/type.d.ts +18 -0
- package/types/utils/keybinding-config.d.ts +4 -0
package/dist/style.css
CHANGED
|
@@ -132,7 +132,6 @@
|
|
|
132
132
|
display: flex;
|
|
133
133
|
flex-direction: column;
|
|
134
134
|
width: 100%;
|
|
135
|
-
font-family: -apple-system, BlinkMacSystemFont, Segoe WPC, Segoe UI, Microsoft YaHei, sans-serif;
|
|
136
135
|
}
|
|
137
136
|
.m-editor-content {
|
|
138
137
|
height: calc(100% - 35px);
|
|
@@ -256,6 +255,7 @@
|
|
|
256
255
|
}
|
|
257
256
|
.magic-editor-layer-panel .magic-editor-layer-tree .magic-editor-layer-node {
|
|
258
257
|
cursor: pointer;
|
|
258
|
+
white-space: nowrap;
|
|
259
259
|
}
|
|
260
260
|
.magic-editor-layer-panel .magic-editor-layer-tree .magic-editor-layer-node .layer-node {
|
|
261
261
|
display: flex;
|
|
@@ -295,6 +295,9 @@
|
|
|
295
295
|
.magic-editor-layer-panel .magic-editor-layer-tree .magic-editor-layer-node .layer-node .layer-node-content .layer-node-label {
|
|
296
296
|
line-height: 22px;
|
|
297
297
|
flex: 1;
|
|
298
|
+
width: 100px;
|
|
299
|
+
overflow: hidden;
|
|
300
|
+
text-overflow: ellipsis;
|
|
298
301
|
}
|
|
299
302
|
.magic-editor-layer-panel .magic-editor-layer-tree .magic-editor-layer-node .layer-node .layer-node-tool {
|
|
300
303
|
margin-right: 15px;
|
|
@@ -685,9 +688,6 @@
|
|
|
685
688
|
.m-fields-event-select .fullWidth {
|
|
686
689
|
width: 100%;
|
|
687
690
|
}
|
|
688
|
-
.m-fields-event-select .m-form-panel .el-card__body {
|
|
689
|
-
padding: 10px 25px;
|
|
690
|
-
}
|
|
691
691
|
.m-fields-event-select .event-select-code {
|
|
692
692
|
margin-left: 20px;
|
|
693
693
|
width: auto;
|
package/dist/tmagic-editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, onMounted, onUnmounted, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx, Fragment, createTextVNode, createCommentVNode, toRaw, resolveDynamicComponent, nextTick, mergeProps, toDisplayString, renderList, watchEffect, withModifiers, renderSlot, createSlots, normalizeProps, markRaw, getCurrentInstance, withDirectives, vShow, createStaticVNode, Transition,
|
|
1
|
+
import { defineComponent, ref, watch, onMounted, onUnmounted, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx, Fragment, createTextVNode, createCommentVNode, toRaw, resolveDynamicComponent, nextTick, mergeProps, toDisplayString, renderList, watchEffect, withModifiers, renderSlot, createSlots, normalizeProps, markRaw, getCurrentInstance, withDirectives, vShow, createStaticVNode, Transition, provide, toHandlers, mergeDefaults } from 'vue';
|
|
2
2
|
import { FullScreen, Edit, View, Coin, Delete, Plus, Close, ArrowDown, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, Aim, CopyDocument, DocumentCopy, Files, Hide, ArrowRight, Goods, List, EditPen, Top, Bottom, ArrowLeftBold, ArrowRightBold, CaretBottom } from '@element-plus/icons-vue';
|
|
3
3
|
import { throttle, isEmpty, cloneDeep, mergeWith, isObject, uniq, map, has, pick, keys } from 'lodash-es';
|
|
4
4
|
import * as monaco from 'monaco-editor';
|
|
@@ -1251,6 +1251,7 @@ const eventTabConfig = {
|
|
|
1251
1251
|
{
|
|
1252
1252
|
name: "events",
|
|
1253
1253
|
src: "component",
|
|
1254
|
+
labelWidth: "100px",
|
|
1254
1255
|
type: "event-select"
|
|
1255
1256
|
}
|
|
1256
1257
|
]
|
|
@@ -1481,6 +1482,7 @@ var DragType = /* @__PURE__ */ ((DragType2) => {
|
|
|
1481
1482
|
DragType2["LAYER_TREE"] = "layer-tree";
|
|
1482
1483
|
return DragType2;
|
|
1483
1484
|
})(DragType || {});
|
|
1485
|
+
const UI_SELECT_MODE_EVENT_NAME = "ui-select";
|
|
1484
1486
|
|
|
1485
1487
|
const COPY_STORAGE_KEY = "$MagicEditorCopyData";
|
|
1486
1488
|
const getPageList = (app) => {
|
|
@@ -2931,6 +2933,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
2931
2933
|
icon: {}
|
|
2932
2934
|
},
|
|
2933
2935
|
setup(__props) {
|
|
2936
|
+
const isRelativePath = (str) => /^(\.|(\.\.)?\/)/.test(str);
|
|
2934
2937
|
return (_ctx, _cache) => {
|
|
2935
2938
|
return !_ctx.icon ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
2936
2939
|
key: 0,
|
|
@@ -2940,7 +2943,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
2940
2943
|
createVNode(unref(Edit))
|
|
2941
2944
|
]),
|
|
2942
2945
|
_: 1
|
|
2943
|
-
})) : typeof _ctx.icon === "string" && _ctx.icon.startsWith("http") ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
2946
|
+
})) : typeof _ctx.icon === "string" && (_ctx.icon.startsWith("http") || isRelativePath(_ctx.icon)) ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
2944
2947
|
key: 1,
|
|
2945
2948
|
class: "magic-editor-icon"
|
|
2946
2949
|
}, {
|
|
@@ -3068,9 +3071,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
3068
3071
|
);
|
|
3069
3072
|
const selectConfig = {
|
|
3070
3073
|
type: "select",
|
|
3071
|
-
text: "代码块",
|
|
3072
3074
|
name: props.name,
|
|
3073
|
-
labelWidth: "80px",
|
|
3074
3075
|
options: () => {
|
|
3075
3076
|
if (codeDsl.value) {
|
|
3076
3077
|
return map(codeDsl.value, (value, key) => ({
|
|
@@ -3104,8 +3105,9 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
3104
3105
|
class: "select",
|
|
3105
3106
|
config: selectConfig,
|
|
3106
3107
|
model: _ctx.model,
|
|
3108
|
+
size: _ctx.size,
|
|
3107
3109
|
onChange: onParamsChangeHandler
|
|
3108
|
-
}, null, 8, ["model"]),
|
|
3110
|
+
}, null, 8, ["model", "size"]),
|
|
3109
3111
|
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$M, {
|
|
3110
3112
|
key: 0,
|
|
3111
3113
|
class: "icon",
|
|
@@ -3924,7 +3926,6 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
3924
3926
|
if (!paramStatements)
|
|
3925
3927
|
return [];
|
|
3926
3928
|
return paramStatements.map((paramState) => ({
|
|
3927
|
-
labelWidth: "100px",
|
|
3928
3929
|
text: paramState.name,
|
|
3929
3930
|
...paramState
|
|
3930
3931
|
}));
|
|
@@ -3953,9 +3954,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
3953
3954
|
);
|
|
3954
3955
|
const cascaderConfig = computed(() => ({
|
|
3955
3956
|
type: "cascader",
|
|
3956
|
-
text: "数据源方法",
|
|
3957
3957
|
name: props.name,
|
|
3958
|
-
labelWidth: "80px",
|
|
3959
3958
|
options: methodsOptions.value,
|
|
3960
3959
|
onChange: (formState, dataSourceMethod) => {
|
|
3961
3960
|
setParamsConfig(dataSourceMethod, formState);
|
|
@@ -4361,7 +4360,6 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
4361
4360
|
const defaultActionTypeConfig = {
|
|
4362
4361
|
name: "actionType",
|
|
4363
4362
|
text: "联动类型",
|
|
4364
|
-
labelWidth: "80px",
|
|
4365
4363
|
type: "select",
|
|
4366
4364
|
defaultValue: ActionType.COMP,
|
|
4367
4365
|
options: () => [
|
|
@@ -4390,7 +4388,6 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
4390
4388
|
const defaultTargetCompConfig = {
|
|
4391
4389
|
name: "to",
|
|
4392
4390
|
text: "联动组件",
|
|
4393
|
-
labelWidth: "80px",
|
|
4394
4391
|
type: "ui-select",
|
|
4395
4392
|
display: (mForm, { model }) => model.actionType === ActionType.COMP
|
|
4396
4393
|
};
|
|
@@ -4400,7 +4397,6 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
4400
4397
|
const defaultCompActionConfig = {
|
|
4401
4398
|
name: "method",
|
|
4402
4399
|
text: "动作",
|
|
4403
|
-
labelWidth: "80px",
|
|
4404
4400
|
type: "select",
|
|
4405
4401
|
display: (mForm, { model }) => model.actionType === ActionType.COMP,
|
|
4406
4402
|
options: (mForm, { model }) => {
|
|
@@ -4418,7 +4414,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
4418
4414
|
const codeActionConfig = computed(() => {
|
|
4419
4415
|
const defaultCodeActionConfig = {
|
|
4420
4416
|
type: "code-select-col",
|
|
4421
|
-
|
|
4417
|
+
text: "代码块",
|
|
4422
4418
|
name: "codeId",
|
|
4423
4419
|
disabled: () => !codeBlockService?.getEditStatus(),
|
|
4424
4420
|
display: (mForm, { model }) => model.actionType === ActionType.CODE
|
|
@@ -4428,8 +4424,8 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
4428
4424
|
const dataSourceActionConfig = computed(() => {
|
|
4429
4425
|
const defaultDataSourceActionConfig = {
|
|
4430
4426
|
type: "data-source-method-select",
|
|
4427
|
+
text: "数据源方法",
|
|
4431
4428
|
name: "dataSourceMethod",
|
|
4432
|
-
labelWidth: 0,
|
|
4433
4429
|
display: (mForm, { model }) => model.actionType === ActionType.DATA_SOURCE
|
|
4434
4430
|
};
|
|
4435
4431
|
return { ...defaultDataSourceActionConfig, ...props.config.dataSourceActionConfig };
|
|
@@ -4475,6 +4471,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
4475
4471
|
name: "actions",
|
|
4476
4472
|
expandAll: true,
|
|
4477
4473
|
enableToggleMode: false,
|
|
4474
|
+
titlePrefix: "动作",
|
|
4478
4475
|
items: [
|
|
4479
4476
|
actionTypeConfig.value,
|
|
4480
4477
|
targetCompConfig.value,
|
|
@@ -4544,6 +4541,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
4544
4541
|
size: _ctx.size,
|
|
4545
4542
|
config: actionsConfig.value,
|
|
4546
4543
|
model: cardItem,
|
|
4544
|
+
"label-width": _ctx.config.labelWidth || "100px",
|
|
4547
4545
|
onChange: onChangeHandler
|
|
4548
4546
|
}, {
|
|
4549
4547
|
header: withCtx(() => [
|
|
@@ -4565,7 +4563,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
4565
4563
|
}, null, 8, ["icon", "disabled", "size", "onClick"])
|
|
4566
4564
|
]),
|
|
4567
4565
|
_: 2
|
|
4568
|
-
}, 1032, ["disabled", "size", "config", "model"]);
|
|
4566
|
+
}, 1032, ["disabled", "size", "config", "model", "label-width"]);
|
|
4569
4567
|
}), 128))
|
|
4570
4568
|
]))
|
|
4571
4569
|
]);
|
|
@@ -4706,7 +4704,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
4706
4704
|
return;
|
|
4707
4705
|
services.uiService.set("uiSelectMode", false);
|
|
4708
4706
|
uiSelectMode.value = false;
|
|
4709
|
-
globalThis.document.removeEventListener(
|
|
4707
|
+
globalThis.document.removeEventListener(UI_SELECT_MODE_EVENT_NAME, clickHandler);
|
|
4710
4708
|
};
|
|
4711
4709
|
const clickHandler = ({ detail }) => {
|
|
4712
4710
|
if (detail.id) {
|
|
@@ -4727,7 +4725,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
4727
4725
|
return;
|
|
4728
4726
|
services.uiService.set("uiSelectMode", true);
|
|
4729
4727
|
uiSelectMode.value = true;
|
|
4730
|
-
globalThis.document.addEventListener(
|
|
4728
|
+
globalThis.document.addEventListener(UI_SELECT_MODE_EVENT_NAME, clickHandler);
|
|
4731
4729
|
};
|
|
4732
4730
|
const deleteHandler = () => {
|
|
4733
4731
|
if (props.model) {
|
|
@@ -6885,7 +6883,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
6885
6883
|
if (!nodeStatusMap?.value)
|
|
6886
6884
|
return;
|
|
6887
6885
|
if (uiService?.get("uiSelectMode")) {
|
|
6888
|
-
document.dispatchEvent(new CustomEvent(
|
|
6886
|
+
document.dispatchEvent(new CustomEvent(UI_SELECT_MODE_EVENT_NAME, { detail: props.data }));
|
|
6889
6887
|
return;
|
|
6890
6888
|
}
|
|
6891
6889
|
if (hasChilren.value && !props.isCtrlKeyDown) {
|
|
@@ -6899,7 +6897,10 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
6899
6897
|
};
|
|
6900
6898
|
const contextmenuHandler = (event) => {
|
|
6901
6899
|
event.preventDefault();
|
|
6902
|
-
|
|
6900
|
+
const nodes = editorService?.get("nodes") || [];
|
|
6901
|
+
if (nodes.length < 2 || !nodes.includes(props.data)) {
|
|
6902
|
+
nodeClickHandler();
|
|
6903
|
+
}
|
|
6903
6904
|
emit("node-contextmenu", event, props.data);
|
|
6904
6905
|
};
|
|
6905
6906
|
const nodeContentmenuHandler = (event, node) => {
|
|
@@ -7004,7 +7005,131 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
7004
7005
|
}
|
|
7005
7006
|
});
|
|
7006
7007
|
|
|
7007
|
-
|
|
7008
|
+
var KeyBindingContainerKey = /* @__PURE__ */ ((KeyBindingContainerKey2) => {
|
|
7009
|
+
KeyBindingContainerKey2["STAGE"] = "stage";
|
|
7010
|
+
KeyBindingContainerKey2["LAYER_PANEL"] = "layer-panel";
|
|
7011
|
+
return KeyBindingContainerKey2;
|
|
7012
|
+
})(KeyBindingContainerKey || {});
|
|
7013
|
+
const keybindingConfig = [
|
|
7014
|
+
{
|
|
7015
|
+
command: KeyBindingCommand.DELETE_NODE,
|
|
7016
|
+
keybinding: ["delete", "backspace"],
|
|
7017
|
+
when: [
|
|
7018
|
+
["stage" /* STAGE */, "keyup"],
|
|
7019
|
+
["layer-panel" /* LAYER_PANEL */, "keydown"]
|
|
7020
|
+
]
|
|
7021
|
+
},
|
|
7022
|
+
{
|
|
7023
|
+
command: KeyBindingCommand.COPY_NODE,
|
|
7024
|
+
keybinding: "ctrl+c",
|
|
7025
|
+
when: [
|
|
7026
|
+
["stage" /* STAGE */, "keydown"],
|
|
7027
|
+
["layer-panel" /* LAYER_PANEL */, "keydown"]
|
|
7028
|
+
]
|
|
7029
|
+
},
|
|
7030
|
+
{
|
|
7031
|
+
command: KeyBindingCommand.PASTE_NODE,
|
|
7032
|
+
keybinding: "ctrl+v",
|
|
7033
|
+
when: [
|
|
7034
|
+
["stage" /* STAGE */, "keydown"],
|
|
7035
|
+
["layer-panel" /* LAYER_PANEL */, "keydown"]
|
|
7036
|
+
]
|
|
7037
|
+
},
|
|
7038
|
+
{
|
|
7039
|
+
command: KeyBindingCommand.CUT_NODE,
|
|
7040
|
+
keybinding: "ctrl+x",
|
|
7041
|
+
when: [
|
|
7042
|
+
["stage" /* STAGE */, "keydown"],
|
|
7043
|
+
["layer-panel" /* LAYER_PANEL */, "keydown"]
|
|
7044
|
+
]
|
|
7045
|
+
},
|
|
7046
|
+
{
|
|
7047
|
+
command: KeyBindingCommand.UNDO,
|
|
7048
|
+
keybinding: "ctrl+z",
|
|
7049
|
+
when: [
|
|
7050
|
+
["stage" /* STAGE */, "keydown"],
|
|
7051
|
+
["layer-panel" /* LAYER_PANEL */, "keydown"]
|
|
7052
|
+
]
|
|
7053
|
+
},
|
|
7054
|
+
{
|
|
7055
|
+
command: KeyBindingCommand.REDO,
|
|
7056
|
+
keybinding: "ctrl+shift+z",
|
|
7057
|
+
when: [
|
|
7058
|
+
["stage" /* STAGE */, "keydown"],
|
|
7059
|
+
["layer-panel" /* LAYER_PANEL */, "keydown"]
|
|
7060
|
+
]
|
|
7061
|
+
},
|
|
7062
|
+
{
|
|
7063
|
+
command: KeyBindingCommand.MOVE_UP_1,
|
|
7064
|
+
keybinding: "up",
|
|
7065
|
+
when: [["stage" /* STAGE */, "keydown"]]
|
|
7066
|
+
},
|
|
7067
|
+
{
|
|
7068
|
+
command: KeyBindingCommand.MOVE_DOWN_1,
|
|
7069
|
+
keybinding: "down",
|
|
7070
|
+
when: [["stage" /* STAGE */, "keydown"]]
|
|
7071
|
+
},
|
|
7072
|
+
{
|
|
7073
|
+
command: KeyBindingCommand.MOVE_LEFT_1,
|
|
7074
|
+
keybinding: "left",
|
|
7075
|
+
when: [["stage" /* STAGE */, "keydown"]]
|
|
7076
|
+
},
|
|
7077
|
+
{
|
|
7078
|
+
command: KeyBindingCommand.MOVE_RIGHT_1,
|
|
7079
|
+
keybinding: "right",
|
|
7080
|
+
when: [["stage" /* STAGE */, "keydown"]]
|
|
7081
|
+
},
|
|
7082
|
+
{
|
|
7083
|
+
command: KeyBindingCommand.MOVE_UP_10,
|
|
7084
|
+
keybinding: "ctrl+up",
|
|
7085
|
+
when: [["stage" /* STAGE */, "keydown"]]
|
|
7086
|
+
},
|
|
7087
|
+
{
|
|
7088
|
+
command: KeyBindingCommand.MOVE_DOWN_10,
|
|
7089
|
+
keybinding: "ctrl+down",
|
|
7090
|
+
when: [["stage" /* STAGE */, "keydown"]]
|
|
7091
|
+
},
|
|
7092
|
+
{
|
|
7093
|
+
command: KeyBindingCommand.MOVE_LEFT_10,
|
|
7094
|
+
keybinding: "ctrl+left",
|
|
7095
|
+
when: [["stage" /* STAGE */, "keydown"]]
|
|
7096
|
+
},
|
|
7097
|
+
{
|
|
7098
|
+
command: KeyBindingCommand.MOVE_RIGHT_10,
|
|
7099
|
+
keybinding: "ctrl+right",
|
|
7100
|
+
when: [["stage" /* STAGE */, "keydown"]]
|
|
7101
|
+
},
|
|
7102
|
+
{
|
|
7103
|
+
command: KeyBindingCommand.SWITCH_NODE,
|
|
7104
|
+
keybinding: "tab",
|
|
7105
|
+
when: [
|
|
7106
|
+
["stage" /* STAGE */, "keydown"],
|
|
7107
|
+
["layer-panel" /* LAYER_PANEL */, "keydown"]
|
|
7108
|
+
]
|
|
7109
|
+
},
|
|
7110
|
+
{
|
|
7111
|
+
command: KeyBindingCommand.ZOOM_IN,
|
|
7112
|
+
keybinding: ["ctrl+=", "ctrl+numpadplus"],
|
|
7113
|
+
when: [["stage" /* STAGE */, "keydown"]]
|
|
7114
|
+
},
|
|
7115
|
+
{
|
|
7116
|
+
command: KeyBindingCommand.ZOOM_OUT,
|
|
7117
|
+
keybinding: ["ctrl+-", "ctrl+numpad-"],
|
|
7118
|
+
when: [["stage" /* STAGE */, "keydown"]]
|
|
7119
|
+
},
|
|
7120
|
+
{
|
|
7121
|
+
command: KeyBindingCommand.ZOOM_FIT,
|
|
7122
|
+
keybinding: "ctrl+0",
|
|
7123
|
+
when: [["stage" /* STAGE */, "keydown"]]
|
|
7124
|
+
},
|
|
7125
|
+
{
|
|
7126
|
+
command: KeyBindingCommand.ZOOM_RESET,
|
|
7127
|
+
keybinding: "ctrl+1",
|
|
7128
|
+
when: [["stage" /* STAGE */, "keydown"]]
|
|
7129
|
+
}
|
|
7130
|
+
];
|
|
7131
|
+
|
|
7132
|
+
const useKeybinding = (services, contianer) => {
|
|
7008
7133
|
const keybindingService = services?.keybindingService;
|
|
7009
7134
|
const isCtrlKeyDown = ref(false);
|
|
7010
7135
|
const windowBlurHandler = () => {
|
|
@@ -7028,11 +7153,14 @@ const useKeybinding = (services) => {
|
|
|
7028
7153
|
when: [["global", "keyup"]]
|
|
7029
7154
|
}
|
|
7030
7155
|
]);
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7156
|
+
watchEffect(() => {
|
|
7157
|
+
if (contianer.value) {
|
|
7158
|
+
globalThis.addEventListener("blur", windowBlurHandler);
|
|
7159
|
+
keybindingService?.registeEl(KeyBindingContainerKey.LAYER_PANEL, contianer.value);
|
|
7160
|
+
} else {
|
|
7161
|
+
globalThis.removeEventListener("blur", windowBlurHandler);
|
|
7162
|
+
keybindingService?.unregisteEl(KeyBindingContainerKey.LAYER_PANEL);
|
|
7163
|
+
}
|
|
7036
7164
|
});
|
|
7037
7165
|
return {
|
|
7038
7166
|
isCtrlKeyDown
|
|
@@ -7097,16 +7225,20 @@ const useNodeStatus = (services, page) => {
|
|
|
7097
7225
|
);
|
|
7098
7226
|
services?.editorService.on("add", (newNodes) => {
|
|
7099
7227
|
newNodes.forEach((node) => {
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7228
|
+
traverseNode(node, (node2) => {
|
|
7229
|
+
nodeStatusMap.value?.set(node2.id, {
|
|
7230
|
+
visible: true,
|
|
7231
|
+
expand: Array.isArray(node2.items),
|
|
7232
|
+
selected: true
|
|
7233
|
+
});
|
|
7104
7234
|
});
|
|
7105
7235
|
});
|
|
7106
7236
|
});
|
|
7107
7237
|
services?.editorService.on("remove", (nodes2) => {
|
|
7108
7238
|
nodes2.forEach((node) => {
|
|
7109
|
-
|
|
7239
|
+
traverseNode(node, (node2) => {
|
|
7240
|
+
nodeStatusMap.value?.delete(node2.id);
|
|
7241
|
+
});
|
|
7110
7242
|
});
|
|
7111
7243
|
});
|
|
7112
7244
|
return {
|
|
@@ -7126,10 +7258,11 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
7126
7258
|
setup(__props) {
|
|
7127
7259
|
const services = inject("services");
|
|
7128
7260
|
const editorService = services?.editorService;
|
|
7261
|
+
const layerTreeContainer = ref();
|
|
7129
7262
|
const page = computed(() => editorService?.get("page"));
|
|
7130
7263
|
const root = computed(() => editorService?.get("root"));
|
|
7131
7264
|
const { nodeStatusMap } = useNodeStatus(services, page);
|
|
7132
|
-
const { isCtrlKeyDown } = useKeybinding(services);
|
|
7265
|
+
const { isCtrlKeyDown } = useKeybinding(services, layerTreeContainer);
|
|
7133
7266
|
provide("nodeStatusMap", nodeStatusMap);
|
|
7134
7267
|
const { filterText, filterTextChangeHandler } = useFilter(nodeStatusMap, page);
|
|
7135
7268
|
const collapseAllHandler = () => {
|
|
@@ -7156,6 +7289,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
7156
7289
|
createVNode(_sfc_main$t, { onSearch: unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
|
|
7157
7290
|
createElementVNode("div", {
|
|
7158
7291
|
class: "magic-editor-layer-tree",
|
|
7292
|
+
ref_key: "layerTreeContainer",
|
|
7293
|
+
ref: layerTreeContainer,
|
|
7159
7294
|
tabindex: "-1",
|
|
7160
7295
|
onDragover: _cache[0] || (_cache[0] = //@ts-ignore
|
|
7161
7296
|
(...args) => unref(handleDragOver) && unref(handleDragOver)(...args))
|
|
@@ -7172,7 +7307,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
7172
7307
|
]),
|
|
7173
7308
|
_: 3
|
|
7174
7309
|
}, 8, ["data", "filter-text", "is-ctrl-key-down"])) : createCommentVNode("", true)
|
|
7175
|
-
],
|
|
7310
|
+
], 544),
|
|
7176
7311
|
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
7177
7312
|
createVNode(_sfc_main$j, {
|
|
7178
7313
|
ref_key: "menu",
|
|
@@ -7293,10 +7428,18 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
7293
7428
|
onDrag: dragHandler
|
|
7294
7429
|
}, [
|
|
7295
7430
|
renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
7296
|
-
createVNode(
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7431
|
+
createVNode(unref(TMagicTooltip), {
|
|
7432
|
+
placement: "right",
|
|
7433
|
+
disabled: !Boolean(item.desc),
|
|
7434
|
+
content: item.desc
|
|
7435
|
+
}, {
|
|
7436
|
+
default: withCtx(() => [
|
|
7437
|
+
createVNode(_sfc_main$M, {
|
|
7438
|
+
icon: item.icon
|
|
7439
|
+
}, null, 8, ["icon"])
|
|
7440
|
+
]),
|
|
7441
|
+
_: 2
|
|
7442
|
+
}, 1032, ["disabled", "content"]),
|
|
7300
7443
|
createElementVNode("span", {
|
|
7301
7444
|
title: item.text
|
|
7302
7445
|
}, toDisplayString(item.text), 9, _hoisted_2$7)
|
|
@@ -7907,7 +8050,7 @@ const useStage = (stageOptions) => {
|
|
|
7907
8050
|
canSelect: (el, event, stop) => {
|
|
7908
8051
|
const elCanSelect = stageOptions.canSelect(el);
|
|
7909
8052
|
if (uiSelectMode.value && elCanSelect && event.type === "mousedown") {
|
|
7910
|
-
document.dispatchEvent(new CustomEvent(
|
|
8053
|
+
document.dispatchEvent(new CustomEvent(UI_SELECT_MODE_EVENT_NAME, { detail: el }));
|
|
7911
8054
|
return stop();
|
|
7912
8055
|
}
|
|
7913
8056
|
return elCanSelect;
|
|
@@ -8512,7 +8655,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
8512
8655
|
onMounted(() => {
|
|
8513
8656
|
if (stageWrap.value?.container) {
|
|
8514
8657
|
resizeObserver.observe(stageWrap.value.container);
|
|
8515
|
-
services?.keybindingService.registeEl(
|
|
8658
|
+
services?.keybindingService.registeEl(KeyBindingContainerKey.STAGE, stageWrap.value.container);
|
|
8516
8659
|
}
|
|
8517
8660
|
});
|
|
8518
8661
|
onUnmounted(() => {
|
|
@@ -9584,125 +9727,6 @@ class Keybinding extends BaseService {
|
|
|
9584
9727
|
}
|
|
9585
9728
|
const keybindingService = new Keybinding();
|
|
9586
9729
|
|
|
9587
|
-
const keybindingConfig = [
|
|
9588
|
-
{
|
|
9589
|
-
command: KeyBindingCommand.DELETE_NODE,
|
|
9590
|
-
keybinding: ["delete", "backspace"],
|
|
9591
|
-
when: [
|
|
9592
|
-
["stage", "keyup"],
|
|
9593
|
-
["layer-panel", "keydown"]
|
|
9594
|
-
]
|
|
9595
|
-
},
|
|
9596
|
-
{
|
|
9597
|
-
command: KeyBindingCommand.COPY_NODE,
|
|
9598
|
-
keybinding: "ctrl+c",
|
|
9599
|
-
when: [
|
|
9600
|
-
["stage", "keydown"],
|
|
9601
|
-
["layer-panel", "keydown"]
|
|
9602
|
-
]
|
|
9603
|
-
},
|
|
9604
|
-
{
|
|
9605
|
-
command: KeyBindingCommand.PASTE_NODE,
|
|
9606
|
-
keybinding: "ctrl+v",
|
|
9607
|
-
when: [
|
|
9608
|
-
["stage", "keydown"],
|
|
9609
|
-
["layer-panel", "keydown"]
|
|
9610
|
-
]
|
|
9611
|
-
},
|
|
9612
|
-
{
|
|
9613
|
-
command: KeyBindingCommand.CUT_NODE,
|
|
9614
|
-
keybinding: "ctrl+x",
|
|
9615
|
-
when: [
|
|
9616
|
-
["stage", "keydown"],
|
|
9617
|
-
["layer-panel", "keydown"]
|
|
9618
|
-
]
|
|
9619
|
-
},
|
|
9620
|
-
{
|
|
9621
|
-
command: KeyBindingCommand.UNDO,
|
|
9622
|
-
keybinding: "ctrl+z",
|
|
9623
|
-
when: [
|
|
9624
|
-
["stage", "keydown"],
|
|
9625
|
-
["layer-panel", "keydown"]
|
|
9626
|
-
]
|
|
9627
|
-
},
|
|
9628
|
-
{
|
|
9629
|
-
command: KeyBindingCommand.REDO,
|
|
9630
|
-
keybinding: "ctrl+shift+z",
|
|
9631
|
-
when: [
|
|
9632
|
-
["stage", "keydown"],
|
|
9633
|
-
["layer-panel", "keydown"]
|
|
9634
|
-
]
|
|
9635
|
-
},
|
|
9636
|
-
{
|
|
9637
|
-
command: KeyBindingCommand.MOVE_UP_1,
|
|
9638
|
-
keybinding: "up",
|
|
9639
|
-
when: [["stage", "keydown"]]
|
|
9640
|
-
},
|
|
9641
|
-
{
|
|
9642
|
-
command: KeyBindingCommand.MOVE_DOWN_1,
|
|
9643
|
-
keybinding: "down",
|
|
9644
|
-
when: [["stage", "keydown"]]
|
|
9645
|
-
},
|
|
9646
|
-
{
|
|
9647
|
-
command: KeyBindingCommand.MOVE_LEFT_1,
|
|
9648
|
-
keybinding: "left",
|
|
9649
|
-
when: [["stage", "keydown"]]
|
|
9650
|
-
},
|
|
9651
|
-
{
|
|
9652
|
-
command: KeyBindingCommand.MOVE_RIGHT_1,
|
|
9653
|
-
keybinding: "right",
|
|
9654
|
-
when: [["stage", "keydown"]]
|
|
9655
|
-
},
|
|
9656
|
-
{
|
|
9657
|
-
command: KeyBindingCommand.MOVE_UP_10,
|
|
9658
|
-
keybinding: "ctrl+up",
|
|
9659
|
-
when: [["stage", "keydown"]]
|
|
9660
|
-
},
|
|
9661
|
-
{
|
|
9662
|
-
command: KeyBindingCommand.MOVE_DOWN_10,
|
|
9663
|
-
keybinding: "ctrl+down",
|
|
9664
|
-
when: [["stage", "keydown"]]
|
|
9665
|
-
},
|
|
9666
|
-
{
|
|
9667
|
-
command: KeyBindingCommand.MOVE_LEFT_10,
|
|
9668
|
-
keybinding: "ctrl+left",
|
|
9669
|
-
when: [["stage", "keydown"]]
|
|
9670
|
-
},
|
|
9671
|
-
{
|
|
9672
|
-
command: KeyBindingCommand.MOVE_RIGHT_10,
|
|
9673
|
-
keybinding: "ctrl+right",
|
|
9674
|
-
when: [["stage", "keydown"]]
|
|
9675
|
-
},
|
|
9676
|
-
{
|
|
9677
|
-
command: KeyBindingCommand.SWITCH_NODE,
|
|
9678
|
-
keybinding: "tab",
|
|
9679
|
-
when: [
|
|
9680
|
-
["stage", "keydown"],
|
|
9681
|
-
["layer-panel", "keydown"]
|
|
9682
|
-
]
|
|
9683
|
-
},
|
|
9684
|
-
{
|
|
9685
|
-
command: KeyBindingCommand.ZOOM_IN,
|
|
9686
|
-
keybinding: ["ctrl+=", "ctrl+numpadplus"],
|
|
9687
|
-
when: [["stage", "keydown"]]
|
|
9688
|
-
},
|
|
9689
|
-
{
|
|
9690
|
-
command: KeyBindingCommand.ZOOM_OUT,
|
|
9691
|
-
keybinding: ["ctrl+-", "ctrl+numpad-"],
|
|
9692
|
-
when: [["stage", "keydown"]]
|
|
9693
|
-
},
|
|
9694
|
-
{
|
|
9695
|
-
command: KeyBindingCommand.ZOOM_FIT,
|
|
9696
|
-
keybinding: "ctrl+0",
|
|
9697
|
-
when: [["stage", "keydown"]]
|
|
9698
|
-
},
|
|
9699
|
-
{
|
|
9700
|
-
command: KeyBindingCommand.ZOOM_RESET,
|
|
9701
|
-
keybinding: "ctrl+1",
|
|
9702
|
-
when: [["stage", "keydown"]]
|
|
9703
|
-
}
|
|
9704
|
-
];
|
|
9705
|
-
|
|
9706
9730
|
const defaultEditorProps = {
|
|
9707
9731
|
componentGroupList: () => [],
|
|
9708
9732
|
datasourceList: () => [],
|
|
@@ -10281,5 +10305,5 @@ const index = {
|
|
|
10281
10305
|
}
|
|
10282
10306
|
};
|
|
10283
10307
|
|
|
10284
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$O as CodeBlockEditor, _sfc_main$q as CodeBlockList, _sfc_main$p as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$P as CodeSelect, _sfc_main$L as CodeSelectCol, ColumnLayout, _sfc_main$f as ComponentListPanel, _sfc_main$l as ContentMenu, _sfc_main$J as DataSourceFieldSelect, _sfc_main$K as DataSourceFields, _sfc_main$I as DataSourceInput, _sfc_main$G as DataSourceMethodSelect, _sfc_main$H as DataSourceMethods, _sfc_main$F as DataSourceMocks, _sfc_main$E as DataSourceSelect, DepTargetType, DragType, _sfc_main$D as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$M as Icon, KeyBindingCommand, _sfc_main$C as KeyValue, Keys, LayerOffset, _sfc_main$g as LayerPanel, Layout, _sfc_main$z as LayoutContainer, _sfc_main$u as PropsPanel, _sfc_main$A as Resizer, _sfc_main$z as SplitView, _sfc_main$S as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$w as ToolButton, 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, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setConfig, setLayout, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useStage, warn };
|
|
10308
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$O as CodeBlockEditor, _sfc_main$q as CodeBlockList, _sfc_main$p as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$P as CodeSelect, _sfc_main$L as CodeSelectCol, ColumnLayout, _sfc_main$f as ComponentListPanel, _sfc_main$l as ContentMenu, _sfc_main$J as DataSourceFieldSelect, _sfc_main$K as DataSourceFields, _sfc_main$I as DataSourceInput, _sfc_main$G as DataSourceMethodSelect, _sfc_main$H as DataSourceMethods, _sfc_main$F as DataSourceMocks, _sfc_main$E as DataSourceSelect, DepTargetType, DragType, _sfc_main$D as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$M as Icon, KeyBindingCommand, _sfc_main$C as KeyValue, Keys, LayerOffset, _sfc_main$g as LayerPanel, Layout, _sfc_main$z as LayoutContainer, _sfc_main$u as PropsPanel, _sfc_main$A as Resizer, _sfc_main$z as SplitView, _sfc_main$S as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$w 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, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setConfig, setLayout, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useStage, warn };
|
|
10285
10309
|
//# sourceMappingURL=tmagic-editor.js.map
|