@tmagic/editor 1.2.13 → 1.2.15

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.
Files changed (97) hide show
  1. package/dist/style.css +161 -69
  2. package/dist/tmagic-editor.js +784 -419
  3. package/dist/tmagic-editor.js.map +1 -1
  4. package/dist/tmagic-editor.umd.cjs +802 -444
  5. package/dist/tmagic-editor.umd.cjs.map +1 -1
  6. package/package.json +14 -13
  7. package/src/components/CodeDraftEditor.vue +20 -17
  8. package/src/components/ContentMenu.vue +1 -1
  9. package/src/components/FunctionEditor.vue +10 -10
  10. package/src/components/Layout.vue +1 -1
  11. package/src/components/ScrollViewer.vue +2 -2
  12. package/src/components/SearchInput.vue +6 -3
  13. package/src/fields/CodeSelect.vue +18 -101
  14. package/src/fields/CodeSelectCol.vue +21 -3
  15. package/src/fields/EventSelect.vue +5 -3
  16. package/src/fields/UISelect.vue +1 -1
  17. package/src/icons/AppManageIcon.vue +11 -0
  18. package/src/icons/CodeIcon.vue +26 -0
  19. package/src/layouts/AddPageBox.vue +3 -3
  20. package/src/layouts/Framework.vue +4 -4
  21. package/src/layouts/NavMenu.vue +2 -2
  22. package/src/layouts/PropsPanel.vue +1 -1
  23. package/src/layouts/sidebar/ComponentListPanel.vue +3 -3
  24. package/src/layouts/sidebar/LayerMenu.vue +2 -2
  25. package/src/layouts/sidebar/LayerPanel.vue +4 -4
  26. package/src/layouts/sidebar/Sidebar.vue +13 -12
  27. package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +15 -6
  28. package/src/layouts/sidebar/code-block/CodeBlockList.vue +28 -15
  29. package/src/layouts/workspace/Breadcrumb.vue +1 -1
  30. package/src/layouts/workspace/PageBar.vue +2 -2
  31. package/src/layouts/workspace/PageBarScrollContainer.vue +3 -3
  32. package/src/layouts/workspace/Stage.vue +3 -3
  33. package/src/layouts/workspace/ViewerMenu.vue +4 -4
  34. package/src/layouts/workspace/Workspace.vue +1 -1
  35. package/src/services/BaseService.ts +1 -1
  36. package/src/services/codeBlock.ts +3 -3
  37. package/src/services/componentList.ts +1 -1
  38. package/src/services/editor.ts +6 -6
  39. package/src/services/events.ts +1 -1
  40. package/src/services/history.ts +2 -2
  41. package/src/services/props.ts +4 -17
  42. package/src/services/ui.ts +2 -2
  43. package/src/theme/code-block.scss +11 -49
  44. package/src/theme/dep-list.scss +59 -0
  45. package/src/theme/event.scss +12 -0
  46. package/src/theme/sidebar.scss +26 -6
  47. package/src/theme/theme.scss +1 -0
  48. package/src/utils/config.ts +1 -1
  49. package/src/utils/dep.ts +2 -2
  50. package/src/utils/editor.ts +1 -1
  51. package/src/utils/operator.ts +4 -4
  52. package/src/utils/stage.ts +3 -3
  53. package/tsconfig.build.json +4 -1
  54. package/types/components/CodeDraftEditor.vue.d.ts +7 -4
  55. package/types/components/ContentMenu.vue.d.ts +3 -3
  56. package/types/components/FunctionEditor.vue.d.ts +140 -8
  57. package/types/components/Icon.vue.d.ts +2 -2
  58. package/types/components/Layout.vue.d.ts +28 -113
  59. package/types/components/ScrollBar.vue.d.ts +2 -2
  60. package/types/components/ScrollViewer.vue.d.ts +32 -135
  61. package/types/components/ToolButton.vue.d.ts +3 -3
  62. package/types/fields/Code.vue.d.ts +2 -2
  63. package/types/fields/CodeLink.vue.d.ts +2 -2
  64. package/types/fields/CodeSelect.vue.d.ts +8 -27
  65. package/types/fields/CodeSelectCol.vue.d.ts +3 -3
  66. package/types/fields/EventSelect.vue.d.ts +3 -3
  67. package/types/fields/UISelect.vue.d.ts +2 -2
  68. package/types/icons/AppManageIcon.vue.d.ts +2 -0
  69. package/types/icons/CodeIcon.vue.d.ts +2 -0
  70. package/types/layouts/CodeEditor.vue.d.ts +4 -4
  71. package/types/layouts/Framework.vue.d.ts +23 -74
  72. package/types/layouts/NavMenu.vue.d.ts +3 -3
  73. package/types/layouts/PropsPanel.vue.d.ts +11 -60
  74. package/types/layouts/Resizer.vue.d.ts +9 -54
  75. package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +11 -50
  76. package/types/layouts/sidebar/LayerMenu.vue.d.ts +2 -2
  77. package/types/layouts/sidebar/LayerPanel.vue.d.ts +17 -60
  78. package/types/layouts/sidebar/Sidebar.vue.d.ts +39 -104
  79. package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +15 -58
  80. package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +21 -66
  81. package/types/layouts/workspace/PageBar.vue.d.ts +13 -52
  82. package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +8 -48
  83. package/types/layouts/workspace/Stage.vue.d.ts +2 -2
  84. package/types/layouts/workspace/ViewerMenu.vue.d.ts +3 -3
  85. package/types/layouts/workspace/Workspace.vue.d.ts +20 -63
  86. package/types/services/codeBlock.d.ts +1 -1
  87. package/types/services/componentList.d.ts +1 -1
  88. package/types/services/dep.d.ts +2 -2
  89. package/types/services/editor.d.ts +1 -1
  90. package/types/services/events.d.ts +1 -1
  91. package/types/services/history.d.ts +2 -2
  92. package/types/services/props.d.ts +90 -7
  93. package/types/services/storage.d.ts +1 -1
  94. package/types/services/ui.d.ts +2 -2
  95. package/types/type.d.ts +8 -8
  96. package/types/utils/operator.d.ts +1 -1
  97. package/types/utils/props.d.ts +78 -1
@@ -1,16 +1,16 @@
1
1
  <template>
2
- <TMagicTabs
2
+ <component
3
3
  v-if="data.type === 'tabs' && data.items.length"
4
- class="m-editor-sidebar"
5
4
  v-model="activeTabName"
6
- type="card"
7
- tab-position="left"
5
+ class="m-editor-sidebar tmagic-design-tabs"
6
+ v-bind="tabsComponent.props({ type: 'card', tabPosition: 'left' })"
7
+ :is="tabsComponent.component"
8
8
  >
9
9
  <component
10
- :is="uiComponent.component"
11
10
  v-for="(config, index) in sideBarItems"
11
+ v-bind="tabPaneComponent.props({ name: config.text })"
12
+ :is="tabPaneComponent.component"
12
13
  :key="config.$key || index"
13
- :name="config.text"
14
14
  >
15
15
  <template #label>
16
16
  <div :key="config.text">
@@ -80,18 +80,18 @@
80
80
  </template>
81
81
  </component>
82
82
  </component>
83
- </TMagicTabs>
83
+ </component>
84
84
  </template>
85
85
 
86
86
  <script lang="ts" setup name="MEditorSidebar">
87
87
  import { computed, ref, watch } from 'vue';
88
88
  import { Coin, EditPen, Files } from '@element-plus/icons-vue';
89
89
 
90
- import { getConfig, TMagicTabs } from '@tmagic/design';
90
+ import { getConfig } from '@tmagic/design';
91
91
 
92
- import MIcon from '../../components/Icon.vue';
93
- import type { MenuButton, MenuComponent, SideComponent, SideItem } from '../../type';
94
- import { SideBarData } from '../../type';
92
+ import MIcon from '@editor/components/Icon.vue';
93
+ import type { MenuButton, MenuComponent, SideComponent, SideItem } from '@editor/type';
94
+ import { SideBarData } from '@editor/type';
95
95
 
96
96
  import CodeBlockList from './code-block/CodeBlockList.vue';
97
97
  import ComponentListPanel from './ComponentListPanel.vue';
@@ -107,7 +107,8 @@ const props = withDefaults(
107
107
  },
108
108
  );
109
109
 
110
- const uiComponent = getConfig('components').tabPane;
110
+ const tabPaneComponent = getConfig('components').tabPane;
111
+ const tabsComponent = getConfig('components').tabs;
111
112
 
112
113
  const activeTabName = ref(props.data?.status);
113
114
 
@@ -3,11 +3,12 @@
3
3
  class="code-editor-dialog"
4
4
  :model-value="true"
5
5
  :title="currentTitle"
6
- :close-on-press-escape="false"
6
+ :close-on-press-escape="true"
7
7
  :append-to-body="true"
8
8
  :show-close="false"
9
- :close-on-click-modal="false"
9
+ :close-on-click-modal="true"
10
10
  :size="size"
11
+ :before-close="handleClose"
11
12
  >
12
13
  <Layout v-model:left="left" :min-left="45" class="code-editor-layout">
13
14
  <!-- 右侧区域 -->
@@ -15,6 +16,7 @@
15
16
  <div v-if="!isEmpty(codeConfig)" class="m-editor-code-block-editor-panel">
16
17
  <slot name="code-block-edit-panel-header" :id="id"></slot>
17
18
  <FunctionEditor
19
+ ref="functionEditor"
18
20
  v-if="codeConfig"
19
21
  :id="id"
20
22
  :name="codeConfig.name"
@@ -38,10 +40,10 @@ import { TMagicDrawer } from '@tmagic/design';
38
40
  import { ColumnConfig } from '@tmagic/form';
39
41
  import { CodeBlockContent } from '@tmagic/schema';
40
42
 
41
- import FunctionEditor from '../../../components/FunctionEditor.vue';
42
- import Layout from '../../../components/Layout.vue';
43
- import type { ListState, Services } from '../../../type';
44
- import { serializeConfig } from '../../../utils/editor';
43
+ import FunctionEditor from '@editor/components/FunctionEditor.vue';
44
+ import Layout from '@editor/components/Layout.vue';
45
+ import type { ListState, Services } from '@editor/type';
46
+ import { serializeConfig } from '@editor/utils/editor';
45
47
 
46
48
  const services = inject<Services>('services');
47
49
  const codeOptions = inject('codeOptions', {});
@@ -84,4 +86,11 @@ watchEffect(async () => {
84
86
  });
85
87
  currentTitle.value = state.codeList[0]?.name || '';
86
88
  });
89
+
90
+ const functionEditor = ref<InstanceType<typeof FunctionEditor>>();
91
+
92
+ const handleClose = async () => {
93
+ // 触发codeDraftEditor组件关闭事件
94
+ await functionEditor.value?.codeDraftEditor?.close();
95
+ };
87
96
  </script>
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <TMagicScrollbar class="m-editor-code-block-list">
2
+ <TMagicScrollbar class="m-editor-code-block-list m-editor-dep-list-panel">
3
3
  <slot name="code-block-panel-header">
4
- <div class="code-header-wrapper">
4
+ <div class="search-wrapper">
5
5
  <SearchInput @search="filterTextChangeHandler"></SearchInput>
6
6
  <TMagicButton class="create-code-button" type="primary" size="small" @click="createCodeBlock" v-if="editable"
7
7
  >新增</TMagicButton
@@ -15,7 +15,7 @@
15
15
  class="magic-editor-layer-tree"
16
16
  node-key="id"
17
17
  empty-text="暂无代码块"
18
- default-expand-all
18
+ :default-expanded-keys="expandedKeys"
19
19
  :expand-on-click-node="false"
20
20
  :data="codeList"
21
21
  :highlight-current="true"
@@ -25,7 +25,11 @@
25
25
  <template #default="{ data }">
26
26
  <div :id="data.id" class="list-container">
27
27
  <div class="list-item">
28
- <span class="code-name">{{ data.name }}({{ data.id }})</span>
28
+ <CodeIcon v-if="data.type === 'code'" class="codeIcon"></CodeIcon>
29
+ <AppManageIcon v-if="data.type === 'node'" class="compIcon"></AppManageIcon>
30
+ <span class="name" :class="{ code: data.type === 'code', hook: data.type === 'key' }"
31
+ >{{ data.name }} ({{ data.id }})</span
32
+ >
29
33
  <!-- 右侧工具栏 -->
30
34
  <div class="right-tool" v-if="data.type === 'code'">
31
35
  <TMagicTooltip effect="dark" :content="editable ? '编辑' : '查看'" placement="bottom">
@@ -58,9 +62,11 @@ import { TMagicButton, tMagicMessage, TMagicScrollbar, TMagicTooltip, TMagicTree
58
62
  import { ColumnConfig } from '@tmagic/form';
59
63
  import { CodeBlockContent, Id } from '@tmagic/schema';
60
64
 
61
- import Icon from '../../../components/Icon.vue';
62
- import SearchInput from '../../../components/SearchInput.vue';
63
- import { CodeDeleteErrorType, CodeDslItem, Services } from '../../../type';
65
+ import Icon from '@editor/components/Icon.vue';
66
+ import SearchInput from '@editor/components/SearchInput.vue';
67
+ import AppManageIcon from '@editor/icons/AppManageIcon.vue';
68
+ import CodeIcon from '@editor/icons/CodeIcon.vue';
69
+ import { CodeDeleteErrorType, CodeDslItem, Services } from '@editor/type';
64
70
 
65
71
  import CodeBlockEditor from './CodeBlockEditor.vue';
66
72
 
@@ -73,20 +79,27 @@ const { codeBlockService, depService, editorService } = inject<Services>('servic
73
79
 
74
80
  // 代码块列表
75
81
  const codeList = computed(() =>
76
- Object.values(depService?.targets['code-block'] || {}).map((target) => ({
77
- id: target.id,
78
- name: target.name,
79
- type: 'code',
80
- codeBlockContent: codeBlockService?.getCodeContentById(target.id),
81
- children: Object.entries(target.deps).map(([id, dep]) => ({
82
+ Object.values(depService?.targets['code-block'] || {}).map((target) => {
83
+ // 组件节点
84
+ const compNodes = Object.entries(target.deps).map(([id, dep]) => ({
82
85
  name: dep.name,
83
86
  type: 'node',
84
87
  id,
85
88
  children: dep.keys.map((key) => ({ name: key, id: key, type: 'key' })),
86
- })),
87
- })),
89
+ }));
90
+ return {
91
+ id: target.id,
92
+ name: target.name,
93
+ type: 'code',
94
+ codeBlockContent: codeBlockService?.getCodeContentById(target.id),
95
+ children: compNodes,
96
+ };
97
+ }),
88
98
  );
89
99
 
100
+ // 默认展开组件层级的节点
101
+ const expandedKeys = computed(() => codeList.value.map((item) => item.id));
102
+
90
103
  const editable = computed(() => codeBlockService?.getEditStatus());
91
104
 
92
105
  // 是否展示代码编辑区
@@ -14,7 +14,7 @@ import { TMagicButton } from '@tmagic/design';
14
14
  import type { MNode } from '@tmagic/schema';
15
15
  import { getNodePath } from '@tmagic/utils';
16
16
 
17
- import type { Services } from '../../type';
17
+ import type { Services } from '@editor/type';
18
18
 
19
19
  const services = inject<Services>('services');
20
20
  const editorService = services?.editorService;
@@ -53,8 +53,8 @@ import { CaretBottom, Delete, DocumentCopy } from '@element-plus/icons-vue';
53
53
  import { TMagicIcon, TMagicPopover, TMagicTooltip } from '@tmagic/design';
54
54
  import type { MPage } from '@tmagic/schema';
55
55
 
56
- import ToolButton from '../../components/ToolButton.vue';
57
- import type { Services } from '../../type';
56
+ import ToolButton from '@editor/components/ToolButton.vue';
57
+ import type { Services } from '@editor/type';
58
58
 
59
59
  import PageBarScrollContainer from './PageBarScrollContainer.vue';
60
60
 
@@ -32,9 +32,9 @@ import { ArrowLeftBold, ArrowRightBold, Plus } from '@element-plus/icons-vue';
32
32
 
33
33
  import { NodeType } from '@tmagic/schema';
34
34
 
35
- import Icon from '../../components/Icon.vue';
36
- import type { Services } from '../../type';
37
- import { generatePageNameByApp } from '../../utils/editor';
35
+ import Icon from '@editor/components/Icon.vue';
36
+ import type { Services } from '@editor/type';
37
+ import { generatePageNameByApp } from '@editor/utils/editor';
38
38
 
39
39
  const services = inject<Services>('services');
40
40
  const editorService = services?.editorService;
@@ -33,9 +33,9 @@ import { cloneDeep } from 'lodash-es';
33
33
  import type { MContainer } from '@tmagic/schema';
34
34
  import StageCore, { calcValueByFontsize, getOffset, Runtime } from '@tmagic/stage';
35
35
 
36
- import ScrollViewer from '../../components/ScrollViewer.vue';
37
- import { Layout, MenuButton, MenuComponent, Services, StageOptions } from '../../type';
38
- import { useStage } from '../../utils/stage';
36
+ import ScrollViewer from '@editor/components/ScrollViewer.vue';
37
+ import { Layout, MenuButton, MenuComponent, Services, StageOptions } from '@editor/type';
38
+ import { useStage } from '@editor/utils/stage';
39
39
 
40
40
  import ViewerMenu from './ViewerMenu.vue';
41
41
 
@@ -9,10 +9,10 @@ import { Bottom, CopyDocument, Delete, DocumentCopy, Top } from '@element-plus/i
9
9
  import { NodeType } from '@tmagic/schema';
10
10
  import { isPage } from '@tmagic/utils';
11
11
 
12
- import ContentMenu from '../../components/ContentMenu.vue';
13
- import storageService from '../../services/storage';
14
- import { LayerOffset, Layout, MenuButton, MenuComponent, Services } from '../../type';
15
- import { COPY_STORAGE_KEY } from '../../utils/editor';
12
+ import ContentMenu from '@editor/components/ContentMenu.vue';
13
+ import storageService from '@editor/services/storage';
14
+ import { LayerOffset, Layout, MenuButton, MenuComponent, Services } from '@editor/type';
15
+ import { COPY_STORAGE_KEY } from '@editor/utils/editor';
16
16
 
17
17
  const props = withDefaults(
18
18
  defineProps<{ isMultiSelect?: boolean; stageContentMenu: (MenuButton | MenuComponent)[] }>(),
@@ -21,7 +21,7 @@ import KeyController from 'keycon';
21
21
 
22
22
  import { isPage } from '@tmagic/utils';
23
23
 
24
- import type { MenuButton, MenuComponent, Services } from '../../type';
24
+ import type { MenuButton, MenuComponent, Services } from '@editor/type';
25
25
 
26
26
  import Breadcrumb from './Breadcrumb.vue';
27
27
  import PageBar from './PageBar.vue';
@@ -18,7 +18,7 @@
18
18
 
19
19
  import { EventEmitter } from 'events';
20
20
 
21
- import { compose } from '../utils/compose';
21
+ import { compose } from '@editor/utils/compose';
22
22
 
23
23
  const methodName = (prefix: string, name: string) => `${prefix}${name[0].toUpperCase()}${name.substring(1)}`;
24
24
 
@@ -21,9 +21,9 @@ import { keys, pick } from 'lodash-es';
21
21
 
22
22
  import { CodeBlockContent, CodeBlockDSL, Id } from '@tmagic/schema';
23
23
 
24
- import type { CodeState } from '../type';
25
- import { CODE_DRAFT_STORAGE_KEY } from '../type';
26
- import { info } from '../utils/logger';
24
+ import type { CodeState } from '@editor/type';
25
+ import { CODE_DRAFT_STORAGE_KEY } from '@editor/type';
26
+ import { info } from '@editor/utils/logger';
27
27
 
28
28
  import BaseService from './BaseService';
29
29
 
@@ -18,7 +18,7 @@
18
18
 
19
19
  import { reactive } from 'vue';
20
20
 
21
- import type { ComponentGroup, ComponentGroupState } from '../type';
21
+ import type { ComponentGroup, ComponentGroupState } from '@editor/type';
22
22
 
23
23
  import BaseService from './BaseService';
24
24
 
@@ -24,10 +24,10 @@ import { NodeType } from '@tmagic/schema';
24
24
  import StageCore from '@tmagic/stage';
25
25
  import { getNodePath, isNumber, isPage, isPop } from '@tmagic/utils';
26
26
 
27
- import historyService from '../services/history';
28
- import storageService, { Protocol } from '../services/storage';
29
- import type { AddMNode, EditorNodeInfo, PastePosition, StepValue, StoreState, StoreStateKey } from '../type';
30
- import { LayerOffset, Layout } from '../type';
27
+ import historyService from '@editor/services/history';
28
+ import storageService, { Protocol } from '@editor/services/storage';
29
+ import type { AddMNode, EditorNodeInfo, PastePosition, StepValue, StoreState, StoreStateKey } from '@editor/type';
30
+ import { LayerOffset, Layout } from '@editor/type';
31
31
  import {
32
32
  change2Fixed,
33
33
  COPY_STORAGE_KEY,
@@ -37,8 +37,8 @@ import {
37
37
  getNodeIndex,
38
38
  isFixed,
39
39
  setLayout,
40
- } from '../utils/editor';
41
- import { beforePaste, getAddParent } from '../utils/operator';
40
+ } from '@editor/utils/editor';
41
+ import { beforePaste, getAddParent } from '@editor/utils/operator';
42
42
 
43
43
  import BaseService from './BaseService';
44
44
  import propsService from './props';
@@ -22,7 +22,7 @@ import { cloneDeep } from 'lodash-es';
22
22
  import { DEFAULT_EVENTS, DEFAULT_METHODS, EventOption } from '@tmagic/core';
23
23
  import { toLine } from '@tmagic/utils';
24
24
 
25
- import type { ComponentGroup } from '../type';
25
+ import type { ComponentGroup } from '@editor/type';
26
26
 
27
27
  import BaseService from './BaseService';
28
28
 
@@ -20,8 +20,8 @@ import { reactive } from 'vue';
20
20
 
21
21
  import type { MPage } from '@tmagic/schema';
22
22
 
23
- import { HistoryState, StepValue } from '../type';
24
- import { UndoRedo } from '../utils/undo-redo';
23
+ import type { HistoryState, StepValue } from '@editor/type';
24
+ import { UndoRedo } from '@editor/utils/undo-redo';
25
25
 
26
26
  import BaseService from './BaseService';
27
27
 
@@ -21,10 +21,10 @@ import { cloneDeep, mergeWith } from 'lodash-es';
21
21
 
22
22
  import type { FormConfig } from '@tmagic/form';
23
23
  import type { MComponent, MNode } from '@tmagic/schema';
24
- import { toLine } from '@tmagic/utils';
24
+ import { guid, toLine } from '@tmagic/utils';
25
25
 
26
- import type { PropsState } from '../type';
27
- import { fillConfig } from '../utils/props';
26
+ import type { PropsState } from '@editor/type';
27
+ import { fillConfig } from '@editor/utils/props';
28
28
 
29
29
  import BaseService from './BaseService';
30
30
 
@@ -130,7 +130,7 @@ class Props extends BaseService {
130
130
  }
131
131
 
132
132
  public async createId(type: string | number): Promise<string> {
133
- return `${type}_${this.guid()}`;
133
+ return `${type}_${guid()}`;
134
134
  }
135
135
 
136
136
  /**
@@ -181,19 +181,6 @@ class Props extends BaseService {
181
181
  this.removeAllListeners();
182
182
  this.removeAllPlugins();
183
183
  }
184
-
185
- /**
186
- * 生成指定位数的GUID,无【-】格式
187
- * @param digit 位数,默认值8
188
- * @returns
189
- */
190
- private guid(digit = 8): string {
191
- return 'x'.repeat(digit).replace(/[xy]/g, (c) => {
192
- const r = (Math.random() * 16) | 0;
193
- const v = c === 'x' ? r : (r & 0x3) | 0x8;
194
- return v.toString(16);
195
- });
196
- }
197
184
  }
198
185
 
199
186
  export type PropsService = Props;
@@ -18,8 +18,8 @@
18
18
 
19
19
  import { reactive } from 'vue';
20
20
 
21
- import editorService from '../services/editor';
22
- import type { StageRect, UiState } from '../type';
21
+ import editorService from '@editor/services/editor';
22
+ import type { StageRect, UiState } from '@editor/type';
23
23
 
24
24
  import BaseService from './BaseService';
25
25
 
@@ -1,55 +1,18 @@
1
1
  .m-editor-code-block-list {
2
2
  height: 100%;
3
3
 
4
- .magic-editor-layer-tree {
5
- padding-top: 48px;
6
- }
7
-
8
- .code-header-wrapper {
9
- display: flex;
10
- align-items: center;
11
- justify-content: center;
12
- position: absolute;
13
- top: 0;
14
- width: 100%;
15
- z-index: 1;
16
-
17
- .search-input {
18
- flex: 1;
19
- position: relative;
20
- }
21
-
22
- .create-code-button {
23
- margin-left: 2px;
24
- margin-right: 10px;
25
- }
26
- }
27
-
28
- .divider {
29
- margin: 10px 0 0 0;
30
- }
31
-
32
4
  .list-container {
33
- width: 100%;
34
- overflow: hidden;
35
5
  .list-item {
36
- display: flex;
37
- width: 100%;
38
-
39
- .right-tool {
40
- display: flex;
41
- width: fit-content !important;
42
- .edit-icon {
43
- margin: 0 5px;
44
- }
6
+ .codeIcon {
7
+ width: 22px;
8
+ height: 22px;
9
+ margin-right: 5px;
45
10
  }
46
- .code-name {
47
- white-space: nowrap;
48
- overflow: hidden;
49
- text-overflow: ellipsis;
50
- width: 0 !important;
51
- flex: 1;
52
- line-height: 18px;
11
+
12
+ .compIcon {
13
+ width: 22px;
14
+ height: 22px;
15
+ margin-right: 5px;
53
16
  }
54
17
  }
55
18
  }
@@ -57,9 +20,8 @@
57
20
 
58
21
  .m-fields-code-select {
59
22
  width: 100%;
60
- .edit-icon {
61
- cursor: pointer;
62
- margin-right: 5px;
23
+ .el-card__header {
24
+ display: none;
63
25
  }
64
26
  }
65
27
 
@@ -0,0 +1,59 @@
1
+ .m-editor-dep-list-panel {
2
+ .magic-editor-layer-tree {
3
+ padding-top: 48px;
4
+ }
5
+
6
+ .search-wrapper {
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ position: absolute;
11
+ top: 0;
12
+ width: 100%;
13
+ z-index: 1;
14
+
15
+ .search-input {
16
+ flex: 1;
17
+ position: relative;
18
+ }
19
+
20
+ .tmagic-design-button {
21
+ margin-right: 10px;
22
+ }
23
+ }
24
+
25
+ .list-container {
26
+ width: 100%;
27
+ overflow: hidden;
28
+ .list-item {
29
+ display: flex;
30
+ width: 100%;
31
+ align-items: center;
32
+
33
+ .right-tool {
34
+ display: flex;
35
+ width: fit-content !important;
36
+ align-items: center;
37
+ .edit-icon {
38
+ margin: 0 5px;
39
+ }
40
+ }
41
+ .name {
42
+ white-space: nowrap;
43
+ overflow: hidden;
44
+ text-overflow: ellipsis;
45
+ width: 0 !important;
46
+ flex: 1;
47
+ line-height: 22px;
48
+
49
+ &.code {
50
+ color: #000;
51
+ }
52
+
53
+ &.hook {
54
+ color: #909399;
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }
@@ -21,4 +21,16 @@
21
21
  }
22
22
  .m-fields-code-select-col {
23
23
  width: 100%;
24
+ .code-select-container {
25
+ display: flex;
26
+ align-items: center;
27
+ .select {
28
+ flex: 10 0 100px;
29
+ }
30
+ .icon {
31
+ flex: 1 0 20px;
32
+ cursor: pointer;
33
+ margin-right: 5px;
34
+ }
35
+ }
24
36
  }
@@ -1,11 +1,24 @@
1
- .m-editor-sidebar {
1
+ .m-editor-sidebar.tmagic-design-tabs {
2
2
  height: 100%;
3
3
 
4
- &.el-tabs--left .el-tabs__header {
4
+ .el-tabs__header,
5
+ .t-tabs__header {
5
6
  background: $--sidebar-heder-background-color;
6
7
  border: 0;
8
+ height: 100%;
9
+
10
+ .t-tabs__nav--card {
11
+ background-color: transparent;
12
+ }
7
13
 
8
- &.is-left {
14
+ .t-tabs__nav--card.t-tabs__nav-item:not(.t-is-disabled):not(
15
+ .t-is-active
16
+ ):hover {
17
+ background-color: transparent;
18
+ }
19
+
20
+ &.is-left,
21
+ &.t-is-left {
9
22
  width: 40px;
10
23
  margin-right: 0;
11
24
  }
@@ -23,7 +36,8 @@
23
36
  margin-left: 2px;
24
37
  }
25
38
 
26
- .el-tabs__item.is-left {
39
+ .el-tabs__item.is-left,
40
+ .t-tabs__nav-item {
27
41
  line-height: 15px;
28
42
  border: 0;
29
43
  height: auto;
@@ -31,8 +45,10 @@
31
45
  color: rgb(255, 255, 255);
32
46
  box-sizing: border-box;
33
47
 
34
- &.is-left {
35
- &.is-active {
48
+ &.is-left,
49
+ &.t-is-left {
50
+ &.is-active,
51
+ &.t-is-active {
36
52
  background: $--sidebar-content-background-color;
37
53
  border: 0;
38
54
 
@@ -51,6 +67,10 @@
51
67
  }
52
68
  }
53
69
 
70
+ .t-tabs__nav-item {
71
+ padding: 7px;
72
+ }
73
+
54
74
  i {
55
75
  font-size: 25px;
56
76
  color: rgba(255, 255, 255, 0.6);
@@ -16,3 +16,4 @@
16
16
  @import "./event.scss";
17
17
  @import "./layout.scss";
18
18
  @import "./breadcrumb.scss";
19
+ @import "./dep-list.scss";
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- import { InstallOptions } from '../type';
19
+ import { InstallOptions } from '@editor/type';
20
20
 
21
21
  let $TMAGIC_EDITOR: InstallOptions = {} as any;
22
22
 
package/src/utils/dep.ts CHANGED
@@ -2,8 +2,8 @@ import { isEmpty } from 'lodash-es';
2
2
 
3
3
  import { CodeBlockContent, HookType, Id } from '@tmagic/schema';
4
4
 
5
- import { Target } from '../services/dep';
6
- import { HookData } from '../type';
5
+ import { Target } from '@editor/services/dep';
6
+ import type { HookData } from '@editor/type';
7
7
 
8
8
  export const createCodeBlockTarget = (id: Id, codeBlock: CodeBlockContent) =>
9
9
  new Target({
@@ -23,7 +23,7 @@ import { NodeType } from '@tmagic/schema';
23
23
  import type StageCore from '@tmagic/stage';
24
24
  import { getNodePath, isNumber, isPage, isPop } from '@tmagic/utils';
25
25
 
26
- import { Layout } from '../type';
26
+ import { Layout } from '@editor/type';
27
27
  export const COPY_STORAGE_KEY = '$MagicEditorCopyData';
28
28
 
29
29
  /**