@tmagic/editor 1.8.0-beta.7 → 1.8.0-beta.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/es/Editor.vue_vue_type_script_setup_true_lang.js +11 -3
- package/dist/es/components/CodeBlockEditor.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/components/CodeParams.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/CompareForm.vue_vue_type_script_setup_true_lang.js +24 -11
- package/dist/es/components/ContentMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/FloatingBox.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/components/Icon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/Resizer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/ScrollBar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/ScrollViewer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/SearchInput.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/SplitView.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/ToolButton.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/Tree.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/TreeNode.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/Code.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/CodeLink.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/CodeSelect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/CodeSelectCol.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/CondOpSelect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/fields/DataSourceFieldSelect/Index.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/fields/DataSourceInput.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +1 -1
- package/dist/es/fields/DataSourceMethods.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/DataSourceMocks.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/fields/DataSourceSelect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/DisplayConds.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/EventSelect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/KeyValue.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/PageFragmentSelect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/Index.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/components/BackgroundPosition.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/components/Border.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/components/Box.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/NoRepeat.js +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/Repeat.js +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatX.js +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatY.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/Block.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/Flex.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/Inline.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/InlineBlock.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/None.js +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/Column.js +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/ColumnReverse.js +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/Row.js +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/RowReverse.js +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/Center.js +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/FlexEnd.js +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/FlexStart.js +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/SpaceAround.js +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/SpaceBetween.js +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/Center.js +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/Left.js +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/Right.js +1 -1
- package/dist/es/fields/StyleSetter/pro/Background.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/pro/Border.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/pro/Font.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/pro/Layout.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/pro/Position.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/pro/Transform.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/UISelect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/icons/CenterIcon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/icons/CodeIcon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/icons/FolderMinusIcon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/index.js +8 -4
- package/dist/es/layouts/AddPageBox.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/CodeEditor.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/Framework.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/NavMenu.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/layouts/NavMenuColumn.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/Bucket.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/BucketTab.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/GroupRow.vue_vue_type_script_setup_true_lang.js +39 -27
- package/dist/es/layouts/history-list/HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js +10 -3
- package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js +167 -302
- package/dist/es/layouts/history-list/InitialRow.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/PageTab.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/composables.js +23 -55
- package/dist/es/layouts/history-list/useHistoryList.js +56 -0
- package/dist/es/layouts/history-list/useHistoryRevert.js +307 -0
- package/dist/es/layouts/page-bar/AddButton.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/PageBar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/PageBarScrollContainer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/PageList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/Search.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/layouts/props-panel/FormPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/props-panel/PropsPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/ComponentListPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/code-block/CodeBlockList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/code-block/CodeBlockListPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/data-source/DataSourceAddButton.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/data-source/DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/layouts/sidebar/data-source/DataSourceList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/data-source/DataSourceListPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/layer/LayerMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/layer/LayerNodeTool.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/layer/LayerPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/Breadcrumb.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/Workspace.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/viewer/NodeListMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/viewer/Stage.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/viewer/StageOverlay.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/viewer/ViewerMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/services/codeBlock.js +32 -28
- package/dist/es/services/dataSource.js +43 -34
- package/dist/es/services/editor.js +31 -26
- package/dist/es/services/history.js +268 -384
- package/dist/es/style.css +12 -0
- package/dist/es/utils/dep/worker.js +1 -1
- package/dist/es/utils/history.js +35 -47
- package/dist/style.css +12 -0
- package/dist/tmagic-editor.umd.cjs +5524 -4807
- package/package.json +8 -8
- package/src/Editor.vue +10 -1
- package/src/components/CompareForm.vue +28 -7
- package/src/fields/DataSourceInput.vue +3 -3
- package/src/index.ts +4 -0
- package/src/layouts/NavMenu.vue +2 -2
- package/src/layouts/history-list/GroupRow.vue +10 -0
- package/src/layouts/history-list/HistoryDiffDialog.vue +8 -1
- package/src/layouts/history-list/HistoryListPanel.vue +64 -251
- package/src/layouts/history-list/PageTab.vue +4 -4
- package/src/layouts/history-list/composables.ts +52 -90
- package/src/layouts/history-list/useHistoryList.ts +60 -0
- package/src/layouts/history-list/useHistoryRevert.ts +406 -0
- package/src/services/codeBlock.ts +30 -29
- package/src/services/dataSource.ts +37 -37
- package/src/services/editor.ts +32 -29
- package/src/services/history.ts +340 -430
- package/src/theme/history-list-panel.scss +14 -0
- package/src/type.ts +185 -92
- package/src/utils/history.ts +52 -67
- package/types/index.d.ts +466 -297
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.8.0-beta.
|
|
2
|
+
"version": "1.8.0-beta.9",
|
|
3
3
|
"name": "@tmagic/editor",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"moveable": "^0.53.0",
|
|
59
59
|
"serialize-javascript": "^7.0.0",
|
|
60
60
|
"sortablejs": "^1.15.6",
|
|
61
|
-
"@tmagic/
|
|
62
|
-
"@tmagic/
|
|
63
|
-
"@tmagic/
|
|
64
|
-
"@tmagic/
|
|
65
|
-
"@tmagic/
|
|
61
|
+
"@tmagic/design": "1.8.0-beta.9",
|
|
62
|
+
"@tmagic/form": "1.8.0-beta.9",
|
|
63
|
+
"@tmagic/stage": "1.8.0-beta.9",
|
|
64
|
+
"@tmagic/table": "1.8.0-beta.9",
|
|
65
|
+
"@tmagic/utils": "1.8.0-beta.9"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/events": "^3.0.3",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"monaco-editor": "^0.55.1 ",
|
|
76
76
|
"type-fest": "^5.2.0",
|
|
77
77
|
"typescript": "^6.0.3",
|
|
78
|
-
"vue": "^3.5.
|
|
79
|
-
"@tmagic/core": "1.8.0-beta.
|
|
78
|
+
"vue": "^3.5.38",
|
|
79
|
+
"@tmagic/core": "1.8.0-beta.9"
|
|
80
80
|
},
|
|
81
81
|
"peerDependenciesMeta": {
|
|
82
82
|
"typescript": {
|
package/src/Editor.vue
CHANGED
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
<script lang="ts" setup>
|
|
136
136
|
import { EventEmitter } from 'events';
|
|
137
137
|
|
|
138
|
-
import { provide } from 'vue';
|
|
138
|
+
import { provide, ref } from 'vue';
|
|
139
139
|
|
|
140
140
|
import type { MApp } from '@tmagic/core';
|
|
141
141
|
|
|
@@ -227,6 +227,8 @@ const stageOptions: StageOptions = {
|
|
|
227
227
|
|
|
228
228
|
stageOverlayService.set('stageOptions', stageOptions);
|
|
229
229
|
|
|
230
|
+
const propsPanelRef = ref<InstanceType<typeof FormPanel> | null>(null);
|
|
231
|
+
|
|
230
232
|
provide('services', services);
|
|
231
233
|
|
|
232
234
|
provide('codeOptions', props.codeOptions);
|
|
@@ -237,6 +239,11 @@ provide('stageOptions', stageOptions);
|
|
|
237
239
|
* 与 PropsPanel 通过 `:extend-state` 显式传入的方式保持等价。
|
|
238
240
|
*/
|
|
239
241
|
provide('extendFormState', props.extendFormState);
|
|
242
|
+
/**
|
|
243
|
+
* 提供 PropsPanel 主属性表单的 formState getter,供历史差异弹窗复用,
|
|
244
|
+
* 让 CompareForm 与 PropsPanel 的 filterFunction 上下文保持一致。
|
|
245
|
+
*/
|
|
246
|
+
provide('getPropsPanelFormState', () => propsPanelRef.value?.configForm?.formState);
|
|
240
247
|
|
|
241
248
|
/**
|
|
242
249
|
* 把历史记录面板的自定义扩展 tab 提供给深层的 HistoryListPanel(它挂在 NavMenu 中,
|
|
@@ -248,9 +255,11 @@ provide('historyListExtraTabs', props.historyListExtraTabs);
|
|
|
248
255
|
provide<EventBus>('eventBus', new EventEmitter());
|
|
249
256
|
|
|
250
257
|
const propsPanelMountedHandler = (e: InstanceType<typeof FormPanel>) => {
|
|
258
|
+
propsPanelRef.value = e;
|
|
251
259
|
emit('props-panel-mounted', e);
|
|
252
260
|
};
|
|
253
261
|
const propsPanelUnmountedHandler = () => {
|
|
262
|
+
propsPanelRef.value = null;
|
|
254
263
|
emit('props-panel-unmounted');
|
|
255
264
|
};
|
|
256
265
|
|
|
@@ -10,21 +10,22 @@
|
|
|
10
10
|
:is-compare="true"
|
|
11
11
|
:disabled="true"
|
|
12
12
|
:label-width="labelWidth"
|
|
13
|
-
:extend-state="
|
|
13
|
+
:extend-state="mergedExtendState"
|
|
14
14
|
:show-diff="showDiff"
|
|
15
|
+
:self-diff-field-types="selfDiffFieldTypes"
|
|
15
16
|
></MForm>
|
|
16
17
|
</div>
|
|
17
18
|
</template>
|
|
18
19
|
|
|
19
20
|
<script lang="ts" setup>
|
|
20
|
-
import { computed, inject, type Ref, ref, type ShallowRef, useTemplateRef, watch, watchEffect } from 'vue';
|
|
21
|
+
import { computed, inject, provide, type Ref, ref, type ShallowRef, useTemplateRef, watch, watchEffect } from 'vue';
|
|
21
22
|
import { isEqual } from 'lodash-es';
|
|
22
23
|
|
|
23
24
|
import { type CodeBlockContent, type DataSourceSchema, HookType, type MNode } from '@tmagic/core';
|
|
24
25
|
import { type FormConfig, type FormState, type FormValue, MForm } from '@tmagic/form';
|
|
25
26
|
|
|
26
27
|
import { useServices } from '@editor/hooks/use-services';
|
|
27
|
-
import type { CompareCategory, CompareFormLoadConfig } from '@editor/type';
|
|
28
|
+
import type { CompareCategory, CompareFormLoadConfig, Services } from '@editor/type';
|
|
28
29
|
import { getCodeBlockFormConfig } from '@editor/utils/code-block';
|
|
29
30
|
|
|
30
31
|
defineOptions({
|
|
@@ -61,21 +62,33 @@ const props = withDefaults(
|
|
|
61
62
|
* 因此在差异对比场景下也需要透传,避免出现 `formState.xxx is undefined` 的运行时错误。
|
|
62
63
|
*/
|
|
63
64
|
extendState?: (_state: FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
65
|
+
/**
|
|
66
|
+
* 外部透传的基础 formState(通常来自 PropsPanel 主属性表单)。
|
|
67
|
+
* CompareForm 会提取其中的扩展字段覆盖到自己的 formState,保证 filterFunction 上下文一致。
|
|
68
|
+
*/
|
|
69
|
+
baseFormState?: FormState;
|
|
70
|
+
/** 需要走 self diff 的字段类型(例如 mod-cond)。 */
|
|
71
|
+
selfDiffFieldTypes?: string[];
|
|
64
72
|
/**
|
|
65
73
|
* 自定义 FormConfig 加载逻辑。传入后将接管内置的按 `category`(node/data-source/code-block)
|
|
66
74
|
* 取配置逻辑,调用方可根据业务自行返回(或异步返回)表单配置。可通过
|
|
67
75
|
* `ctx.defaultLoadConfig()` 复用默认结果再做二次加工。返回的 config 直接用于对比展示。
|
|
68
76
|
*/
|
|
69
77
|
loadConfig?: CompareFormLoadConfig;
|
|
78
|
+
/** 编辑器服务集合,由调用方传入(不再通过 inject('services') 获取)。 */
|
|
79
|
+
services: Services;
|
|
70
80
|
}>(),
|
|
71
81
|
{
|
|
72
82
|
category: 'node',
|
|
73
83
|
labelWidth: '120px',
|
|
84
|
+
services: () => useServices(),
|
|
85
|
+
extendState: (state: FormState) => state,
|
|
74
86
|
},
|
|
75
87
|
);
|
|
76
88
|
|
|
77
|
-
const { propsService, dataSourceService, codeBlockService, editorService } =
|
|
78
|
-
|
|
89
|
+
const { propsService, dataSourceService, codeBlockService, editorService } = props.services;
|
|
90
|
+
|
|
91
|
+
provide('services', props.services);
|
|
79
92
|
|
|
80
93
|
const config = ref<FormConfig>([]);
|
|
81
94
|
|
|
@@ -170,6 +183,10 @@ const removeStyleDisplayConfig = (formConfig: FormConfig): FormConfig =>
|
|
|
170
183
|
};
|
|
171
184
|
});
|
|
172
185
|
|
|
186
|
+
const mergedExtendState = (state: FormState) => {
|
|
187
|
+
return props.extendState(props.baseFormState || state);
|
|
188
|
+
};
|
|
189
|
+
|
|
173
190
|
/**
|
|
174
191
|
* 内置的默认 FormConfig 加载逻辑:按 `category` 从对应 service / 工具取配置。
|
|
175
192
|
* 作为 ctx.defaultLoadConfig 透传给自定义 `loadConfig`,方便复用与二次加工。
|
|
@@ -185,7 +202,11 @@ const defaultLoadConfig = async (): Promise<FormConfig> => {
|
|
|
185
202
|
);
|
|
186
203
|
}
|
|
187
204
|
case 'data-source': {
|
|
188
|
-
|
|
205
|
+
const config = dataSourceService.getFormConfig(props.type || 'base');
|
|
206
|
+
// 数据源表单外层 tab 的「数据定义」项 status 为 'fields',tab-pane name 随之为 'fields'。
|
|
207
|
+
// 未显式设置 active 时,Tabs 默认取 '0',与 'fields' 不匹配会导致打开弹窗时无默认激活项,
|
|
208
|
+
// 这里与 DataSourceConfigPanel 保持一致,默认激活「数据定义」tab。
|
|
209
|
+
return config.map((item) => ('type' in item && item.type === 'tab' ? { ...item, active: 'fields' } : item));
|
|
189
210
|
}
|
|
190
211
|
case 'code-block': {
|
|
191
212
|
return getCodeBlockFormConfig({
|
|
@@ -242,7 +263,7 @@ const stage = computed(() => editorService.get('stage'));
|
|
|
242
263
|
watchEffect(() => {
|
|
243
264
|
if (formRef.value) {
|
|
244
265
|
formRef.value.formState.stage = stage.value;
|
|
245
|
-
formRef.value.formState.services = services;
|
|
266
|
+
formRef.value.formState.services = props.services;
|
|
246
267
|
}
|
|
247
268
|
});
|
|
248
269
|
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
<template #suffix>
|
|
31
31
|
<Icon :icon="Coin" />
|
|
32
32
|
</template>
|
|
33
|
-
<template #default="
|
|
33
|
+
<template #default="slotProps">
|
|
34
34
|
<div style="display: flex; flex-direction: column; line-height: 1.2em">
|
|
35
|
-
<div>{{ item
|
|
36
|
-
<span style="font-size: 10px; color: rgba(0, 0, 0, 0.6)">{{ item
|
|
35
|
+
<div>{{ slotProps?.item?.text || '' }}</div>
|
|
36
|
+
<span style="font-size: 10px; color: rgba(0, 0, 0, 0.6)">{{ slotProps?.item?.value || '' }}</span>
|
|
37
37
|
</div>
|
|
38
38
|
</template>
|
|
39
39
|
</component>
|
package/src/index.ts
CHANGED
|
@@ -44,6 +44,8 @@ export { default as stageOverlayService } from './services/stageOverlay';
|
|
|
44
44
|
export { default as uiService } from './services/ui';
|
|
45
45
|
export { default as codeBlockService } from './services/codeBlock';
|
|
46
46
|
export { default as depService } from './services/dep';
|
|
47
|
+
export { default as componentListService } from './services/componentList';
|
|
48
|
+
export { default as keybindingService } from './services/keybinding';
|
|
47
49
|
export { default as ComponentListPanel } from './layouts/sidebar/ComponentListPanel.vue';
|
|
48
50
|
export { default as LayerPanel } from './layouts/sidebar/layer/LayerPanel.vue';
|
|
49
51
|
export { default as CodeSelect } from './fields/CodeSelect.vue';
|
|
@@ -74,6 +76,8 @@ export { default as CompareForm } from './components/CompareForm.vue';
|
|
|
74
76
|
export { default as HistoryListBucket } from './layouts/history-list/Bucket.vue';
|
|
75
77
|
export { default as HistoryListBucketTab } from './layouts/history-list/BucketTab.vue';
|
|
76
78
|
export { default as HistoryDiffDialog } from './layouts/history-list/HistoryDiffDialog.vue';
|
|
79
|
+
export { confirmHistoryAction } from './layouts/history-list/composables';
|
|
80
|
+
export { useHistoryRevert } from './layouts/history-list/useHistoryRevert';
|
|
77
81
|
export { default as FloatingBox } from './components/FloatingBox.vue';
|
|
78
82
|
export { default as Tree } from './components/Tree.vue';
|
|
79
83
|
export { default as TreeNode } from './components/TreeNode.vue';
|
package/src/layouts/NavMenu.vue
CHANGED
|
@@ -90,7 +90,7 @@ const getConfig = (item: MenuItem): (MenuButton | MenuComponent)[] => {
|
|
|
90
90
|
className: 'undo',
|
|
91
91
|
icon: markRaw(Back),
|
|
92
92
|
tooltip: `后退(${ctrl}+z)`,
|
|
93
|
-
disabled: () => !historyService.
|
|
93
|
+
disabled: () => !historyService.canUndo('page', editorService.get('page')?.id),
|
|
94
94
|
handler: () => editorService.undo(),
|
|
95
95
|
});
|
|
96
96
|
break;
|
|
@@ -100,7 +100,7 @@ const getConfig = (item: MenuItem): (MenuButton | MenuComponent)[] => {
|
|
|
100
100
|
className: 'redo',
|
|
101
101
|
icon: markRaw(Right),
|
|
102
102
|
tooltip: `前进(${ctrl}+Shift+z)`,
|
|
103
|
-
disabled: () => !historyService.
|
|
103
|
+
disabled: () => !historyService.canRedo('page', editorService.get('page')?.id),
|
|
104
104
|
handler: () => editorService.redo(),
|
|
105
105
|
});
|
|
106
106
|
break;
|
|
@@ -49,6 +49,13 @@
|
|
|
49
49
|
>{{ sourceLabel(group.source) }}</span
|
|
50
50
|
>
|
|
51
51
|
|
|
52
|
+
<span
|
|
53
|
+
v-if="!merged && group.operator"
|
|
54
|
+
class="m-editor-history-list-item-operator"
|
|
55
|
+
:title="`操作人:${group.operator}`"
|
|
56
|
+
>{{ group.operator }}</span
|
|
57
|
+
>
|
|
58
|
+
|
|
52
59
|
<span
|
|
53
60
|
v-if="!merged && group.time"
|
|
54
61
|
class="m-editor-history-list-item-time"
|
|
@@ -103,6 +110,9 @@
|
|
|
103
110
|
:title="`操作途径:${sourceLabel(s.source)}`"
|
|
104
111
|
>{{ sourceLabel(s.source) }}</span
|
|
105
112
|
>
|
|
113
|
+
<span v-if="s.operator" class="m-editor-history-list-item-operator" :title="`操作人:${s.operator}`">{{
|
|
114
|
+
s.operator
|
|
115
|
+
}}</span>
|
|
106
116
|
<span v-if="s.time" class="m-editor-history-list-item-time" :title="s.timeTitle || s.time">{{ s.time }}</span>
|
|
107
117
|
</li>
|
|
108
118
|
</ul>
|
|
@@ -43,9 +43,11 @@
|
|
|
43
43
|
:data-source-type="payload.dataSourceType"
|
|
44
44
|
:value="rightValue"
|
|
45
45
|
:last-value="leftValue"
|
|
46
|
+
:base-form-state="compareFormState"
|
|
46
47
|
:extend-state="extendState"
|
|
47
48
|
:load-config="loadConfig"
|
|
48
49
|
:self-diff-field-types="selfDiffFieldTypes"
|
|
50
|
+
:services="props.services"
|
|
49
51
|
height="70vh"
|
|
50
52
|
/>
|
|
51
53
|
|
|
@@ -79,8 +81,9 @@ import { TMagicButton, TMagicDialog, TMagicRadioButton, TMagicRadioGroup, TMagic
|
|
|
79
81
|
import type { FormState } from '@tmagic/form';
|
|
80
82
|
|
|
81
83
|
import CompareForm from '@editor/components/CompareForm.vue';
|
|
84
|
+
import { useServices } from '@editor/hooks/use-services';
|
|
82
85
|
import CodeEditor from '@editor/layouts/CodeEditor.vue';
|
|
83
|
-
import type { CompareCategory, CompareFormLoadConfig, DiffDialogPayload } from '@editor/type';
|
|
86
|
+
import type { CompareCategory, CompareFormLoadConfig, DiffDialogPayload, Services } from '@editor/type';
|
|
84
87
|
|
|
85
88
|
defineOptions({
|
|
86
89
|
name: 'MEditorHistoryDiffDialog',
|
|
@@ -88,6 +91,8 @@ defineOptions({
|
|
|
88
91
|
|
|
89
92
|
const props = withDefaults(
|
|
90
93
|
defineProps<{
|
|
94
|
+
/** 编辑器服务集合,由调用方传入(不再通过 inject('services') 获取)。 */
|
|
95
|
+
services: Services;
|
|
91
96
|
/**
|
|
92
97
|
* 来自 Editor 顶层的 `extendFormState`,用于扩展 MForm.formState。
|
|
93
98
|
* 透传给 CompareForm,从而让差异对比时表单 item 中依赖业务上下文的
|
|
@@ -103,8 +108,10 @@ const props = withDefaults(
|
|
|
103
108
|
isConfirm?: boolean;
|
|
104
109
|
onConfirm?: () => void;
|
|
105
110
|
selfDiffFieldTypes?: string[];
|
|
111
|
+
compareFormState?: FormState;
|
|
106
112
|
}>(),
|
|
107
113
|
{
|
|
114
|
+
services: () => useServices(),
|
|
108
115
|
width: '900px',
|
|
109
116
|
},
|
|
110
117
|
);
|