@tmagic/editor 1.2.0-beta.14 → 1.2.0-beta.16
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 +3 -4
- package/dist/tmagic-editor.mjs +89 -93
- package/dist/tmagic-editor.mjs.map +1 -1
- package/dist/tmagic-editor.umd.js +92 -97
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/package.json +9 -9
- package/src/layouts/PropsPanel.vue +8 -4
- package/src/layouts/sidebar/LayerPanel.vue +68 -76
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +1 -1
- package/src/services/codeBlock.ts +8 -6
- package/src/theme/code-block.scss +3 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('lodash-es'), require('@tmagic/schema'), require('@element-plus/icons-vue'), require('@tmagic/design'), require('monaco-editor'), require('@tmagic/stage'), require('gesto'), require('@tmagic/utils'), require('events'), require('@tmagic/core'), require('keycon')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'lodash-es', '@tmagic/schema', '@element-plus/icons-vue', '@tmagic/design', 'monaco-editor', '@tmagic/stage', 'gesto', '@tmagic/utils', 'events', '@tmagic/core', 'keycon'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.lodashEs, global.schema, global.iconsVue, global.design, global.monaco, global.StageCore, global.Gesto, global.utils, global.events, global.core, global.KeyController));
|
|
5
|
-
})(this, (function (exports, vue, serialize, lodashEs, schema, iconsVue, design, monaco, StageCore, Gesto, utils, events, core, KeyController) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('lodash-es'), require('@tmagic/schema'), require('@element-plus/icons-vue'), require('@tmagic/design'), require('monaco-editor'), require('@tmagic/stage'), require('gesto'), require('@tmagic/utils'), require('events'), require('@tmagic/core'), require('@tmagic/form'), require('keycon')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'lodash-es', '@tmagic/schema', '@element-plus/icons-vue', '@tmagic/design', 'monaco-editor', '@tmagic/stage', 'gesto', '@tmagic/utils', 'events', '@tmagic/core', '@tmagic/form', 'keycon'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.lodashEs, global.schema, global.iconsVue, global.design, global.monaco, global.StageCore, global.Gesto, global.utils, global.events, global.core, global.form, global.KeyController));
|
|
5
|
+
})(this, (function (exports, vue, serialize, lodashEs, schema, iconsVue, design, monaco, StageCore, Gesto, utils, events, core, form, KeyController) { 'use strict';
|
|
6
6
|
|
|
7
7
|
const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
|
8
8
|
|
|
@@ -928,11 +928,14 @@
|
|
|
928
928
|
}
|
|
929
929
|
async setCodeDslById(id, codeConfig) {
|
|
930
930
|
let codeDsl = await this.getCodeDsl();
|
|
931
|
+
const codeConfigProcessed = codeConfig;
|
|
932
|
+
if (codeConfig.content) {
|
|
933
|
+
codeConfigProcessed.content = eval(codeConfig.content);
|
|
934
|
+
}
|
|
931
935
|
if (!codeDsl) {
|
|
932
936
|
codeDsl = {
|
|
933
937
|
[id]: {
|
|
934
|
-
...
|
|
935
|
-
content: eval(codeConfig.content)
|
|
938
|
+
...codeConfigProcessed
|
|
936
939
|
}
|
|
937
940
|
};
|
|
938
941
|
} else {
|
|
@@ -941,8 +944,7 @@
|
|
|
941
944
|
...codeDsl,
|
|
942
945
|
[id]: {
|
|
943
946
|
...existContent,
|
|
944
|
-
...
|
|
945
|
-
content: eval(codeConfig.content)
|
|
947
|
+
...codeConfigProcessed
|
|
946
948
|
}
|
|
947
949
|
};
|
|
948
950
|
}
|
|
@@ -3124,7 +3126,9 @@
|
|
|
3124
3126
|
const curFormConfig = vue.ref([]);
|
|
3125
3127
|
const services = vue.inject("services");
|
|
3126
3128
|
const node = vue.computed(() => services?.editorService.get("node"));
|
|
3127
|
-
const propsPanelSize = vue.computed(
|
|
3129
|
+
const propsPanelSize = vue.computed(
|
|
3130
|
+
() => services?.uiService.get("propsPanelSize") || "small"
|
|
3131
|
+
);
|
|
3128
3132
|
const stage = vue.computed(() => services?.editorService.get("stage"));
|
|
3129
3133
|
const init = async () => {
|
|
3130
3134
|
if (!node.value) {
|
|
@@ -3157,19 +3161,19 @@
|
|
|
3157
3161
|
};
|
|
3158
3162
|
expose({ submit });
|
|
3159
3163
|
return (_ctx, _cache) => {
|
|
3160
|
-
const _component_m_form = vue.resolveComponent("m-form");
|
|
3161
3164
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
|
|
3162
3165
|
vue.renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3163
|
-
vue.
|
|
3166
|
+
(vue.openBlock(), vue.createBlock(vue.unref(form.MForm), {
|
|
3164
3167
|
ref_key: "configForm",
|
|
3165
3168
|
ref: configForm,
|
|
3169
|
+
key: vue.unref(node)?.type,
|
|
3166
3170
|
class: vue.normalizeClass(`m-editor-props-panel ${vue.unref(propsPanelSize)}`),
|
|
3167
3171
|
"popper-class": `m-editor-props-panel-popper ${vue.unref(propsPanelSize)}`,
|
|
3168
3172
|
size: vue.unref(propsPanelSize),
|
|
3169
3173
|
"init-values": values.value,
|
|
3170
3174
|
config: curFormConfig.value,
|
|
3171
3175
|
onChange: submit
|
|
3172
|
-
}, null, 8, ["class", "popper-class", "size", "init-values", "config"])
|
|
3176
|
+
}, null, 8, ["class", "popper-class", "size", "init-values", "config"]))
|
|
3173
3177
|
]);
|
|
3174
3178
|
};
|
|
3175
3179
|
}
|
|
@@ -3670,7 +3674,7 @@
|
|
|
3670
3674
|
}
|
|
3671
3675
|
const codeConfig = {
|
|
3672
3676
|
name: "\u4EE3\u7801\u5757",
|
|
3673
|
-
content: `() => {
|
|
3677
|
+
content: `({app, params}) => {
|
|
3674
3678
|
// place your code here
|
|
3675
3679
|
}`,
|
|
3676
3680
|
params: []
|
|
@@ -4372,35 +4376,27 @@
|
|
|
4372
4376
|
await expandNodes();
|
|
4373
4377
|
setTreeKeyStatus();
|
|
4374
4378
|
});
|
|
4375
|
-
const layerPanel = vue.ref();
|
|
4376
4379
|
const mouseenterHandler = () => {
|
|
4377
|
-
|
|
4380
|
+
tree.value?.$el.focus();
|
|
4378
4381
|
};
|
|
4379
4382
|
const mouseleaveHandler = () => {
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
isMultiSelectStatus.value = false;
|
|
4383
|
+
tree.value?.$el.blur();
|
|
4384
|
+
isMultiSelectStatus.value = false;
|
|
4383
4385
|
};
|
|
4384
4386
|
let keycon;
|
|
4385
4387
|
vue.onMounted(() => {
|
|
4386
|
-
|
|
4387
|
-
layerPanel.value?.addEventListener("mouseleave", mouseleaveHandler);
|
|
4388
|
-
keycon = new KeyController__default.default(layerPanel.value);
|
|
4388
|
+
keycon = new KeyController__default.default(tree.value?.$el);
|
|
4389
4389
|
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
4390
4390
|
const ctrl = isMac ? "meta" : "ctrl";
|
|
4391
4391
|
keycon.keydown(ctrl, (e) => {
|
|
4392
4392
|
e.inputEvent.preventDefault();
|
|
4393
4393
|
isMultiSelectStatus.value = true;
|
|
4394
|
-
}).on("blur", () => {
|
|
4395
|
-
isMultiSelectStatus.value = false;
|
|
4396
4394
|
}).keyup(ctrl, (e) => {
|
|
4397
4395
|
e.inputEvent.preventDefault();
|
|
4398
4396
|
isMultiSelectStatus.value = false;
|
|
4399
4397
|
});
|
|
4400
4398
|
});
|
|
4401
4399
|
vue.onUnmounted(() => {
|
|
4402
|
-
layerPanel.value?.removeEventListener("mouseenter", mouseenterHandler);
|
|
4403
|
-
layerPanel.value?.removeEventListener("mouseleave", mouseleaveHandler);
|
|
4404
4400
|
keycon.destroy();
|
|
4405
4401
|
});
|
|
4406
4402
|
const clicked = vue.ref(false);
|
|
@@ -4457,78 +4453,77 @@
|
|
|
4457
4453
|
menu.value?.show(event);
|
|
4458
4454
|
};
|
|
4459
4455
|
return (_ctx, _cache) => {
|
|
4460
|
-
return vue.openBlock(), vue.
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
"
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
], 512);
|
|
4456
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
|
|
4457
|
+
default: vue.withCtx(() => [
|
|
4458
|
+
vue.renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4459
|
+
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
4460
|
+
modelValue: filterText.value,
|
|
4461
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
|
|
4462
|
+
class: "search-input",
|
|
4463
|
+
size: "small",
|
|
4464
|
+
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
4465
|
+
clearable: "",
|
|
4466
|
+
"prefix-icon": vue.unref(iconsVue.Search),
|
|
4467
|
+
onChange: filterTextChangeHandler
|
|
4468
|
+
}, null, 8, ["modelValue", "prefix-icon"]),
|
|
4469
|
+
vue.unref(values).length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
|
|
4470
|
+
key: 0,
|
|
4471
|
+
tabindex: "-1",
|
|
4472
|
+
class: "magic-editor-layer-tree",
|
|
4473
|
+
ref_key: "tree",
|
|
4474
|
+
ref: tree,
|
|
4475
|
+
"node-key": "id",
|
|
4476
|
+
"empty-text": "\u9875\u9762\u7A7A\u8361\u8361\u7684",
|
|
4477
|
+
draggable: "",
|
|
4478
|
+
"default-expanded-keys": vue.unref(defaultExpandedKeys),
|
|
4479
|
+
load: loadItems,
|
|
4480
|
+
data: vue.unref(values),
|
|
4481
|
+
"default-expand-all": true,
|
|
4482
|
+
"expand-on-click-node": false,
|
|
4483
|
+
"highlight-current": true,
|
|
4484
|
+
props: {
|
|
4485
|
+
children: "items"
|
|
4486
|
+
},
|
|
4487
|
+
"filter-node-method": filterNode,
|
|
4488
|
+
"allow-drop": allowDrop,
|
|
4489
|
+
"show-checkbox": isMultiSelectStatus.value || vue.unref(selectedIds).length > 1,
|
|
4490
|
+
onNodeClick: clickHandler,
|
|
4491
|
+
onNodeContextmenu: contextmenu,
|
|
4492
|
+
onNodeDragEnd: handleDragEnd,
|
|
4493
|
+
onNodeCollapse: handleCollapse,
|
|
4494
|
+
onNodeExpand: handleExpand,
|
|
4495
|
+
onCheck: multiClickHandler,
|
|
4496
|
+
onMousedown: toggleClickFlag,
|
|
4497
|
+
onMouseup: toggleClickFlag,
|
|
4498
|
+
onMouseenter: mouseenterHandler,
|
|
4499
|
+
onMouseleave: mouseleaveHandler
|
|
4500
|
+
}, {
|
|
4501
|
+
default: vue.withCtx(({ node, data }) => [
|
|
4502
|
+
vue.createElementVNode("div", {
|
|
4503
|
+
id: data.id,
|
|
4504
|
+
class: vue.normalizeClass(["cus-tree-node", { "cus-tree-node-hover": canHighlight(data) }]),
|
|
4505
|
+
onMouseenter: ($event) => vue.unref(highlightHandler)(data)
|
|
4506
|
+
}, [
|
|
4507
|
+
vue.renderSlot(_ctx.$slots, "layer-node-content", {
|
|
4508
|
+
node,
|
|
4509
|
+
data
|
|
4510
|
+
}, () => [
|
|
4511
|
+
vue.createElementVNode("span", null, vue.toDisplayString(`${data.name} (${data.id})`), 1)
|
|
4512
|
+
])
|
|
4513
|
+
], 42, _hoisted_1$4)
|
|
4514
|
+
]),
|
|
4515
|
+
_: 3
|
|
4516
|
+
}, 8, ["default-expanded-keys", "data", "show-checkbox"])) : vue.createCommentVNode("", true),
|
|
4517
|
+
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
4518
|
+
vue.createVNode(_sfc_main$b, {
|
|
4519
|
+
ref_key: "menu",
|
|
4520
|
+
ref: menu,
|
|
4521
|
+
"layer-content-menu": __props.layerContentMenu
|
|
4522
|
+
}, null, 8, ["layer-content-menu"])
|
|
4523
|
+
]))
|
|
4524
|
+
]),
|
|
4525
|
+
_: 3
|
|
4526
|
+
});
|
|
4532
4527
|
};
|
|
4533
4528
|
}
|
|
4534
4529
|
});
|