@tmagic/editor 1.8.0-manmanyu.21 → 1.8.0-manmanyu.22
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/es/components/CodeBlockEditor.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/es/components/FloatingBox.vue_vue_type_script_setup_true_lang.js +56 -13
- package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +7 -0
- package/dist/es/fields/DataSourceMocks.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/es/layouts/Framework.vue_vue_type_script_setup_true_lang.js +6 -3
- package/dist/es/layouts/props-panel/use-style-panel.js +3 -2
- package/dist/es/layouts/sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +3 -0
- package/dist/es/layouts/sidebar/data-source/DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/es/layouts/workspace/viewer/NodeListMenu.vue_vue_type_script_setup_true_lang.js +8 -2
- package/dist/es/services/ui.js +3 -0
- package/dist/es/style.css +9 -1
- package/dist/es/utils/const.js +1 -1
- package/dist/style.css +9 -1
- package/dist/themes/magic-admin.css +32 -13
- package/dist/tmagic-editor.umd.cjs +98 -19
- package/package.json +7 -7
- package/src/components/CodeBlockEditor.vue +3 -0
- package/src/components/FloatingBox.vue +71 -7
- package/src/fields/DataSourceFields.vue +5 -0
- package/src/fields/DataSourceMocks.vue +3 -0
- package/src/layouts/Framework.vue +7 -6
- package/src/layouts/props-panel/use-style-panel.ts +4 -3
- package/src/layouts/sidebar/Sidebar.vue +2 -0
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +3 -0
- package/src/layouts/workspace/viewer/NodeListMenu.vue +4 -1
- package/src/services/ui.ts +6 -0
- package/src/theme/floating-box.scss +9 -1
- package/src/theme/themes/magic-admin/index.scss +31 -18
- package/src/type.ts +6 -0
- package/src/utils/const.ts +2 -2
- package/types/index.d.ts +13 -2
|
@@ -132,6 +132,7 @@
|
|
|
132
132
|
v-model:height="columnLeftHeight"
|
|
133
133
|
:width="columnLeftWidth"
|
|
134
134
|
:title="config.text"
|
|
135
|
+
:framework-width="frameworkWidth"
|
|
135
136
|
:position="{
|
|
136
137
|
left: floatBoxStates[config.$key].left,
|
|
137
138
|
top: floatBoxStates[config.$key].top,
|
|
@@ -221,6 +222,7 @@ const taskLength = computed(() => depService.get('taskLength'));
|
|
|
221
222
|
const tipsBarVisible = ref(true);
|
|
222
223
|
|
|
223
224
|
const columnLeftWidth = computed(() => uiService.get('columnWidth')[ColumnLayout.LEFT]);
|
|
225
|
+
const frameworkWidth = computed(() => uiService.get('frameworkRect')?.width || 0);
|
|
224
226
|
const { height: editorContentHeight } = useEditorContentHeight();
|
|
225
227
|
const columnLeftHeight = ref(0);
|
|
226
228
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FloatingBox
|
|
3
|
+
:body-style="{ padding: '0 16px' }"
|
|
3
4
|
v-model:visible="boxVisible"
|
|
4
5
|
v-model:width="width"
|
|
5
6
|
v-model:height="editorHeight"
|
|
6
7
|
:title="title"
|
|
8
|
+
:framework-width="frameworkWidth"
|
|
7
9
|
:position="boxPosition"
|
|
8
10
|
>
|
|
9
11
|
<template #body>
|
|
@@ -65,6 +67,7 @@ const { height: editorHeight } = useEditorContentHeight();
|
|
|
65
67
|
|
|
66
68
|
const parentFloating = inject<Ref<HTMLDivElement | null>>('parentFloating', ref(null));
|
|
67
69
|
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(uiService, parentFloating);
|
|
70
|
+
const frameworkWidth = computed(() => uiService.get('frameworkRect')?.width || 0);
|
|
68
71
|
|
|
69
72
|
/** 供「方法定义」tab 内的字段消费,用于打开数据源详情后自动打开指定方法 */
|
|
70
73
|
provide(
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
ref="box"
|
|
9
9
|
v-model:visible="visible"
|
|
10
10
|
title="当前位置下的组件"
|
|
11
|
+
:framework-width="frameworkWidth"
|
|
11
12
|
:position="menuPosition"
|
|
12
13
|
>
|
|
13
14
|
<template #body>
|
|
@@ -36,7 +37,9 @@ import { useNodeStatus } from '@editor/layouts/sidebar/layer/use-node-status';
|
|
|
36
37
|
import type { TreeNodeData } from '@editor/type';
|
|
37
38
|
|
|
38
39
|
const services = useServices();
|
|
39
|
-
const { editorService } = services;
|
|
40
|
+
const { editorService, uiService } = services;
|
|
41
|
+
|
|
42
|
+
const frameworkWidth = computed(() => uiService.get('frameworkRect')?.width || 0);
|
|
40
43
|
|
|
41
44
|
const visible = ref(false);
|
|
42
45
|
const buttonVisible = ref(false);
|
package/src/services/ui.ts
CHANGED
|
@@ -27,6 +27,9 @@ import {
|
|
|
27
27
|
DEFAULT_LEFT_COLUMN_WIDTH,
|
|
28
28
|
DEFAULT_RIGHT_COLUMN_WIDTH,
|
|
29
29
|
LEFT_COLUMN_WIDTH_STORAGE_KEY,
|
|
30
|
+
MIN_CENTER_COLUMN_WIDTH,
|
|
31
|
+
MIN_LEFT_COLUMN_WIDTH,
|
|
32
|
+
MIN_RIGHT_COLUMN_WIDTH,
|
|
30
33
|
RIGHT_COLUMN_WIDTH_STORAGE_KEY,
|
|
31
34
|
} from '@editor/utils/const';
|
|
32
35
|
|
|
@@ -54,6 +57,9 @@ const state = shallowReactive<UiState>({
|
|
|
54
57
|
storageService.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY, { protocol: Protocol.NUMBER }) ||
|
|
55
58
|
DEFAULT_RIGHT_COLUMN_WIDTH,
|
|
56
59
|
},
|
|
60
|
+
minLeftColumnWidth: MIN_LEFT_COLUMN_WIDTH,
|
|
61
|
+
minCenterColumnWidth: MIN_CENTER_COLUMN_WIDTH,
|
|
62
|
+
minRightColumnWidth: MIN_RIGHT_COLUMN_WIDTH,
|
|
57
63
|
showGuides: true,
|
|
58
64
|
hasGuides: false,
|
|
59
65
|
showRule: true,
|
|
@@ -25,10 +25,18 @@
|
|
|
25
25
|
.m-editor-float-box-body {
|
|
26
26
|
overflow: auto;
|
|
27
27
|
flex: 1;
|
|
28
|
-
padding: 0 16px;
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
.m-editor-floating-box-moveable {
|
|
33
32
|
opacity: 0;
|
|
34
33
|
}
|
|
34
|
+
|
|
35
|
+
.m-editor-float-box-drag-mask {
|
|
36
|
+
position: fixed;
|
|
37
|
+
top: 0;
|
|
38
|
+
left: 0;
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
background-color: transparent;
|
|
42
|
+
}
|
|
@@ -19,9 +19,18 @@
|
|
|
19
19
|
.m-editor.m-editor--magic-admin {
|
|
20
20
|
.m-editor-sidebar {
|
|
21
21
|
.m-editor-sidebar-header {
|
|
22
|
-
padding: 8px 0;
|
|
23
|
-
width:
|
|
22
|
+
// padding: 8px 0;
|
|
23
|
+
width: 61px;
|
|
24
|
+
padding-top: 4px;
|
|
25
|
+
// sidebar 父容器是 `display: flex` (row),同级 `.m-editor-sidebar-content` 的 width
|
|
26
|
+
// 是 `calc(100% - 40px)`(sidebar.scss:52,40 是老 header 宽度)。当 header 改成 61px
|
|
27
|
+
// 后,两者之和会溢出 21px 左右,默认 `flex-shrink: 1` 会按权重压缩 header,最终渲染
|
|
28
|
+
// 出 56.3px 而非 61px。这里强制 `flex-shrink: 0` 让 header 守住宽度,多余的部分由
|
|
29
|
+
// content 侧承担(content 的 `100% - 40` 会自然让出)。
|
|
30
|
+
flex-shrink: 0;
|
|
31
|
+
border-right: 1px solid rgba(0, 84, 225, 0.1);
|
|
24
32
|
display: flex;
|
|
33
|
+
background-color: #fff;
|
|
25
34
|
box-sizing: border-box;
|
|
26
35
|
flex-direction: column;
|
|
27
36
|
align-items: center;
|
|
@@ -29,22 +38,27 @@
|
|
|
29
38
|
display: flex;
|
|
30
39
|
flex-direction: column;
|
|
31
40
|
align-items: center;
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
border-radius: 4px;
|
|
42
|
+
padding: 4px 2px;
|
|
43
|
+
width: 52px;
|
|
34
44
|
margin-bottom: 4px;
|
|
45
|
+
box-sizing: border-box;
|
|
35
46
|
background-color: transparent;
|
|
47
|
+
color: #84909d;
|
|
36
48
|
&:hover {
|
|
37
|
-
background-color: rgba(0, 0, 0, 0.
|
|
49
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
38
50
|
}
|
|
39
51
|
> i {
|
|
40
|
-
color: #
|
|
52
|
+
color: #84909d;
|
|
41
53
|
}
|
|
42
54
|
&.is-active {
|
|
43
|
-
background-color:
|
|
44
|
-
border-radius: 4px;
|
|
55
|
+
background-color: var(--el-button-hover-bg-color, rgb(230, 238, 253));
|
|
45
56
|
color: var(--el-color-primary);
|
|
46
57
|
&:hover {
|
|
47
|
-
background-color:
|
|
58
|
+
background-color: var(
|
|
59
|
+
--el-button-hover-bg-color,
|
|
60
|
+
rgb(230, 238, 253)
|
|
61
|
+
);
|
|
48
62
|
}
|
|
49
63
|
> i {
|
|
50
64
|
color: var(--el-color-primary);
|
|
@@ -54,20 +68,19 @@
|
|
|
54
68
|
}
|
|
55
69
|
}
|
|
56
70
|
.magic-editor-tab-panel-title {
|
|
57
|
-
font-size:
|
|
71
|
+
font-size: 12px;
|
|
58
72
|
line-height: 14px;
|
|
59
|
-
font-weight:
|
|
73
|
+
font-weight: 400;
|
|
74
|
+
margin: 0 4px;
|
|
75
|
+
width: 52px;
|
|
76
|
+
text-align: center;
|
|
60
77
|
}
|
|
61
78
|
}
|
|
62
79
|
}
|
|
80
|
+
.m-editor-sidebar-content {
|
|
81
|
+
width: calc(100% - 61px);
|
|
82
|
+
}
|
|
63
83
|
}
|
|
64
|
-
.m-editor-sidebar .m-editor-sidebar-header .m-editor-sidebar-header-item
|
|
65
|
-
|
|
66
|
-
// 属性面板内的 input 圆角覆写:
|
|
67
|
-
// - 原默认主题里 `.m-editor-props-panel .el-input__wrapper { border-radius: 0; }`
|
|
68
|
-
// specificity 为 (0, 2, 0),已迁出(见 ../../props-panel.scss);
|
|
69
|
-
// - 这里在前面再套一层 `.m-editor.m-editor--magic-admin`,specificity 升到 (0, 3, 0),
|
|
70
|
-
// 保证主题启用时优先级一定能压过原规则及其它默认样式。
|
|
71
84
|
.m-editor-props-panel .el-input__wrapper {
|
|
72
85
|
border-radius: 4px;
|
|
73
86
|
}
|
package/src/type.ts
CHANGED
|
@@ -297,6 +297,12 @@ export interface UiState {
|
|
|
297
297
|
stageRect: StageRect;
|
|
298
298
|
/** 编辑器列布局每一列的宽度,分为左中右三列 */
|
|
299
299
|
columnWidth: GetColumnWidth;
|
|
300
|
+
/** 编辑器列布局左侧列最小宽度 */
|
|
301
|
+
minLeftColumnWidth: number;
|
|
302
|
+
/** 编辑器列布局中间列最小宽度 */
|
|
303
|
+
minCenterColumnWidth: number;
|
|
304
|
+
/** 编辑器列布局右侧列最小宽度 */
|
|
305
|
+
minRightColumnWidth: number;
|
|
300
306
|
/** 是否显示画布参考线,true: 显示,false: 不显示,默认为true */
|
|
301
307
|
showGuides: boolean;
|
|
302
308
|
/** 画布上是否存在参考线 */
|
package/src/utils/const.ts
CHANGED
|
@@ -8,8 +8,8 @@ export const PROPS_PANEL_WIDTH_STORAGE_KEY = '$MagicEditorPropsPanelWidthData';
|
|
|
8
8
|
export const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
9
9
|
export const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
10
10
|
|
|
11
|
-
// 2026-06-11 设计稿修改,固定左侧栏存在时最小宽度为
|
|
12
|
-
export const MIN_LEFT_COLUMN_WIDTH =
|
|
11
|
+
// 2026-06-11 设计稿修改,固定左侧栏存在时最小宽度为260
|
|
12
|
+
export const MIN_LEFT_COLUMN_WIDTH = 260;
|
|
13
13
|
export const MIN_CENTER_COLUMN_WIDTH = 400;
|
|
14
14
|
export const MIN_RIGHT_COLUMN_WIDTH = 300;
|
|
15
15
|
|
package/types/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import StageCore, { CanDropIn, ContainerHighlightType, CustomizeMoveableOptions,
|
|
|
4
4
|
import designPlugin, { ButtonProps, DesignPluginOptions } from "@tmagic/design";
|
|
5
5
|
import Gesto, { OnDrag, OnDrag as OnDrag$1 } from "gesto";
|
|
6
6
|
import { CodeBlockContent, CodeBlockDSL, DataSchema, DataSourceFieldType, DataSourceSchema, DepData, DepExtendedData, DepTargetType, DepTargetType as DepTargetType$1, DisplayCond, EventOption, Id, MApp, MContainer, MNode, MPage, MPageFragment, NodeType, Target, TargetOptions } from "@tmagic/core";
|
|
7
|
-
import { App, AppContext, Component, ComputedRef, Ref, ShallowRef } from "vue";
|
|
7
|
+
import { App, AppContext, CSSProperties, Component, ComputedRef, Ref, ShallowRef } from "vue";
|
|
8
8
|
import EventEmitter$1, { EventEmitter } from "events";
|
|
9
9
|
import * as Monaco from "monaco-editor";
|
|
10
10
|
import Sortable, { Options, SortableEvent } from "sortablejs";
|
|
@@ -1742,6 +1742,12 @@ interface UiState {
|
|
|
1742
1742
|
stageRect: StageRect;
|
|
1743
1743
|
/** 编辑器列布局每一列的宽度,分为左中右三列 */
|
|
1744
1744
|
columnWidth: GetColumnWidth;
|
|
1745
|
+
/** 编辑器列布局左侧列最小宽度 */
|
|
1746
|
+
minLeftColumnWidth: number;
|
|
1747
|
+
/** 编辑器列布局中间列最小宽度 */
|
|
1748
|
+
minCenterColumnWidth: number;
|
|
1749
|
+
/** 编辑器列布局右侧列最小宽度 */
|
|
1750
|
+
minRightColumnWidth: number;
|
|
1745
1751
|
/** 是否显示画布参考线,true: 显示,false: 不显示,默认为true */
|
|
1746
1752
|
showGuides: boolean;
|
|
1747
1753
|
/** 画布上是否存在参考线 */
|
|
@@ -3279,7 +3285,7 @@ declare const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData
|
|
|
3279
3285
|
declare const PROPS_PANEL_WIDTH_STORAGE_KEY = "$MagicEditorPropsPanelWidthData";
|
|
3280
3286
|
declare const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
3281
3287
|
declare const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
3282
|
-
declare const MIN_LEFT_COLUMN_WIDTH =
|
|
3288
|
+
declare const MIN_LEFT_COLUMN_WIDTH = 260;
|
|
3283
3289
|
declare const MIN_CENTER_COLUMN_WIDTH = 400;
|
|
3284
3290
|
declare const MIN_RIGHT_COLUMN_WIDTH = 300;
|
|
3285
3291
|
declare const H_GUIDE_LINE_STORAGE_KEY = "$MagicStageHorizontalGuidelinesData";
|
|
@@ -6334,6 +6340,9 @@ interface Position {
|
|
|
6334
6340
|
type __VLS_Props$6 = {
|
|
6335
6341
|
position?: Position;
|
|
6336
6342
|
title?: string;
|
|
6343
|
+
bodyStyle?: CSSProperties; /** 浮窗初始样式,会与内部计算样式合并,外部传入优先 */
|
|
6344
|
+
initialStyle?: CSSProperties; /** 用于约束浮窗 left 的容器宽度,传入时按宽度收敛 left,避免超出右边界;默认取视窗宽度 */
|
|
6345
|
+
frameworkWidth?: number;
|
|
6337
6346
|
beforeClose?: (_done: (_cancel?: boolean) => void) => void;
|
|
6338
6347
|
};
|
|
6339
6348
|
type __VLS_ModelProps = {
|
|
@@ -6363,6 +6372,8 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pu
|
|
|
6363
6372
|
}>, {
|
|
6364
6373
|
title: string;
|
|
6365
6374
|
position: Position;
|
|
6375
|
+
initialStyle: CSSProperties;
|
|
6376
|
+
frameworkWidth: number;
|
|
6366
6377
|
}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
|
|
6367
6378
|
declare const __VLS_export$6: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
|
|
6368
6379
|
declare const _default$20: typeof __VLS_export$6;
|