@tmagic/editor 1.0.0-rc.5 → 1.0.0-rc.6
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/coverage/clover.xml +189 -167
- package/coverage/coverage-final.json +6 -6
- package/coverage/lcov-report/index.html +42 -42
- package/coverage/lcov-report/src/Editor.vue.html +48 -9
- package/coverage/lcov-report/src/components/ContentMenu.vue.html +135 -36
- package/coverage/lcov-report/src/components/Icon.vue.html +1 -1
- package/coverage/lcov-report/src/components/ScrollViewer.vue.html +1 -1
- package/coverage/lcov-report/src/components/ToolButton.vue.html +1 -1
- package/coverage/lcov-report/src/components/index.html +18 -18
- package/coverage/lcov-report/src/index.html +15 -15
- package/coverage/lcov-report/src/layouts/AddPageBox.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/Framework.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/NavMenu.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/PropsPanel.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/Resizer.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/index.html +1 -1
- package/coverage/lcov-report/src/layouts/sidebar/ComponentListPanel.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/sidebar/LayerMenu.vue.html +15 -6
- package/coverage/lcov-report/src/layouts/sidebar/LayerPanel.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/sidebar/Sidebar.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/sidebar/TabPane.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/sidebar/index.html +11 -11
- package/coverage/lcov-report/src/layouts/workspace/PageBar.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/workspace/Stage.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/workspace/ViewerMenu.vue.html +15 -6
- package/coverage/lcov-report/src/layouts/workspace/Workspace.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/workspace/index.html +11 -11
- package/coverage/lcov-report/src/services/BaseService.ts.html +1 -1
- package/coverage/lcov-report/src/services/componentList.ts.html +1 -1
- package/coverage/lcov-report/src/services/editor.ts.html +3 -3
- package/coverage/lcov-report/src/services/events.ts.html +1 -1
- package/coverage/lcov-report/src/services/history.ts.html +1 -1
- package/coverage/lcov-report/src/services/index.html +1 -1
- package/coverage/lcov-report/src/services/props.ts.html +4 -4
- package/coverage/lcov-report/src/services/ui.ts.html +1 -1
- package/coverage/lcov-report/src/type.ts.html +1 -1
- package/coverage/lcov-report/src/utils/compose.ts.html +1 -1
- package/coverage/lcov-report/src/utils/config.ts.html +1 -1
- package/coverage/lcov-report/src/utils/editor.ts.html +21 -9
- package/coverage/lcov-report/src/utils/index.html +12 -12
- package/coverage/lcov-report/src/utils/index.ts.html +1 -1
- package/coverage/lcov-report/src/utils/logger.ts.html +1 -1
- package/coverage/lcov-report/src/utils/props.ts.html +1 -1
- package/coverage/lcov-report/src/utils/scroll-viewer.ts.html +1 -1
- package/coverage/lcov-report/src/utils/undo-redo.ts.html +1 -1
- package/coverage/lcov.info +495 -448
- package/dist/tmagic-editor.es.js +68 -28
- package/dist/tmagic-editor.es.js.map +1 -1
- package/dist/tmagic-editor.umd.js +69 -29
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/dist/types/src/Editor.vue.d.ts +19 -1
- package/package.json +7 -7
- package/src/Editor.vue +14 -1
- package/src/components/ContentMenu.vue +58 -25
- package/src/layouts/sidebar/LayerMenu.vue +3 -0
- package/src/layouts/workspace/ViewerMenu.vue +3 -0
- package/src/services/editor.ts +2 -2
- package/src/services/props.ts +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('@element-plus/icons'), require('lodash-es'), require('monaco-editor'), require('@tmagic/schema'), require('@tmagic/utils'), require('events'), require('@tmagic/core'), require('gesto'), require('element-plus'), require('keycon'), require('@tmagic/stage')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', '@element-plus/icons', 'lodash-es', 'monaco-editor', '@tmagic/schema', '@tmagic/utils', 'events', '@tmagic/core', 'gesto', 'element-plus', 'keycon', '@tmagic/stage'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.icons, global.lodashEs, global.monaco, global.schema, global.utils, global.events, global.core, global.Gesto, global.ElementPlus, global.KeyController, global.StageCore));
|
|
5
5
|
})(this, (function (exports, vue, serialize, icons, lodashEs, monaco, schema, utils, events, core, Gesto, elementPlus, KeyController, StageCore) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -684,10 +684,10 @@
|
|
|
684
684
|
}
|
|
685
685
|
return value;
|
|
686
686
|
}
|
|
687
|
-
return
|
|
687
|
+
return {
|
|
688
688
|
...getDefaultPropsValue(type),
|
|
689
|
-
...lodashEs.mergeWith(this.state.propsValueMap[type] || {}, defaultValue)
|
|
690
|
-
}
|
|
689
|
+
...lodashEs.mergeWith(lodashEs.cloneDeep(this.state.propsValueMap[type] || {}), lodashEs.cloneDeep(defaultValue))
|
|
690
|
+
};
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
693
|
var propsService = new Props();
|
|
@@ -1197,9 +1197,9 @@
|
|
|
1197
1197
|
const node = this.get("node");
|
|
1198
1198
|
const brothers = parent?.items || [];
|
|
1199
1199
|
const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
|
|
1200
|
-
if (offset === LayerOffset.
|
|
1200
|
+
if (offset === LayerOffset.TOP) {
|
|
1201
1201
|
brothers.splice(brothers.length - 1, 0, brothers.splice(index, 1)[0]);
|
|
1202
|
-
} else if (offset === LayerOffset.
|
|
1202
|
+
} else if (offset === LayerOffset.BOTTOM) {
|
|
1203
1203
|
brothers.splice(0, 0, brothers.splice(index, 1)[0]);
|
|
1204
1204
|
} else {
|
|
1205
1205
|
brothers.splice(index + parseInt(`${offset}`, 10), 0, brothers.splice(index, 1)[0]);
|
|
@@ -2267,9 +2267,14 @@
|
|
|
2267
2267
|
menuData: {
|
|
2268
2268
|
type: Array,
|
|
2269
2269
|
default: () => []
|
|
2270
|
+
},
|
|
2271
|
+
isSubMenu: {
|
|
2272
|
+
type: Boolean,
|
|
2273
|
+
default: false
|
|
2270
2274
|
}
|
|
2271
2275
|
},
|
|
2272
|
-
|
|
2276
|
+
emits: ["hide", "show"],
|
|
2277
|
+
setup(props, { emit }) {
|
|
2273
2278
|
const menu = vue.ref();
|
|
2274
2279
|
const subMenu = vue.ref();
|
|
2275
2280
|
const visible = vue.ref(false);
|
|
@@ -2279,15 +2284,31 @@
|
|
|
2279
2284
|
top: "0"
|
|
2280
2285
|
});
|
|
2281
2286
|
const hide = () => {
|
|
2287
|
+
if (!visible.value)
|
|
2288
|
+
return;
|
|
2282
2289
|
visible.value = false;
|
|
2290
|
+
subMenu.value?.hide();
|
|
2291
|
+
emit("hide");
|
|
2292
|
+
};
|
|
2293
|
+
const hideHandler = (e) => {
|
|
2294
|
+
const target = e.target;
|
|
2295
|
+
if (!visible.value || !target) {
|
|
2296
|
+
return;
|
|
2297
|
+
}
|
|
2298
|
+
if (menu.value?.contains(target) || subMenu.value?.$el?.contains(target)) {
|
|
2299
|
+
return;
|
|
2300
|
+
}
|
|
2301
|
+
hide();
|
|
2283
2302
|
};
|
|
2284
2303
|
vue.onMounted(() => {
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2304
|
+
if (props.isSubMenu)
|
|
2305
|
+
return;
|
|
2306
|
+
globalThis.addEventListener("mousedown", hideHandler, true);
|
|
2307
|
+
});
|
|
2308
|
+
vue.onUnmounted(() => {
|
|
2309
|
+
if (props.isSubMenu)
|
|
2310
|
+
return;
|
|
2311
|
+
globalThis.removeEventListener("mousedown", hideHandler, true);
|
|
2291
2312
|
});
|
|
2292
2313
|
return {
|
|
2293
2314
|
menu,
|
|
@@ -2297,18 +2318,21 @@
|
|
|
2297
2318
|
subMenuData,
|
|
2298
2319
|
hide,
|
|
2299
2320
|
show(e) {
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2321
|
+
setTimeout(() => {
|
|
2322
|
+
visible.value = true;
|
|
2323
|
+
vue.nextTick(() => {
|
|
2324
|
+
const menuHeight = menu.value?.clientHeight || 0;
|
|
2325
|
+
let top = e.clientY;
|
|
2326
|
+
if (menuHeight + e.clientY > document.body.clientHeight) {
|
|
2327
|
+
top = document.body.clientHeight - menuHeight;
|
|
2328
|
+
}
|
|
2329
|
+
menuStyle.value = {
|
|
2330
|
+
top: `${top}px`,
|
|
2331
|
+
left: `${e.clientX}px`
|
|
2332
|
+
};
|
|
2333
|
+
emit("show");
|
|
2334
|
+
});
|
|
2335
|
+
}, 300);
|
|
2312
2336
|
},
|
|
2313
2337
|
showSubMenu(item) {
|
|
2314
2338
|
const menuItem = item;
|
|
@@ -2350,8 +2374,10 @@
|
|
|
2350
2374
|
vue.createVNode(_component_content_menu, {
|
|
2351
2375
|
class: "sub-menu",
|
|
2352
2376
|
ref: "subMenu",
|
|
2353
|
-
"menu-data": _ctx.subMenuData
|
|
2354
|
-
|
|
2377
|
+
"menu-data": _ctx.subMenuData,
|
|
2378
|
+
"is-sub-menu": true,
|
|
2379
|
+
onHide: _ctx.hide
|
|
2380
|
+
}, null, 8, ["menu-data", "onHide"])
|
|
2355
2381
|
]))
|
|
2356
2382
|
], 4)) : vue.createCommentVNode("", true);
|
|
2357
2383
|
}
|
|
@@ -2366,6 +2392,7 @@
|
|
|
2366
2392
|
const isRoot = vue.computed(() => node.value?.type === schema.NodeType.ROOT);
|
|
2367
2393
|
const isPage = vue.computed(() => node.value?.type === schema.NodeType.PAGE);
|
|
2368
2394
|
const componentList = vue.computed(() => services?.componentListService.getList() || []);
|
|
2395
|
+
const layerContentMenu = vue.inject("layerContentMenu", []);
|
|
2369
2396
|
const createMenuItems = (group) => group.items.map((component) => ({
|
|
2370
2397
|
text: component.text,
|
|
2371
2398
|
type: "button",
|
|
@@ -2430,7 +2457,8 @@
|
|
|
2430
2457
|
handler: () => {
|
|
2431
2458
|
node.value && services?.editorService.remove(node.value);
|
|
2432
2459
|
}
|
|
2433
|
-
}
|
|
2460
|
+
},
|
|
2461
|
+
...layerContentMenu
|
|
2434
2462
|
]),
|
|
2435
2463
|
show(e) {
|
|
2436
2464
|
menu.value?.show(e);
|
|
@@ -3221,6 +3249,7 @@
|
|
|
3221
3249
|
const node = vue.computed(() => editorService?.get("node"));
|
|
3222
3250
|
const parent = vue.computed(() => editorService?.get("parent"));
|
|
3223
3251
|
const isPage = vue.computed(() => node.value?.type === schema.NodeType.PAGE);
|
|
3252
|
+
const stageContentMenu = vue.inject("stageContentMenu", []);
|
|
3224
3253
|
vue.onMounted(() => {
|
|
3225
3254
|
const data = globalThis.localStorage.getItem(COPY_STORAGE_KEY);
|
|
3226
3255
|
canPaste.value = data !== "undefined" && !!data;
|
|
@@ -3333,7 +3362,8 @@
|
|
|
3333
3362
|
handler: () => {
|
|
3334
3363
|
editorService?.get("stage").clearGuides();
|
|
3335
3364
|
}
|
|
3336
|
-
}
|
|
3365
|
+
},
|
|
3366
|
+
...stageContentMenu
|
|
3337
3367
|
]),
|
|
3338
3368
|
show(e) {
|
|
3339
3369
|
menu.value?.show(e);
|
|
@@ -3831,6 +3861,14 @@
|
|
|
3831
3861
|
sidebar: {
|
|
3832
3862
|
type: Object
|
|
3833
3863
|
},
|
|
3864
|
+
layerContentMenu: {
|
|
3865
|
+
type: Array,
|
|
3866
|
+
default: () => []
|
|
3867
|
+
},
|
|
3868
|
+
stageContentMenu: {
|
|
3869
|
+
type: Array,
|
|
3870
|
+
default: () => []
|
|
3871
|
+
},
|
|
3834
3872
|
menu: {
|
|
3835
3873
|
type: Object,
|
|
3836
3874
|
default: () => ({ left: [], right: [] })
|
|
@@ -3916,6 +3954,8 @@
|
|
|
3916
3954
|
uiService
|
|
3917
3955
|
};
|
|
3918
3956
|
vue.provide("services", services);
|
|
3957
|
+
vue.provide("layerContentMenu", props.layerContentMenu);
|
|
3958
|
+
vue.provide("stageContentMenu", props.stageContentMenu);
|
|
3919
3959
|
return services;
|
|
3920
3960
|
}
|
|
3921
3961
|
});
|