@tmagic/editor 1.3.0-alpha.14 → 1.3.0-alpha.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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.0-alpha.14",
2
+ "version": "1.3.0-alpha.16",
3
3
  "name": "@tmagic/editor",
4
4
  "type": "module",
5
5
  "sideEffects": [
@@ -46,26 +46,26 @@
46
46
  "dependencies": {
47
47
  "@babel/core": "^7.18.0",
48
48
  "@element-plus/icons-vue": "^2.0.9",
49
- "@tmagic/core": "1.3.0-alpha.14",
50
- "@tmagic/design": "1.3.0-alpha.14",
51
- "@tmagic/form": "1.3.0-alpha.14",
52
- "@tmagic/schema": "1.3.0-alpha.14",
53
- "@tmagic/stage": "1.3.0-alpha.14",
54
- "@tmagic/table": "1.3.0-alpha.14",
55
- "@tmagic/utils": "1.3.0-alpha.14",
49
+ "@tmagic/core": "1.3.0-alpha.16",
50
+ "@tmagic/design": "1.3.0-alpha.16",
51
+ "@tmagic/form": "1.3.0-alpha.16",
52
+ "@tmagic/schema": "1.3.0-alpha.16",
53
+ "@tmagic/stage": "1.3.0-alpha.16",
54
+ "@tmagic/table": "1.3.0-alpha.16",
55
+ "@tmagic/utils": "1.3.0-alpha.16",
56
56
  "buffer": "^6.0.3",
57
57
  "color": "^3.1.3",
58
58
  "events": "^3.3.0",
59
- "gesto": "^1.7.0",
60
- "keycon": "^1.1.2",
59
+ "gesto": "^1.19.1",
60
+ "keycon": "^1.4.0",
61
61
  "lodash-es": "^4.17.21",
62
62
  "monaco-editor": "^0.39.0",
63
63
  "serialize-javascript": "^6.0.0",
64
64
  "vue": "^3.3.4"
65
65
  },
66
66
  "peerDependencies": {
67
- "@tmagic/design": "1.3.0-alpha.14",
68
- "@tmagic/form": "1.3.0-alpha.14",
67
+ "@tmagic/design": "1.3.0-alpha.16",
68
+ "@tmagic/form": "1.3.0-alpha.16",
69
69
  "monaco-editor": "^0.39.0",
70
70
  "vue": "^3.3.4"
71
71
  },
@@ -156,7 +156,7 @@ const handleDragEnd = async (e: any) => {
156
156
  if (!tree.value) return;
157
157
  const { data: node } = e;
158
158
  const parent = editorService?.getParentById(node.id, false) as MContainer;
159
- const layout = await editorService?.getLayout(parent);
159
+ const layout = await editorService?.getLayout(parent, node);
160
160
  node.style.position = layout;
161
161
  if (layout === Layout.RELATIVE) {
162
162
  node.style.top = 0;
@@ -10,12 +10,11 @@
10
10
  </slot>
11
11
 
12
12
  <!-- 代码块列表 -->
13
- <CodeBlockList
14
- ref="codeBlockList"
15
- :custom-error="customError"
16
- @edit="editCode"
17
- @remove="deleteCode"
18
- ></CodeBlockList>
13
+ <CodeBlockList ref="codeBlockList" :custom-error="customError" @edit="editCode" @remove="deleteCode">
14
+ <template #code-block-panel-tool="{ id, data }">
15
+ <slot name="code-block-panel-tool" :id="id" :data="data"></slot>
16
+ </template>
17
+ </CodeBlockList>
19
18
 
20
19
  <!-- 代码块编辑区 -->
21
20
  <CodeBlockEditor
@@ -19,7 +19,7 @@ import { EventEmitter } from 'events';
19
19
 
20
20
  import { reactive } from 'vue';
21
21
 
22
- import { MNode } from '@tmagic/schema';
22
+ import { Id, MNode } from '@tmagic/schema';
23
23
 
24
24
  type IsTarget = (key: string | number, value: any) => boolean;
25
25
 
@@ -277,13 +277,15 @@ export class Watcher extends EventEmitter {
277
277
  * @param nodes 需要清除依赖的节点
278
278
  */
279
279
  public clear(nodes?: MNode[]) {
280
+ const clearedItemsNodeIds: Id[] = [];
280
281
  Object.values(this.targets).forEach((targets) => {
281
282
  Object.values(targets).forEach((target) => {
282
283
  if (nodes) {
283
284
  nodes.forEach((node) => {
284
285
  target.removeDep(node);
285
286
 
286
- if (Array.isArray(node.items)) {
287
+ if (Array.isArray(node.items) && node.items.length && !clearedItemsNodeIds.includes(node.id)) {
288
+ clearedItemsNodeIds.push(node.id);
287
289
  this.clear(node.items);
288
290
  }
289
291
  });
@@ -193,7 +193,7 @@ class Editor extends BaseService {
193
193
  /**
194
194
  * 只有容器拥有布局
195
195
  */
196
- public async getLayout(parent: MNode, node?: MNode): Promise<Layout> {
196
+ public async getLayout(parent: MNode, node?: MNode | null): Promise<Layout> {
197
197
  if (node && typeof node !== 'function' && isFixed(node)) return Layout.FIXED;
198
198
 
199
199
  if (parent.layout) {
@@ -6,6 +6,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
6
6
  customError?: ((id: Id, errorType: CodeDeleteErrorType) => any) | undefined;
7
7
  }>>>, {}, {}>, {
8
8
  "code-block-panel-header"?(_: {}): any;
9
+ "code-block-panel-tool"?(_: {
10
+ id: any;
11
+ data: any;
12
+ }): any;
9
13
  }>;
10
14
  export default _default;
11
15
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -42,7 +42,7 @@ declare class Editor extends BaseService {
42
42
  /**
43
43
  * 只有容器拥有布局
44
44
  */
45
- getLayout(parent: MNode, node?: MNode): Promise<Layout>;
45
+ getLayout(parent: MNode, node?: MNode | null): Promise<Layout>;
46
46
  /**
47
47
  * 选中指定节点(将指定节点设置成当前选中状态)
48
48
  * @param config 指定节点配置或者ID