@tmagic/editor 1.8.0-beta.2 → 1.8.0-beta.3
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 +9 -0
- package/dist/es/components/CompareForm.vue_vue_type_script_setup_true_lang.js +32 -28
- package/dist/es/editorProps.js +2 -0
- package/dist/es/fields/CodeLink.vue_vue_type_script_setup_true_lang.js +2 -5
- package/dist/es/hooks/use-stage.js +2 -1
- package/dist/es/index.js +3 -1
- package/dist/es/layouts/CodeEditor.vue_vue_type_script_setup_true_lang.js +2 -5
- package/dist/es/layouts/history-list/Bucket.vue_vue_type_script_setup_true_lang.js +33 -14
- package/dist/es/layouts/history-list/BucketTab.js +5 -0
- package/dist/es/layouts/history-list/{CodeBlockTab.vue_vue_type_script_setup_true_lang.js → BucketTab.vue_vue_type_script_setup_true_lang.js} +27 -16
- package/dist/es/layouts/history-list/GroupRow.vue_vue_type_script_setup_true_lang.js +71 -53
- package/dist/es/layouts/history-list/HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js +78 -28
- package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js +136 -66
- package/dist/es/layouts/history-list/InitialRow.vue_vue_type_script_setup_true_lang.js +15 -9
- package/dist/es/layouts/history-list/PageTab.vue_vue_type_script_setup_true_lang.js +12 -6
- package/dist/es/layouts/history-list/composables.js +20 -2
- package/dist/es/services/history.js +5 -2
- package/dist/es/style.css +44 -12
- package/dist/style.css +44 -12
- package/dist/tmagic-editor.umd.cjs +479 -326
- package/package.json +7 -7
- package/src/Editor.vue +8 -0
- package/src/components/CompareForm.vue +32 -19
- package/src/editorProps.ts +7 -0
- package/src/fields/CodeLink.vue +2 -5
- package/src/hooks/use-stage.ts +1 -0
- package/src/index.ts +2 -0
- package/src/layouts/CodeEditor.vue +2 -5
- package/src/layouts/history-list/Bucket.vue +53 -28
- package/src/layouts/history-list/BucketTab.vue +77 -0
- package/src/layouts/history-list/GroupRow.vue +95 -60
- package/src/layouts/history-list/HistoryDiffDialog.vue +51 -32
- package/src/layouts/history-list/HistoryListPanel.vue +161 -52
- package/src/layouts/history-list/InitialRow.vue +17 -6
- package/src/layouts/history-list/PageTab.vue +20 -6
- package/src/layouts/history-list/composables.ts +32 -1
- package/src/services/history.ts +3 -0
- package/src/theme/history-list-panel.scss +52 -13
- package/src/type.ts +90 -0
- package/types/index.d.ts +295 -135
- package/dist/es/layouts/history-list/CodeBlockTab.js +0 -5
- package/dist/es/layouts/history-list/DataSourceTab.js +0 -5
- package/dist/es/layouts/history-list/DataSourceTab.vue_vue_type_script_setup_true_lang.js +0 -62
- package/src/layouts/history-list/CodeBlockTab.vue +0 -61
- package/src/layouts/history-list/DataSourceTab.vue +0 -61
package/src/type.ts
CHANGED
|
@@ -199,6 +199,11 @@ export interface StageOptions {
|
|
|
199
199
|
*/
|
|
200
200
|
alwaysMultiSelect?: boolean;
|
|
201
201
|
disabledRule?: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* 禁用「非点击画布选中组件时(如从图层树、面包屑等外部选中),对选中区域做高亮闪烁提示」,
|
|
204
|
+
* 默认 false(即默认开启闪烁)
|
|
205
|
+
*/
|
|
206
|
+
disabledFlashTip?: boolean;
|
|
202
207
|
zoom?: number;
|
|
203
208
|
/** 画布双击前的钩子函数,返回 false 则阻止默认的双击行为 */
|
|
204
209
|
beforeDblclick?: (event: MouseEvent) => Promise<boolean | void> | boolean | void;
|
|
@@ -475,6 +480,63 @@ export interface SideComponent extends MenuComponent {
|
|
|
475
480
|
}
|
|
476
481
|
// #endregion SideComponent
|
|
477
482
|
|
|
483
|
+
// #region HistoryListExtraTab
|
|
484
|
+
/**
|
|
485
|
+
* 历史记录面板(HistoryListPanel)的自定义扩展 tab。
|
|
486
|
+
*
|
|
487
|
+
* 业务方可通过 Editor 的 `historyListExtraTabs` 注入额外的历史记录 tab,
|
|
488
|
+
* 例如某个自定义模块维护自己的操作历史时,可以在历史记录面板中增加一个
|
|
489
|
+
* 独立的 tab 来展示与回滚。内置的「页面 / 数据源 / 代码块」三个 tab 之后
|
|
490
|
+
* 会依次追加这些扩展 tab。
|
|
491
|
+
*/
|
|
492
|
+
export interface HistoryListExtraTab {
|
|
493
|
+
/** tab 唯一标识,作为 TMagicTabs 的 name */
|
|
494
|
+
name: string;
|
|
495
|
+
/** tab 显示文案,支持传入函数以展示动态内容(如记录数量) */
|
|
496
|
+
label: string | (() => string);
|
|
497
|
+
/** tab 内容区渲染的组件(Vue 组件或字符串标签) */
|
|
498
|
+
component: any;
|
|
499
|
+
/** 传入内容组件的 props */
|
|
500
|
+
props?: Record<string, any>;
|
|
501
|
+
/** 内容组件的事件监听 */
|
|
502
|
+
listeners?: Record<string, (..._args: any[]) => any>;
|
|
503
|
+
}
|
|
504
|
+
// #endregion HistoryListExtraTab
|
|
505
|
+
|
|
506
|
+
// #region CompareForm
|
|
507
|
+
/**
|
|
508
|
+
* 对比表单(CompareForm)的对比类型:
|
|
509
|
+
* - node: 节点组件,按 `type` 从 propsService 获取属性表单配置
|
|
510
|
+
* - data-source: 数据源,按 `type`(base/http/...) 从 dataSourceService 获取数据源表单配置
|
|
511
|
+
* - code-block: 数据源代码块,使用内置的代码块表单配置
|
|
512
|
+
*/
|
|
513
|
+
export type CompareCategory = 'node' | 'data-source' | 'code-block';
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* 自定义 `loadConfig` 时回传的上下文,聚合了组件当前的对比入参,
|
|
517
|
+
* 方便调用方在外部按需拼装 FormConfig。
|
|
518
|
+
*/
|
|
519
|
+
export interface CompareFormLoadConfigContext {
|
|
520
|
+
/** 对比类型,见 CompareCategory */
|
|
521
|
+
category: string;
|
|
522
|
+
/** 节点 / 数据源类型 */
|
|
523
|
+
type?: string;
|
|
524
|
+
/** 数据源代码块场景下的数据源类型 */
|
|
525
|
+
dataSourceType?: string;
|
|
526
|
+
/**
|
|
527
|
+
* 内置的默认 FormConfig 加载逻辑(按 `category` 从 propsService / dataSourceService /
|
|
528
|
+
* 代码块工具取配置)。自定义 `loadConfig` 可调用它复用默认结果,再做二次加工。
|
|
529
|
+
*/
|
|
530
|
+
defaultLoadConfig: () => Promise<FormConfig>;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* 自定义 FormConfig 加载逻辑。传入后将接管内置的按 `category` 取配置逻辑,
|
|
535
|
+
* 可通过 `ctx.defaultLoadConfig()` 复用默认结果再做二次加工。
|
|
536
|
+
*/
|
|
537
|
+
export type CompareFormLoadConfig = (ctx: CompareFormLoadConfigContext) => FormConfig | Promise<FormConfig>;
|
|
538
|
+
// #endregion CompareForm
|
|
539
|
+
|
|
478
540
|
// #region SideItemKey
|
|
479
541
|
export enum SideItemKey {
|
|
480
542
|
COMPONENT_LIST = 'component-list',
|
|
@@ -651,6 +713,10 @@ export interface StepValue {
|
|
|
651
713
|
* 不影响 undo/redo 行为;缺省时面板会根据节点 / propPath 自动生成描述。
|
|
652
714
|
*/
|
|
653
715
|
historyDescription?: string;
|
|
716
|
+
/**
|
|
717
|
+
* 入栈时间戳(毫秒)。在 historyService.push 时自动写入(若调用方未指定),仅用于历史面板展示。
|
|
718
|
+
*/
|
|
719
|
+
timestamp?: number;
|
|
654
720
|
}
|
|
655
721
|
// #endregion StepValue
|
|
656
722
|
|
|
@@ -675,6 +741,8 @@ export interface CodeBlockStepValue {
|
|
|
675
741
|
changeRecords?: ChangeRecord[];
|
|
676
742
|
/** 调用方可选传入的人类可读描述,用于历史面板展示;不影响 undo/redo 行为。 */
|
|
677
743
|
historyDescription?: string;
|
|
744
|
+
/** 入栈时间戳(毫秒),入栈时自动写入,仅用于历史面板展示。 */
|
|
745
|
+
timestamp?: number;
|
|
678
746
|
}
|
|
679
747
|
// #endregion CodeBlockStepValue
|
|
680
748
|
|
|
@@ -699,6 +767,8 @@ export interface DataSourceStepValue {
|
|
|
699
767
|
changeRecords?: ChangeRecord[];
|
|
700
768
|
/** 调用方可选传入的人类可读描述,用于历史面板展示;不影响 undo/redo 行为。 */
|
|
701
769
|
historyDescription?: string;
|
|
770
|
+
/** 入栈时间戳(毫秒),入栈时自动写入,仅用于历史面板展示。 */
|
|
771
|
+
timestamp?: number;
|
|
702
772
|
}
|
|
703
773
|
// #endregion DataSourceStepValue
|
|
704
774
|
|
|
@@ -1056,3 +1126,23 @@ export interface DslOpOptions extends HistoryOpOptions {
|
|
|
1056
1126
|
doNotSelect?: boolean;
|
|
1057
1127
|
doNotSwitchPage?: boolean;
|
|
1058
1128
|
}
|
|
1129
|
+
|
|
1130
|
+
/** 差异对话框的入参 */
|
|
1131
|
+
export interface DiffDialogPayload {
|
|
1132
|
+
/** 表单类别 */
|
|
1133
|
+
category: CompareCategory;
|
|
1134
|
+
/** 节点类型 / 数据源类型 */
|
|
1135
|
+
type?: string;
|
|
1136
|
+
/** 代码块场景下的数据源类型 */
|
|
1137
|
+
dataSourceType?: string;
|
|
1138
|
+
/** 该 step 修改前的值(oldNode / oldSchema / oldContent) */
|
|
1139
|
+
lastValue: Record<string, any>;
|
|
1140
|
+
/** 该 step 修改后的值(newNode / newSchema / newContent) */
|
|
1141
|
+
value: Record<string, any>;
|
|
1142
|
+
/** 当前编辑器中实际的最新值;不传或为 null 时禁用「与当前对比」 */
|
|
1143
|
+
currentValue?: Record<string, any> | null;
|
|
1144
|
+
/** 用于标题展示的目标名称 */
|
|
1145
|
+
targetLabel?: string;
|
|
1146
|
+
/** 用于标题展示的目标 id */
|
|
1147
|
+
id?: string | number;
|
|
1148
|
+
}
|