@tmagic/editor 1.3.8 → 1.3.9
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 +19 -9
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +19 -10
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +12 -11
- package/src/layouts/CodeEditor.vue +1 -1
- package/src/services/editor.ts +13 -5
- package/src/services/props.ts +9 -4
- package/src/utils/monaco-editor.ts +8 -0
- package/types/layouts/CodeEditor.vue.d.ts +1 -1
- package/types/utils/monaco-editor.d.ts +2 -0
package/dist/tmagic-editor.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { defineComponent, ref, watch, onMounted, onBeforeUnmount, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx, Fragment, resolveDynamicComponent, createTextVNode, createCommentVNode, toRaw, nextTick, mergeProps, toDisplayString, renderList, createStaticVNode, watchEffect, withModifiers, renderSlot, normalizeProps, resolveDirective, withDirectives, createSlots, markRaw, getCurrentInstance, vShow, provide, Transition, toHandlers, mergeDefaults } from 'vue';
|
|
2
2
|
import { FullScreen, Edit, View, Coin, Delete, Plus, Close, ArrowDown, ArrowLeftBold, ArrowRightBold, CaretBottom, DocumentCopy, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, ArrowRight, CopyDocument, Files, Hide, Goods, List, EditPen, Top, Bottom } from '@element-plus/icons-vue';
|
|
3
|
-
import { throttle, isEmpty, cloneDeep, mergeWith,
|
|
4
|
-
import * as monaco from 'monaco-editor';
|
|
3
|
+
import { throttle, isEmpty, cloneDeep, mergeWith, isObject, uniq, get, map, has, pick, keys } from 'lodash-es';
|
|
5
4
|
import serialize from 'serialize-javascript';
|
|
6
5
|
import { TMagicButton, TMagicCard, tMagicMessage, TMagicDialog, TMagicTag, tMagicMessageBox, TMagicIcon, getConfig as getConfig$1, TMagicSwitch, TMagicInput, TMagicTooltip, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicPopover, TMagicScrollbar, TMagicCollapse, TMagicCollapseItem } from '@tmagic/design';
|
|
6
|
+
import { emmetHTML, emmetCSS } from 'emmet-monaco-es';
|
|
7
|
+
import * as monaco from 'monaco-editor';
|
|
7
8
|
import { HookType, NodeType, ActionType } from '@tmagic/schema';
|
|
8
9
|
import { MFormBox, MFormDrawer, MForm, createValues, MSelect } from '@tmagic/form';
|
|
9
10
|
import { MagicTable } from '@tmagic/table';
|
|
10
|
-
import { guid, isPage, isPageFragment, isPop, getNodePath, isNumber, toLine, getDefaultValueFromFields, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, addClassName, removeClassName, removeClassNameByClassName, convertToNumber, getNodes } from '@tmagic/utils';
|
|
11
|
+
import { guid, isPage, isPageFragment, isPop, getNodePath, isNumber, toLine, getValueByKeyPath, setValueByKeyPath, getDefaultValueFromFields, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, addClassName, removeClassName, removeClassNameByClassName, convertToNumber, getNodes } from '@tmagic/utils';
|
|
11
12
|
import Gesto from 'gesto';
|
|
12
13
|
import Moveable from 'moveable';
|
|
13
14
|
import { Watcher, DepTargetType, createRelatedCompTarget, createCodeBlockTarget, createDataSourceTarget, createDataSourceMethodTarget, createDataSourceCondTarget } from '@tmagic/dep';
|
|
@@ -23,6 +24,9 @@ const setConfig = (option) => {
|
|
|
23
24
|
};
|
|
24
25
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
25
26
|
|
|
27
|
+
emmetHTML(monaco);
|
|
28
|
+
emmetCSS(monaco, ["css", "scss"]);
|
|
29
|
+
|
|
26
30
|
const _hoisted_1$t = {
|
|
27
31
|
class: /* @__PURE__ */ normalizeClass(`magic-code-editor`)
|
|
28
32
|
};
|
|
@@ -2253,11 +2257,11 @@ class Props extends BaseService {
|
|
|
2253
2257
|
if (!targetConfig)
|
|
2254
2258
|
return;
|
|
2255
2259
|
target.deps[config.id]?.keys?.forEach((fullKey) => {
|
|
2256
|
-
const relateOriginId =
|
|
2260
|
+
const relateOriginId = getValueByKeyPath(fullKey, config);
|
|
2257
2261
|
const relateTargetId = relateIdMap[relateOriginId];
|
|
2258
2262
|
if (!relateTargetId)
|
|
2259
2263
|
return;
|
|
2260
|
-
|
|
2264
|
+
setValueByKeyPath(fullKey, relateTargetId, targetConfig);
|
|
2261
2265
|
});
|
|
2262
2266
|
});
|
|
2263
2267
|
}
|
|
@@ -2897,14 +2901,19 @@ class Editor extends BaseService {
|
|
|
2897
2901
|
const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
|
|
2898
2902
|
const layout = await this.getLayout(parent, node);
|
|
2899
2903
|
const isRelative = layout === Layout.RELATIVE;
|
|
2900
|
-
|
|
2904
|
+
let offsetIndex;
|
|
2901
2905
|
if (offset === LayerOffset.TOP) {
|
|
2902
|
-
|
|
2906
|
+
offsetIndex = isRelative ? 0 : brothers.length;
|
|
2903
2907
|
} else if (offset === LayerOffset.BOTTOM) {
|
|
2904
|
-
|
|
2908
|
+
offsetIndex = isRelative ? brothers.length : 0;
|
|
2905
2909
|
} else {
|
|
2906
|
-
|
|
2910
|
+
offsetIndex = index + (isRelative ? -offset : offset);
|
|
2907
2911
|
}
|
|
2912
|
+
if (offsetIndex > 0 && offsetIndex > brothers.length || offsetIndex < 0) {
|
|
2913
|
+
return;
|
|
2914
|
+
}
|
|
2915
|
+
brothers.splice(index, 1);
|
|
2916
|
+
brothers.splice(offsetIndex, 0, node);
|
|
2908
2917
|
const grandparent = this.getParentById(parent.id);
|
|
2909
2918
|
this.get("stage")?.update({
|
|
2910
2919
|
config: cloneDeep(toRaw(parent)),
|
|
@@ -2913,6 +2922,7 @@ class Editor extends BaseService {
|
|
|
2913
2922
|
});
|
|
2914
2923
|
this.addModifiedNodeId(parent.id);
|
|
2915
2924
|
this.pushHistoryState();
|
|
2925
|
+
this.emit("move-layer", offset);
|
|
2916
2926
|
}
|
|
2917
2927
|
/**
|
|
2918
2928
|
* 移动到指定容器中
|