@tmagic/editor 1.5.0-beta.0 → 1.5.0-beta.2

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.
@@ -82,7 +82,7 @@ export interface EditorProps {
82
82
  /** 禁用属性配置面板右下角显示源码的按钮 */
83
83
  disabledShowSrc?: boolean;
84
84
  /** 中间工作区域中画布渲染的内容 */
85
- render?: (stage: StageCore) => HTMLDivElement | Promise<HTMLDivElement>;
85
+ render?: (stage: StageCore) => HTMLDivElement | void | Promise<HTMLDivElement | void>;
86
86
  /** 选中时会在画布上复制出一个大小相同的dom,实际拖拽的是这个dom,此方法用于干预这个dom的生成方式 */
87
87
  updateDragEl?: UpdateDragEl;
88
88
  /** 用于设置画布上的dom是否可以被选中 */
@@ -22,7 +22,7 @@
22
22
  :last-values="lastValues"
23
23
  :init-values="initValues"
24
24
  :values="values"
25
- :prop="`${prop}${prop ? '.' : ''}${name}`"
25
+ :prop="prop"
26
26
  @change="onChangeHandler"
27
27
  ></component>
28
28
 
@@ -22,3 +22,10 @@ export * from './use-stage';
22
22
  export * from './use-float-box';
23
23
  export * from './use-window-rect';
24
24
  export * from './use-editor-content-height';
25
+ export * from './use-filter';
26
+ export * from './use-float-box';
27
+ export * from './use-getso';
28
+ export * from './use-next-float-box-position';
29
+ export * from './use-node-status';
30
+ export * from './use-stage';
31
+ export * from './use-window-rect';
package/src/index.ts CHANGED
@@ -85,6 +85,8 @@ export { default as SplitView } from './components/SplitView.vue';
85
85
  export { default as Resizer } from './components/Resizer.vue';
86
86
  export { default as CodeBlockEditor } from './components/CodeBlockEditor.vue';
87
87
  export { default as FloatingBox } from './components/FloatingBox.vue';
88
+ export { default as Tree } from './components/Tree.vue';
89
+ export { default as TreeNode } from './components/TreeNode.vue';
88
90
  export { default as PageFragmentSelect } from './fields/PageFragmentSelect.vue';
89
91
  export { default as DisplayConds } from './fields/DisplayConds.vue';
90
92
  export { default as CondOpSelect } from './fields/CondOpSelect.vue';
@@ -24,7 +24,13 @@
24
24
  </slot>
25
25
  </div>
26
26
 
27
- <TMagicPopover popper-class="page-bar-popover" placement="top" :width="160" trigger="hover">
27
+ <TMagicPopover
28
+ popper-class="page-bar-popover"
29
+ placement="top"
30
+ trigger="hover"
31
+ :width="160"
32
+ :destroy-on-close="true"
33
+ >
28
34
  <div>
29
35
  <slot name="page-bar-popover" :page="item">
30
36
  <ToolButton
@@ -4,7 +4,13 @@
4
4
  id="m-editor-page-bar-list-icon"
5
5
  class="m-editor-page-bar-item m-editor-page-bar-item-icon"
6
6
  >
7
- <TMagicPopover popper-class="page-bar-popover" placement="top" :width="160" trigger="hover">
7
+ <TMagicPopover
8
+ popper-class="page-bar-popover"
9
+ placement="top"
10
+ trigger="hover"
11
+ :width="160"
12
+ :destroy-on-close="true"
13
+ >
8
14
  <div>
9
15
  <slot name="page-list-popover" :list="list">
10
16
  <ToolButton
@@ -148,7 +148,7 @@
148
148
  </template>
149
149
 
150
150
  <script setup lang="ts">
151
- import { computed, inject, ref, watch } from 'vue';
151
+ import { computed, inject, nextTick, ref, watch } from 'vue';
152
152
  import { Coin, EditPen, Goods, List } from '@element-plus/icons-vue';
153
153
 
154
154
  import FloatingBox from '@editor/components/FloatingBox.vue';
@@ -196,7 +196,23 @@ const props = withDefaults(
196
196
  const services = inject<Services>('services');
197
197
 
198
198
  const columnLeftWidth = computed(() => services?.uiService.get('columnWidth')[ColumnLayout.LEFT] || 0);
199
- const { height: columnLeftHeight } = useEditorContentHeight();
199
+ const { height: editorContentHeight } = useEditorContentHeight();
200
+ const columnLeftHeight = ref(0);
201
+
202
+ const unWatchEditorContentHeight = watch(
203
+ editorContentHeight,
204
+ (height) => {
205
+ if (height) {
206
+ columnLeftHeight.value = height * 0.5;
207
+ nextTick().then(() => {
208
+ unWatchEditorContentHeight();
209
+ });
210
+ }
211
+ },
212
+ {
213
+ immediate: true,
214
+ },
215
+ );
200
216
 
201
217
  const activeTabName = ref(props.data?.status);
202
218
 
@@ -2,23 +2,27 @@
2
2
  <TMagicScrollbar class="data-source-list-panel m-editor-layer-panel">
3
3
  <div class="search-wrapper">
4
4
  <SearchInput @search="filterTextChangeHandler"></SearchInput>
5
- <TMagicPopover v-if="editable" placement="right">
5
+ <TMagicPopover
6
+ v-if="editable"
7
+ placement="right"
8
+ trigger="hover"
9
+ popper-class="data-source-list-panel-add-menu"
10
+ :destroy-on-close="true"
11
+ >
6
12
  <template #reference>
7
13
  <TMagicButton type="primary" size="small">新增</TMagicButton>
8
14
  </template>
9
- <div class="data-source-list-panel-add-menu">
10
- <ToolButton
11
- v-for="(item, index) in datasourceTypeList"
12
- :data="{
13
- type: 'button',
14
- text: item.text,
15
- handler: () => {
16
- addHandler(item.type);
17
- },
18
- }"
19
- :key="index"
20
- ></ToolButton>
21
- </div>
15
+ <ToolButton
16
+ v-for="(item, index) in datasourceTypeList"
17
+ :data="{
18
+ type: 'button',
19
+ text: item.text,
20
+ handler: () => {
21
+ addHandler(item.type);
22
+ },
23
+ }"
24
+ :key="index"
25
+ ></ToolButton>
22
26
  </TMagicPopover>
23
27
 
24
28
  <slot name="data-source-panel-search"></slot>
@@ -17,12 +17,15 @@
17
17
  }
18
18
 
19
19
  .data-source-list-panel-add-menu {
20
- .tmagic-design-button {
21
- width: 100%;
22
- text-align: left;
20
+ padding: 4px 0;
23
21
 
24
- span {
25
- width: 100%;
22
+ .menu-item {
23
+ cursor: pointer;
24
+ transition: all 0.2s ease 0s;
25
+ padding: 5px 14px;
26
+
27
+ &:hover {
28
+ background-color: $--hover-color;
26
29
  }
27
30
  }
28
31
  }
@@ -5,12 +5,13 @@
5
5
  width: 100%;
6
6
 
7
7
  .tmagic-design-button.m-editor-page-bar-switch-type-button {
8
- margin-left: 7px;
8
+ margin-left: 10px;
9
9
  position: relative;
10
10
  top: 1px;
11
11
  border-radius: 3px 3px 0 0;
12
12
  border: 1px solid $--border-color;
13
13
  border-bottom: 1px solid transparent;
14
+ padding: 5px 10px;
14
15
 
15
16
  &.active {
16
17
  background-color: #f3f3f3;
package/src/type.ts CHANGED
@@ -145,7 +145,7 @@ export interface StageOptions {
145
145
  containerHighlightDuration?: number;
146
146
  containerHighlightType?: ContainerHighlightType;
147
147
  disabledDragStart?: boolean;
148
- render?: (stage: StageCore) => HTMLDivElement | Promise<HTMLDivElement>;
148
+ render?: (stage: StageCore) => HTMLDivElement | void | Promise<HTMLDivElement | void>;
149
149
  moveableOptions?: MoveableOptions | ((config?: CustomizeMoveableOptionsCallbackConfig) => MoveableOptions);
150
150
  canSelect?: (el: HTMLElement) => boolean | Promise<boolean>;
151
151
  isContainer?: (el: HTMLElement) => boolean | Promise<boolean>;