@tmagic/editor 1.2.0-beta.15 → 1.2.0-beta.17
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.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import Gesto from 'gesto';
|
|
|
10
10
|
import { isPop, getNodePath, isNumber, isPage, toLine, datetimeFormatter, removeClassNameByClassName } from '@tmagic/utils';
|
|
11
11
|
import { EventEmitter } from 'events';
|
|
12
12
|
import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
|
|
13
|
+
import { MForm } from '@tmagic/form';
|
|
13
14
|
import KeyController from 'keycon';
|
|
14
15
|
|
|
15
16
|
const __default__$t = defineComponent({
|
|
@@ -3108,7 +3109,9 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
3108
3109
|
const curFormConfig = ref([]);
|
|
3109
3110
|
const services = inject("services");
|
|
3110
3111
|
const node = computed(() => services?.editorService.get("node"));
|
|
3111
|
-
const propsPanelSize = computed(
|
|
3112
|
+
const propsPanelSize = computed(
|
|
3113
|
+
() => services?.uiService.get("propsPanelSize") || "small"
|
|
3114
|
+
);
|
|
3112
3115
|
const stage = computed(() => services?.editorService.get("stage"));
|
|
3113
3116
|
const init = async () => {
|
|
3114
3117
|
if (!node.value) {
|
|
@@ -3141,10 +3144,9 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
3141
3144
|
};
|
|
3142
3145
|
expose({ submit });
|
|
3143
3146
|
return (_ctx, _cache) => {
|
|
3144
|
-
const _component_m_form = resolveComponent("m-form");
|
|
3145
3147
|
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
3146
3148
|
renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3147
|
-
createVNode(
|
|
3149
|
+
createVNode(unref(MForm), {
|
|
3148
3150
|
ref_key: "configForm",
|
|
3149
3151
|
ref: configForm,
|
|
3150
3152
|
class: normalizeClass(`m-editor-props-panel ${unref(propsPanelSize)}`),
|
|
@@ -4356,35 +4358,27 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
4356
4358
|
await expandNodes();
|
|
4357
4359
|
setTreeKeyStatus();
|
|
4358
4360
|
});
|
|
4359
|
-
const layerPanel = ref();
|
|
4360
4361
|
const mouseenterHandler = () => {
|
|
4361
|
-
|
|
4362
|
+
tree.value?.$el.focus();
|
|
4362
4363
|
};
|
|
4363
4364
|
const mouseleaveHandler = () => {
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
isMultiSelectStatus.value = false;
|
|
4365
|
+
tree.value?.$el.blur();
|
|
4366
|
+
isMultiSelectStatus.value = false;
|
|
4367
4367
|
};
|
|
4368
4368
|
let keycon;
|
|
4369
4369
|
onMounted(() => {
|
|
4370
|
-
|
|
4371
|
-
layerPanel.value?.addEventListener("mouseleave", mouseleaveHandler);
|
|
4372
|
-
keycon = new KeyController(layerPanel.value);
|
|
4370
|
+
keycon = new KeyController(tree.value?.$el);
|
|
4373
4371
|
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
4374
4372
|
const ctrl = isMac ? "meta" : "ctrl";
|
|
4375
4373
|
keycon.keydown(ctrl, (e) => {
|
|
4376
4374
|
e.inputEvent.preventDefault();
|
|
4377
4375
|
isMultiSelectStatus.value = true;
|
|
4378
|
-
}).on("blur", () => {
|
|
4379
|
-
isMultiSelectStatus.value = false;
|
|
4380
4376
|
}).keyup(ctrl, (e) => {
|
|
4381
4377
|
e.inputEvent.preventDefault();
|
|
4382
4378
|
isMultiSelectStatus.value = false;
|
|
4383
4379
|
});
|
|
4384
4380
|
});
|
|
4385
4381
|
onUnmounted(() => {
|
|
4386
|
-
layerPanel.value?.removeEventListener("mouseenter", mouseenterHandler);
|
|
4387
|
-
layerPanel.value?.removeEventListener("mouseleave", mouseleaveHandler);
|
|
4388
4382
|
keycon.destroy();
|
|
4389
4383
|
});
|
|
4390
4384
|
const clicked = ref(false);
|
|
@@ -4441,79 +4435,77 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
4441
4435
|
menu.value?.show(event);
|
|
4442
4436
|
};
|
|
4443
4437
|
return (_ctx, _cache) => {
|
|
4444
|
-
return openBlock(),
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
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
|
-
], 512);
|
|
4438
|
+
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
|
|
4439
|
+
default: withCtx(() => [
|
|
4440
|
+
renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4441
|
+
createVNode(unref(TMagicInput), {
|
|
4442
|
+
modelValue: filterText.value,
|
|
4443
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
|
|
4444
|
+
class: "search-input",
|
|
4445
|
+
size: "small",
|
|
4446
|
+
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
4447
|
+
clearable: "",
|
|
4448
|
+
"prefix-icon": unref(Search),
|
|
4449
|
+
onChange: filterTextChangeHandler
|
|
4450
|
+
}, null, 8, ["modelValue", "prefix-icon"]),
|
|
4451
|
+
unref(values).length ? (openBlock(), createBlock(unref(TMagicTree), {
|
|
4452
|
+
key: 0,
|
|
4453
|
+
tabindex: "-1",
|
|
4454
|
+
class: "magic-editor-layer-tree",
|
|
4455
|
+
ref_key: "tree",
|
|
4456
|
+
ref: tree,
|
|
4457
|
+
"node-key": "id",
|
|
4458
|
+
"empty-text": "\u9875\u9762\u7A7A\u8361\u8361\u7684",
|
|
4459
|
+
draggable: "",
|
|
4460
|
+
"default-expanded-keys": unref(defaultExpandedKeys),
|
|
4461
|
+
load: loadItems,
|
|
4462
|
+
data: unref(values),
|
|
4463
|
+
"default-expand-all": true,
|
|
4464
|
+
"expand-on-click-node": false,
|
|
4465
|
+
"highlight-current": true,
|
|
4466
|
+
props: {
|
|
4467
|
+
children: "items"
|
|
4468
|
+
},
|
|
4469
|
+
"filter-node-method": filterNode,
|
|
4470
|
+
"allow-drop": allowDrop,
|
|
4471
|
+
"show-checkbox": isMultiSelectStatus.value || unref(selectedIds).length > 1,
|
|
4472
|
+
onNodeClick: clickHandler,
|
|
4473
|
+
onNodeContextmenu: contextmenu,
|
|
4474
|
+
onNodeDragEnd: handleDragEnd,
|
|
4475
|
+
onNodeCollapse: handleCollapse,
|
|
4476
|
+
onNodeExpand: handleExpand,
|
|
4477
|
+
onCheck: multiClickHandler,
|
|
4478
|
+
onMousedown: toggleClickFlag,
|
|
4479
|
+
onMouseup: toggleClickFlag,
|
|
4480
|
+
onMouseenter: mouseenterHandler,
|
|
4481
|
+
onMouseleave: mouseleaveHandler
|
|
4482
|
+
}, {
|
|
4483
|
+
default: withCtx(({ node, data }) => [
|
|
4484
|
+
createElementVNode("div", {
|
|
4485
|
+
id: data.id,
|
|
4486
|
+
class: normalizeClass(["cus-tree-node", { "cus-tree-node-hover": canHighlight(data) }]),
|
|
4487
|
+
onMouseenter: ($event) => unref(highlightHandler)(data)
|
|
4488
|
+
}, [
|
|
4489
|
+
renderSlot(_ctx.$slots, "layer-node-content", {
|
|
4490
|
+
node,
|
|
4491
|
+
data
|
|
4492
|
+
}, () => [
|
|
4493
|
+
createElementVNode("span", null, toDisplayString(`${data.name} (${data.id})`), 1)
|
|
4494
|
+
])
|
|
4495
|
+
], 42, _hoisted_1$4)
|
|
4496
|
+
]),
|
|
4497
|
+
_: 3
|
|
4498
|
+
}, 8, ["default-expanded-keys", "data", "show-checkbox"])) : createCommentVNode("", true),
|
|
4499
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
4500
|
+
createVNode(_sfc_main$b, {
|
|
4501
|
+
ref_key: "menu",
|
|
4502
|
+
ref: menu,
|
|
4503
|
+
"layer-content-menu": __props.layerContentMenu
|
|
4504
|
+
}, null, 8, ["layer-content-menu"])
|
|
4505
|
+
]))
|
|
4506
|
+
]),
|
|
4507
|
+
_: 3
|
|
4508
|
+
});
|
|
4517
4509
|
};
|
|
4518
4510
|
}
|
|
4519
4511
|
});
|