@tmagic/editor 1.8.0-beta.5 → 1.8.0-beta.7
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/fields/CodeSelectCol.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +8 -2
- package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +25 -8
- package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +6 -4
- package/dist/es/fields/DataSourceMethods.vue_vue_type_script_setup_true_lang.js +25 -12
- package/dist/es/fields/StyleSetter/components/Border.vue_vue_type_script_setup_true_lang.js +27 -5
- package/dist/es/index.js +2 -2
- package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js +10 -14
- package/dist/es/layouts/history-list/InitialRow.vue_vue_type_script_setup_true_lang.js +12 -4
- package/dist/es/layouts/history-list/composables.js +28 -77
- package/dist/es/layouts/sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/layouts/sidebar/data-source/DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js +16 -3
- package/dist/es/layouts/sidebar/data-source/DataSourceListPanel.vue_vue_type_script_setup_true_lang.js +23 -1
- package/dist/es/services/codeBlock.js +30 -19
- package/dist/es/services/dataSource.js +29 -21
- package/dist/es/services/editor.js +52 -33
- package/dist/es/services/history.js +10 -15
- package/dist/es/style.css +4 -1
- package/dist/es/utils/data-source/index.js +2 -0
- package/dist/es/utils/editor.js +68 -48
- package/dist/es/utils/history.js +42 -33
- package/dist/style.css +4 -1
- package/dist/tmagic-editor.umd.cjs +412 -295
- package/package.json +7 -7
- package/src/fields/CodeSelectCol.vue +7 -1
- package/src/fields/DataSourceFieldSelect/FieldSelect.vue +16 -2
- package/src/fields/DataSourceFields.vue +37 -8
- package/src/fields/DataSourceMethodSelect.vue +9 -4
- package/src/fields/DataSourceMethods.vue +42 -21
- package/src/fields/StyleSetter/components/Border.vue +15 -6
- package/src/layouts/history-list/HistoryListPanel.vue +12 -25
- package/src/layouts/history-list/InitialRow.vue +3 -0
- package/src/layouts/history-list/composables.ts +34 -94
- package/src/layouts/sidebar/Sidebar.vue +2 -2
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +31 -2
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +26 -1
- package/src/services/codeBlock.ts +28 -22
- package/src/services/dataSource.ts +29 -24
- package/src/services/editor.ts +41 -37
- package/src/services/history.ts +19 -25
- package/src/theme/style-setter/border.scss +4 -1
- package/src/type.ts +38 -26
- package/src/utils/data-source/index.ts +2 -0
- package/src/utils/editor.ts +125 -59
- package/src/utils/history.ts +48 -45
- package/types/index.d.ts +109 -112
package/types/index.d.ts
CHANGED
|
@@ -196,20 +196,20 @@ declare class CodeBlock extends BaseService {
|
|
|
196
196
|
}?: HistoryOpOptions): Promise<void>;
|
|
197
197
|
/**
|
|
198
198
|
* 下列 *AndGetHistoryId 方法与对应的写入方法行为完全一致,
|
|
199
|
-
*
|
|
199
|
+
* 返回值在 {@link DslOpWithHistoryIdsResult} 中同时包含原操作结果与本次写入的历史 uuid 列表,
|
|
200
200
|
* 可用于精确引用 / 定位该条历史记录(埋点、revert、跨端同步等)。
|
|
201
201
|
*
|
|
202
|
-
* 当本次操作未写入历史(doNotPushHistory 为 true
|
|
202
|
+
* 当本次操作未写入历史(doNotPushHistory 为 true、或无对应记录)时 historyIds 为 `[]`。
|
|
203
203
|
*/
|
|
204
|
-
/** 等价于 {@link setCodeDslById}
|
|
205
|
-
setCodeDslByIdAndGetHistoryId(id: Id, codeConfig: Partial<CodeBlockContent>, options?: HistoryOpOptionsWithChangeRecords): Promise<
|
|
206
|
-
/** 等价于 {@link setCodeDslByIdSync}
|
|
207
|
-
setCodeDslByIdSyncAndGetHistoryId(id: Id, codeConfig: Partial<CodeBlockContent>, force?: boolean, options?: HistoryOpOptionsWithChangeRecords):
|
|
204
|
+
/** 等价于 {@link setCodeDslById},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
|
|
205
|
+
setCodeDslByIdAndGetHistoryId(id: Id, codeConfig: Partial<CodeBlockContent>, options?: HistoryOpOptionsWithChangeRecords): Promise<DslOpWithHistoryIdsResult<void>>;
|
|
206
|
+
/** 等价于 {@link setCodeDslByIdSync},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
|
|
207
|
+
setCodeDslByIdSyncAndGetHistoryId(id: Id, codeConfig: Partial<CodeBlockContent>, force?: boolean, options?: HistoryOpOptionsWithChangeRecords): DslOpWithHistoryIdsResult<void>;
|
|
208
208
|
/**
|
|
209
|
-
* 等价于 {@link deleteCodeDslByIds}
|
|
210
|
-
*
|
|
209
|
+
* 等价于 {@link deleteCodeDslByIds},并额外返回本次写入的全部历史记录 uuid(按删除顺序)。
|
|
210
|
+
* 一次删除多个代码块会产生多条历史记录;未写入任何历史时 historyIds 为 `[]`。
|
|
211
211
|
*/
|
|
212
|
-
deleteCodeDslByIdsAndGetHistoryId(codeIds: Id[], options?: HistoryOpOptions): Promise<
|
|
212
|
+
deleteCodeDslByIdsAndGetHistoryId(codeIds: Id[], options?: HistoryOpOptions): Promise<DslOpWithHistoryIdsResult<void>>;
|
|
213
213
|
setParamsColConfig(config: TableColumnConfig): void;
|
|
214
214
|
getParamsColConfig(): TableColumnConfig | undefined;
|
|
215
215
|
/**
|
|
@@ -254,14 +254,13 @@ declare class CodeBlock extends BaseService {
|
|
|
254
254
|
*/
|
|
255
255
|
revert(id: Id, index: number): Promise<CodeBlockStepValue | null>;
|
|
256
256
|
/**
|
|
257
|
-
* 通过历史记录 uuid
|
|
258
|
-
* 仅无需调用方再传 codeBlockId 与 index:内部会按 uuid
|
|
259
|
-
*
|
|
257
|
+
* 通过历史记录 uuid 回滚代码块历史步骤,语义同 {@link revert},
|
|
258
|
+
* 仅无需调用方再传 codeBlockId 与 index:内部会按 uuid 在全部代码块栈中定位对应步骤后再回滚。
|
|
259
|
+
* 按数组顺序依次回滚,返回与入参同序的结果列表(某项失败时为 `null`)。
|
|
260
260
|
*
|
|
261
|
-
* @param
|
|
262
|
-
* @returns 反向后产生的新 step;找不到对应 uuid / 未应用时返回 null
|
|
261
|
+
* @param uuids 目标历史记录的 uuid 列表,通常由 {@link setCodeDslByIdAndGetHistoryId} 等方法返回的 `historyIds`
|
|
263
262
|
*/
|
|
264
|
-
revertById(
|
|
263
|
+
revertById(uuids: string[]): Promise<(CodeBlockStepValue | null)[]>;
|
|
265
264
|
/**
|
|
266
265
|
* 生成代码块唯一id
|
|
267
266
|
* @returns {Id} 代码块唯一id
|
|
@@ -404,17 +403,17 @@ declare class DataSource extends BaseService {
|
|
|
404
403
|
}?: HistoryOpOptions): void;
|
|
405
404
|
/**
|
|
406
405
|
* 下列 *AndGetHistoryId 方法与对应的 add / update / remove 行为完全一致,
|
|
407
|
-
*
|
|
408
|
-
*
|
|
406
|
+
* 返回值在 {@link DslOpWithHistoryIdsResult} 中同时包含原操作结果与本次写入历史栈的 uuid 列表({@link DataSourceStepValue.uuid}),
|
|
407
|
+
* 可用于精确引用 / 定位该条历史记录(埋点、revert、跨端同步等)。
|
|
409
408
|
*
|
|
410
|
-
* 当本次操作未写入历史(doNotPushHistory 为 true
|
|
409
|
+
* 当本次操作未写入历史(doNotPushHistory 为 true、或无对应记录)时 historyIds 为 `[]`。
|
|
411
410
|
*/
|
|
412
|
-
/** 等价于 {@link add}
|
|
413
|
-
addAndGetHistoryId(config: DataSourceSchema, options?: HistoryOpOptions):
|
|
414
|
-
/** 等价于 {@link update}
|
|
415
|
-
updateAndGetHistoryId(config: DataSourceSchema, options?: HistoryOpOptionsWithChangeRecords):
|
|
416
|
-
/** 等价于 {@link remove}
|
|
417
|
-
removeAndGetHistoryId(id: string, options?: HistoryOpOptions):
|
|
411
|
+
/** 等价于 {@link add},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
|
|
412
|
+
addAndGetHistoryId(config: DataSourceSchema, options?: HistoryOpOptions): DslOpWithHistoryIdsResult<DataSourceSchema>;
|
|
413
|
+
/** 等价于 {@link update},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
|
|
414
|
+
updateAndGetHistoryId(config: DataSourceSchema, options?: HistoryOpOptionsWithChangeRecords): DslOpWithHistoryIdsResult<DataSourceSchema>;
|
|
415
|
+
/** 等价于 {@link remove},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
|
|
416
|
+
removeAndGetHistoryId(id: string, options?: HistoryOpOptions): DslOpWithHistoryIdsResult<void>;
|
|
418
417
|
/**
|
|
419
418
|
* 撤销指定数据源的最近一次变更。
|
|
420
419
|
*
|
|
@@ -456,14 +455,13 @@ declare class DataSource extends BaseService {
|
|
|
456
455
|
*/
|
|
457
456
|
revert(id: Id, index: number): DataSourceStepValue | null;
|
|
458
457
|
/**
|
|
459
|
-
* 通过历史记录 uuid
|
|
460
|
-
* 仅无需调用方再传 dataSourceId 与 index:内部会按 uuid
|
|
461
|
-
*
|
|
458
|
+
* 通过历史记录 uuid 回滚数据源历史步骤,语义同 {@link revert},
|
|
459
|
+
* 仅无需调用方再传 dataSourceId 与 index:内部会按 uuid 在全部数据源栈中定位对应步骤后再回滚。
|
|
460
|
+
* 按数组顺序依次回滚,返回与入参同序的结果列表(某项失败时为 `null`)。
|
|
462
461
|
*
|
|
463
|
-
* @param
|
|
464
|
-
* @returns 反向后产生的新 step;找不到对应 uuid / 未应用时返回 null
|
|
462
|
+
* @param uuids 目标历史记录的 uuid 列表,通常由 {@link addAndGetHistoryId} 等方法返回的 `historyIds`
|
|
465
463
|
*/
|
|
466
|
-
revertById(
|
|
464
|
+
revertById(uuids: string[]): (DataSourceStepValue | null)[];
|
|
467
465
|
createId(): string;
|
|
468
466
|
getDataSourceById(id: string): DataSourceSchema | undefined;
|
|
469
467
|
resetState(): void;
|
|
@@ -801,29 +799,29 @@ declare class Editor extends BaseService {
|
|
|
801
799
|
}?: DslOpOptions): Promise<void>;
|
|
802
800
|
/**
|
|
803
801
|
* 下列 *AndGetHistoryId 方法与对应的普通操作(add / remove / update ...)行为完全一致,
|
|
804
|
-
*
|
|
805
|
-
*
|
|
802
|
+
* 返回值在 {@link DslOpWithHistoryIdsResult} 中同时包含原操作结果与本次写入历史栈的 uuid 列表({@link StepValue.uuid}),
|
|
803
|
+
* 可用于精确引用 / 定位该条历史记录(埋点、revert、跨端同步等)。
|
|
806
804
|
*
|
|
807
|
-
* 当本次操作未写入历史(doNotPushHistory 为 true、或操作无实际变更 /
|
|
805
|
+
* 当本次操作未写入历史(doNotPushHistory 为 true、或操作无实际变更 / 提前返回)时 historyIds 为 `[]`。
|
|
808
806
|
*/
|
|
809
|
-
/** 等价于 {@link add}
|
|
810
|
-
addAndGetHistoryId(addNode: AddMNode | MNode[], parent?: MContainer | null, options?: DslOpOptions): Promise<
|
|
811
|
-
/** 等价于 {@link remove}
|
|
812
|
-
removeAndGetHistoryId(nodeOrNodeList: MNode | MNode[], options?: DslOpOptions): Promise<
|
|
813
|
-
/** 等价于 {@link update}
|
|
807
|
+
/** 等价于 {@link add},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
|
|
808
|
+
addAndGetHistoryId(addNode: AddMNode | MNode[], parent?: MContainer | null, options?: DslOpOptions): Promise<DslOpWithHistoryIdsResult<MNode | MNode[]>>;
|
|
809
|
+
/** 等价于 {@link remove},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
|
|
810
|
+
removeAndGetHistoryId(nodeOrNodeList: MNode | MNode[], options?: DslOpOptions): Promise<DslOpWithHistoryIdsResult<void>>;
|
|
811
|
+
/** 等价于 {@link update},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
|
|
814
812
|
updateAndGetHistoryId(config: MNode | MNode[], data?: {
|
|
815
813
|
changeRecords?: ChangeRecord[];
|
|
816
814
|
changeRecordList?: ChangeRecord[][];
|
|
817
815
|
doNotPushHistory?: boolean;
|
|
818
816
|
historyDescription?: string;
|
|
819
817
|
historySource?: HistoryOpSource;
|
|
820
|
-
}): Promise<
|
|
821
|
-
/** 等价于 {@link moveLayer}
|
|
822
|
-
moveLayerAndGetHistoryId(offset: number | LayerOffset, options?: DslOpOptions): Promise<
|
|
823
|
-
/** 等价于 {@link moveToContainer}
|
|
824
|
-
moveToContainerAndGetHistoryId(config: MNode | MNode[], targetId: Id, options?: DslOpOptions): Promise<
|
|
825
|
-
/** 等价于 {@link dragTo}
|
|
826
|
-
dragToAndGetHistoryId(config: MNode | MNode[], targetParent: MContainer, targetIndex: number, options?: DslOpOptions): Promise<
|
|
818
|
+
}): Promise<DslOpWithHistoryIdsResult<MNode | MNode[]>>;
|
|
819
|
+
/** 等价于 {@link moveLayer},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
|
|
820
|
+
moveLayerAndGetHistoryId(offset: number | LayerOffset, options?: DslOpOptions): Promise<DslOpWithHistoryIdsResult<void>>;
|
|
821
|
+
/** 等价于 {@link moveToContainer},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
|
|
822
|
+
moveToContainerAndGetHistoryId(config: MNode | MNode[], targetId: Id, options?: DslOpOptions): Promise<DslOpWithHistoryIdsResult<MNode | MNode[]>>;
|
|
823
|
+
/** 等价于 {@link dragTo},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
|
|
824
|
+
dragToAndGetHistoryId(config: MNode | MNode[], targetParent: MContainer, targetIndex: number, options?: DslOpOptions): Promise<DslOpWithHistoryIdsResult<void>>;
|
|
827
825
|
/**
|
|
828
826
|
* 撤销当前操作
|
|
829
827
|
* @returns 被撤销的操作
|
|
@@ -852,14 +850,13 @@ declare class Editor extends BaseService {
|
|
|
852
850
|
*/
|
|
853
851
|
revertPageStep(index: number): Promise<StepValue | null>;
|
|
854
852
|
/**
|
|
855
|
-
* 通过历史记录 uuid
|
|
856
|
-
* 仅入参从 index 改为 uuid
|
|
857
|
-
*
|
|
853
|
+
* 通过历史记录 uuid 回滚当前页面的历史步骤,语义与 {@link revertPageStep} 完全一致,
|
|
854
|
+
* 仅入参从 index 改为 uuid 列表({@link StepValue.uuid})。按数组顺序依次回滚,
|
|
855
|
+
* 返回与入参同序的结果列表(某项失败时为 `null`)。
|
|
858
856
|
*
|
|
859
|
-
* @param
|
|
860
|
-
* @returns 反向后产生的新 step;找不到对应 uuid / 未应用 / 反向失败时返回 null
|
|
857
|
+
* @param uuids 目标历史记录的 uuid 列表,通常由 *AndGetHistoryId 方法返回的 `historyIds`
|
|
861
858
|
*/
|
|
862
|
-
revertPageStepById(
|
|
859
|
+
revertPageStepById(uuids: string[]): Promise<(StepValue | null)[]>;
|
|
863
860
|
/**
|
|
864
861
|
* 跳转当前页面历史栈到指定游标位置。
|
|
865
862
|
*
|
|
@@ -1170,13 +1167,10 @@ declare class History extends BaseService {
|
|
|
1170
1167
|
*/
|
|
1171
1168
|
getPageHistoryGroups(pageId?: Id): PageHistoryGroup[];
|
|
1172
1169
|
/**
|
|
1173
|
-
* 取出全部代码块的历史栈,按 codeBlockId
|
|
1174
|
-
*
|
|
1175
|
-
* - 这正是"代码块/数据源各自按 id 分栈"的天然表现,再叠加"连续修改同目标的相邻步骤合并展示"。
|
|
1176
|
-
* - 合并后 group 暴露子步骤数组,UI 可展开查看每一步的 changeRecords。
|
|
1177
|
-
* - applied 字段:组内最后一步是否处于已应用段。
|
|
1170
|
+
* 取出全部代码块的历史栈,按 codeBlockId 分桶展示。
|
|
1171
|
+
* 同一栈内每条操作记录独立成组,不做相邻 update 合并。
|
|
1178
1172
|
*/
|
|
1179
|
-
getCodeBlockHistoryGroups():
|
|
1173
|
+
getCodeBlockHistoryGroups(): StackHistoryGroup<CodeBlockStepValue, 'code-block'>[];
|
|
1180
1174
|
/**
|
|
1181
1175
|
* 读取指定页面历史栈的当前游标(已应用步骤数量)。不传则取当前活动页。
|
|
1182
1176
|
* 没有对应栈时返回 0。
|
|
@@ -1224,9 +1218,9 @@ declare class History extends BaseService {
|
|
|
1224
1218
|
index: number;
|
|
1225
1219
|
} | null;
|
|
1226
1220
|
/**
|
|
1227
|
-
* 取出全部数据源的历史栈,按 dataSourceId
|
|
1221
|
+
* 取出全部数据源的历史栈,按 dataSourceId 分桶展示。同上,每条操作独立成组。
|
|
1228
1222
|
*/
|
|
1229
|
-
getDataSourceHistoryGroups():
|
|
1223
|
+
getDataSourceHistoryGroups(): StackHistoryGroup<DataSourceStepValue, 'data-source'>[];
|
|
1230
1224
|
/**
|
|
1231
1225
|
* 取出指定页面的栈;不传 pageId 时按当前活动页取。
|
|
1232
1226
|
*
|
|
@@ -1754,6 +1748,7 @@ interface EditorNodeInfo {
|
|
|
1754
1748
|
node: MNode | null;
|
|
1755
1749
|
parent: MContainer | null;
|
|
1756
1750
|
page: MPage | MPageFragment | null;
|
|
1751
|
+
path: MNode[];
|
|
1757
1752
|
}
|
|
1758
1753
|
interface AddMNode {
|
|
1759
1754
|
type: string;
|
|
@@ -2049,6 +2044,11 @@ type HistoryOpType = 'add' | 'remove' | 'update' | 'initial';
|
|
|
2049
2044
|
* 通过 `(string & {})` 允许业务侧扩展自定义途径字符串,同时保留内置值的自动补全。
|
|
2050
2045
|
*/
|
|
2051
2046
|
type HistoryOpSource = 'initial' | 'stage' | 'tree' | 'component-panel' | 'props' | 'code' | 'root-code' | 'stage-contextmenu' | 'tree-contextmenu' | 'toolbar' | 'shortcut' | 'rollback' | 'api' | 'ai' | 'sync' | 'unknown' | (string & {});
|
|
2047
|
+
/** *AndGetHistoryId 系列方法返回值:原操作结果 + 本次写入历史记录的 uuid 列表(未入栈时为 `[]`)。 */
|
|
2048
|
+
type DslOpWithHistoryIdsResult<T> = {
|
|
2049
|
+
result: T;
|
|
2050
|
+
historyIds: string[];
|
|
2051
|
+
};
|
|
2052
2052
|
/**
|
|
2053
2053
|
* 单条变更的 diff 描述,统一表达「页面节点 / 代码块 / 数据源」的变化内容,
|
|
2054
2054
|
* 被 {@link StepValue} / {@link CodeBlockStepValue} / {@link DataSourceStepValue} 的 `diff` 复用。
|
|
@@ -2244,41 +2244,28 @@ interface PageHistoryGroup {
|
|
|
2244
2244
|
isCurrent?: boolean;
|
|
2245
2245
|
}
|
|
2246
2246
|
/**
|
|
2247
|
-
*
|
|
2248
|
-
*
|
|
2249
|
-
* -
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
/** 关联的 codeBlock id */
|
|
2254
|
-
id: Id;
|
|
2255
|
-
/** 该分组的操作类型 */
|
|
2256
|
-
opType: HistoryOpType;
|
|
2257
|
-
/** 组内所有步骤,按时间正序 */
|
|
2258
|
-
steps: {
|
|
2259
|
-
step: CodeBlockStepValue;
|
|
2260
|
-
index: number;
|
|
2261
|
-
applied: boolean;
|
|
2262
|
-
isCurrent?: boolean;
|
|
2263
|
-
}[];
|
|
2264
|
-
/** 组内最后一步是否已应用,用于整组的状态展示 */
|
|
2265
|
-
applied: boolean;
|
|
2266
|
-
/** 是否为当前所在的分组(包含该栈最近一次已应用步骤的那一组)。 */
|
|
2267
|
-
isCurrent?: boolean;
|
|
2268
|
-
}
|
|
2269
|
-
/**
|
|
2270
|
-
* 数据源历史面板分组,结构同 CodeBlockHistoryGroup。
|
|
2247
|
+
* 数据源 / 代码块历史面板分组(按 id 分栈展示)。
|
|
2248
|
+
* 二者结构完全一致,仅 `kind` 与 step 类型不同,统一由该泛型描述:
|
|
2249
|
+
* - 数据源:`StackHistoryGroup<DataSourceStepValue, 'data-source'>`;
|
|
2250
|
+
* - 代码块:`StackHistoryGroup<CodeBlockStepValue, 'code-block'>`。
|
|
2251
|
+
*
|
|
2252
|
+
* 每条操作记录独立成组,不做相邻合并(与页面历史 {@link PageHistoryGroup} 不同),故 `steps` 恒为单元素。
|
|
2271
2253
|
*/
|
|
2272
|
-
interface
|
|
2273
|
-
|
|
2254
|
+
interface StackHistoryGroup<T extends BaseStepValue = BaseStepValue, K extends 'code-block' | 'data-source' = 'code-block' | 'data-source'> {
|
|
2255
|
+
/** 区分代码块 / 数据源。 */
|
|
2256
|
+
kind: K;
|
|
2257
|
+
/** 关联的代码块 / 数据源 id。 */
|
|
2274
2258
|
id: Id;
|
|
2259
|
+
/** 该分组的操作类型。 */
|
|
2275
2260
|
opType: HistoryOpType;
|
|
2261
|
+
/** 组内所有步骤,按时间正序(不做相邻合并,恒为单元素)。 */
|
|
2276
2262
|
steps: {
|
|
2277
|
-
step:
|
|
2263
|
+
step: T;
|
|
2278
2264
|
index: number;
|
|
2279
2265
|
applied: boolean;
|
|
2280
2266
|
isCurrent?: boolean;
|
|
2281
2267
|
}[];
|
|
2268
|
+
/** 组内最后一步是否已应用,用于整组的状态展示。 */
|
|
2282
2269
|
applied: boolean;
|
|
2283
2270
|
/** 是否为当前所在的分组(包含该栈最近一次已应用步骤的那一组)。 */
|
|
2284
2271
|
isCurrent?: boolean;
|
|
@@ -2397,6 +2384,8 @@ type AsyncHookPlugin<T extends Array<string>, C extends Record<T[number], (...ar
|
|
|
2397
2384
|
type SyncHookPlugin<T extends Array<string>, C extends Record<T[number], (...args: any) => any>> = AddPrefixToObject<PascalCasedProperties<SyncBeforeHook<T, C>>, 'before'> & AddPrefixToObject<PascalCasedProperties<SyncAfterHook<T, C>>, 'after'>;
|
|
2398
2385
|
interface EventBusEvent {
|
|
2399
2386
|
'edit-data-source': [id: string];
|
|
2387
|
+
'edit-data-source-method': [id: string, methodName: string];
|
|
2388
|
+
'edit-data-source-field': [id: string, fieldPath: string[]];
|
|
2400
2389
|
'remove-data-source': [id: string];
|
|
2401
2390
|
'edit-code': [id: string];
|
|
2402
2391
|
}
|
|
@@ -2419,7 +2408,9 @@ interface PageBarSortOptions extends PartSortableOptions {
|
|
|
2419
2408
|
}
|
|
2420
2409
|
type CustomContentMenuFunction = (menus: (MenuButton | MenuComponent)[], type: 'layer' | 'data-source' | 'viewer' | 'code-block') => (MenuButton | MenuComponent)[];
|
|
2421
2410
|
interface EditorEvents {
|
|
2422
|
-
'root-change': [value: StoreState['root'], preValue?: StoreState['root']
|
|
2411
|
+
'root-change': [value: StoreState['root'], preValue?: StoreState['root'], options?: {
|
|
2412
|
+
historySource?: HistoryOpSource;
|
|
2413
|
+
}];
|
|
2423
2414
|
select: [node: MNode | null];
|
|
2424
2415
|
add: [nodes: MNode[]];
|
|
2425
2416
|
remove: [nodes: MNode[]];
|
|
@@ -2492,8 +2483,11 @@ interface DiffDialogPayload {
|
|
|
2492
2483
|
* 各自实现一份,作为整体注入,避免把 describe* / isStep* 拆成多个独立 props 反复透传。
|
|
2493
2484
|
*/
|
|
2494
2485
|
interface HistoryRowDescriptor<T extends BaseStepValue = BaseStepValue> {
|
|
2495
|
-
/**
|
|
2496
|
-
|
|
2486
|
+
/**
|
|
2487
|
+
* 组级描述文案生成器,接收一个 group,返回展示文本。
|
|
2488
|
+
* 不传时回退到对组内最后一步调用 {@link describeStep}(适用于不做相邻合并、每组恒为单步的历史,如数据源/代码块)。
|
|
2489
|
+
*/
|
|
2490
|
+
describeGroup?: (_group: any) => string;
|
|
2497
2491
|
/** 单步描述文案生成器,接收一个 step,返回展示文本(合并组展开后的子步列表用)。 */
|
|
2498
2492
|
describeStep: (_step: T) => string;
|
|
2499
2493
|
/** 判断某个 step 是否可查看差异(前后值都存在)。不传则一律不展示差异入口。 */
|
|
@@ -2784,10 +2778,10 @@ declare const getRelativeStyle: (style?: Record<string, any>) => Record<string,
|
|
|
2784
2778
|
declare const getInitPositionStyle: (style: Record<string, any> | undefined, layout: Layout) => Record<string, any>;
|
|
2785
2779
|
declare const setChildrenLayout: (node: MContainer, layout: Layout) => MContainer;
|
|
2786
2780
|
declare const setLayout: (node: MNode, layout: Layout) => import("@tmagic/schema").MComponent | undefined;
|
|
2787
|
-
declare const change2Fixed: (node: MNode,
|
|
2781
|
+
declare const change2Fixed: (node: MNode, path: MNode[]) => {
|
|
2788
2782
|
[key: string]: any;
|
|
2789
2783
|
};
|
|
2790
|
-
declare const Fixed2Other: (node: MNode,
|
|
2784
|
+
declare const Fixed2Other: (node: MNode, path: MNode[], getLayout: (parent: MNode, node?: MNode) => Promise<Layout>) => Promise<Record<string, any>>;
|
|
2791
2785
|
declare const getGuideLineFromCache: (key: string) => number[];
|
|
2792
2786
|
declare const fixNodeLeft: (config: MNode, parent: MContainer, doc?: Document) => any;
|
|
2793
2787
|
declare const fixNodePosition: (config: MNode, parent: MContainer, stage: StageCore$1 | null) => import("@tmagic/schema").StyleSchema | undefined;
|
|
@@ -2815,7 +2809,7 @@ declare const resolveSelectedNode: (config: MNode | Id, getNodeInfoFn: (id: Id)
|
|
|
2815
2809
|
* @param getLayoutFn 获取父节点布局方式的回调函数
|
|
2816
2810
|
* @returns 处理后的节点配置(深拷贝)
|
|
2817
2811
|
*/
|
|
2818
|
-
declare const toggleFixedPosition: (dist: MNode, src: MNode,
|
|
2812
|
+
declare const toggleFixedPosition: (dist: MNode, src: MNode, path: MNode[], getLayoutFn: (parent: MNode, node?: MNode | null) => Promise<Layout>) => Promise<MNode>;
|
|
2819
2813
|
/**
|
|
2820
2814
|
* 根据键盘移动的偏移量计算节点的新样式
|
|
2821
2815
|
* 仅对 absolute 或 fixed 定位的节点生效;优先修改 top/left,若未设置则修改 bottom/right
|
|
@@ -3042,24 +3036,11 @@ declare const markStackSaved: <S extends {
|
|
|
3042
3036
|
}>(undoRedo?: UndoRedo<S>) => void;
|
|
3043
3037
|
/**
|
|
3044
3038
|
* 把单个「按 id 分栈」的历史栈(代码块 / 数据源)拆成若干 group:
|
|
3045
|
-
*
|
|
3046
|
-
* - 连续 'update' 合并到同一组,组内 steps 顺序就是发生顺序。
|
|
3039
|
+
* 每条操作记录独立成组,不做相邻 update 合并(与页面历史的合并策略不同)。
|
|
3047
3040
|
*
|
|
3048
3041
|
* 代码块与数据源除 `kind` 外结构完全一致,统一由本方法处理;`kind` 决定返回的具体分组类型。
|
|
3049
3042
|
*/
|
|
3050
|
-
declare const mergeStackSteps: <S extends BaseStepValue, K extends "code-block" | "data-source">(kind: K, id: Id, list: S[], cursor: number) =>
|
|
3051
|
-
kind: K;
|
|
3052
|
-
id: Id;
|
|
3053
|
-
opType: HistoryOpType;
|
|
3054
|
-
steps: {
|
|
3055
|
-
step: S;
|
|
3056
|
-
index: number;
|
|
3057
|
-
applied: boolean;
|
|
3058
|
-
isCurrent?: boolean;
|
|
3059
|
-
}[];
|
|
3060
|
-
applied: boolean;
|
|
3061
|
-
isCurrent?: boolean;
|
|
3062
|
-
}[];
|
|
3043
|
+
declare const mergeStackSteps: <S extends BaseStepValue, K extends "code-block" | "data-source">(kind: K, id: Id, list: S[], cursor: number) => StackHistoryGroup<S, K>[];
|
|
3063
3044
|
/**
|
|
3064
3045
|
* 把页面栈拆成若干 group:
|
|
3065
3046
|
* - 单节点的 'update' 按 targetId 与相邻同 targetId 的 update 合并到一个 group;
|
|
@@ -3075,15 +3056,27 @@ declare const mergePageSteps: (pageId: Id, list: StepValue[], cursor: number) =>
|
|
|
3075
3056
|
declare const detectPageTargetId: (step: StepValue) => Id | undefined;
|
|
3076
3057
|
/** 解析 StepValue 中的目标节点可读名(用于 UI 展示)。 */
|
|
3077
3058
|
declare const detectPageTargetName: (step: StepValue) => string | undefined;
|
|
3078
|
-
/**
|
|
3079
|
-
|
|
3059
|
+
/**
|
|
3060
|
+
* 把 `Record<Id, UndoRedo>` 整体序列化为 `Record<Id, SerializedUndoRedo>`。
|
|
3061
|
+
*
|
|
3062
|
+
* 序列化(深克隆)的同一趟里,只把每条 step 中可能含函数的 `diff` 用 serialize-javascript 序列化成字符串,
|
|
3063
|
+
* 其余字段(uuid / opType / timestamp / `modifiedNodeIds` Map 等)原样保留,交给 IndexedDB 结构化克隆。
|
|
3064
|
+
* 这样既能写入函数,又避免序列化整份快照的开销;读取时再由 {@link parseStacksStepDiff} 还原 diff。
|
|
3065
|
+
* 不含 `diff` 的元素(如通用栈)原样透传。
|
|
3066
|
+
*/
|
|
3067
|
+
declare const serializeStacks: <T extends {
|
|
3068
|
+
diff?: unknown;
|
|
3069
|
+
}>(stacks: Record<Id, UndoRedo<T>>) => Record<Id, SerializedUndoRedo<T>>;
|
|
3080
3070
|
/**
|
|
3081
3071
|
* 把 `Record<Id, SerializedUndoRedo>` 整体还原为 `Record<Id, UndoRedo>`。
|
|
3082
3072
|
* 还原时把每个栈的游标定位到最近一条已保存(`saved === true`)记录之后。
|
|
3073
|
+
*
|
|
3074
|
+
* 与 {@link serializeStacks} 相反:当传入 `parse`(parseDSL)时,把每条 step 中以字符串形式存储的 `diff`
|
|
3075
|
+
* 解析回真实对象(含函数);不含 `diff` 的元素(如通用栈)原样透传。
|
|
3083
3076
|
*/
|
|
3084
3077
|
declare const deserializeStacks: <T extends {
|
|
3085
3078
|
saved?: boolean;
|
|
3086
|
-
}>(stacks?: Record<Id, ReturnType<UndoRedo<T>["serialize"]
|
|
3079
|
+
}>(stacks?: Record<Id, ReturnType<UndoRedo<T>["serialize"]>>, parse?: (serialized: string) => unknown) => Record<Id, UndoRedo<T>>;
|
|
3087
3080
|
/**
|
|
3088
3081
|
* 按 id 从「按 id 分栈」的记录表(代码块 / 数据源)中获取(或创建)对应的 UndoRedo 栈。
|
|
3089
3082
|
*/
|
|
@@ -3093,6 +3086,8 @@ declare const getOrCreateStack: <T>(stacks: Record<Id, UndoRedo<T>>, id: Id) =>
|
|
|
3093
3086
|
* 用于把 cursor 钉在基线之上,保证 undo / canUndo / goto 都不会越过初始基线。
|
|
3094
3087
|
*/
|
|
3095
3088
|
declare const undoFloor: (undoRedo: UndoRedo<StepValue>) => number;
|
|
3089
|
+
/** 将单次 push 产生的 history uuid(或 null)转为 *AndGetHistoryId 返回用的 uuid 列表。 */
|
|
3090
|
+
declare const getLastPushedHistoryIds: (historyId: string | null) => string[];
|
|
3096
3091
|
//#endregion
|
|
3097
3092
|
//#region temp/packages/editor/src/utils/const.d.ts
|
|
3098
3093
|
/** 当uiService.get('uiSelectMode')为true,点击组件(包括任何形式,组件树/画布)时触发的事件名 */
|
|
@@ -4486,7 +4481,9 @@ type __VLS_WithSlots$8<T, S> = T & {
|
|
|
4486
4481
|
type __VLS_Props$17 = {
|
|
4487
4482
|
title?: string;
|
|
4488
4483
|
values: any;
|
|
4489
|
-
disabled: boolean;
|
|
4484
|
+
disabled: boolean; /** 打开后需要直接定位并打开的方法名,传入时默认激活「方法定义」tab */
|
|
4485
|
+
editMethodName?: string; /** 打开后需要直接定位并打开的字段路径,传入时默认激活「数据定义」tab */
|
|
4486
|
+
editFieldPath?: string[];
|
|
4490
4487
|
};
|
|
4491
4488
|
type __VLS_ModelProps$2 = {
|
|
4492
4489
|
'visible'?: boolean;
|
|
@@ -6199,4 +6196,4 @@ declare const _default$40: {
|
|
|
6199
6196
|
install: (app: App, opt?: Partial<EditorInstallOptions | DesignPluginOptions | FormInstallOptions>) => void;
|
|
6200
6197
|
};
|
|
6201
6198
|
//#endregion
|
|
6202
|
-
export { AddMNode, AddPrefixToObject, AsyncAfterHook, AsyncBeforeHook, AsyncHookPlugin, AsyncMethodName, BaseStepValue, BeforeAdd, CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, CanDropInFunction, CanDropInScene, _default as CodeBlockEditor,
|
|
6199
|
+
export { AddMNode, AddPrefixToObject, AsyncAfterHook, AsyncBeforeHook, AsyncHookPlugin, AsyncMethodName, BaseStepValue, BeforeAdd, CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, CanDropInFunction, CanDropInScene, _default as CodeBlockEditor, _default$1 as CodeBlockList, _default$2 as CodeBlockListPanel, CodeBlockListPanelSlots, CodeBlockListSlots, CodeBlockStepValue, CodeDeleteErrorType, CodeDslItem, CodeParamStatement, CodeRelation, _default$3 as CodeSelect, _default$4 as CodeSelectCol, CodeState, ColumnLayout, CombineInfo, CompareCategory, _default$5 as CompareForm, CompareFormLoadConfig, CompareFormLoadConfigContext, ComponentGroup, ComponentGroupState, ComponentItem, _default$6 as ComponentListPanel, ComponentListPanelSlots, _default$7 as CondOpSelect, _default$8 as ContentMenu, CustomContentMenuFunction, DEFAULT_LEFT_COLUMN_WIDTH, DEFAULT_RIGHT_COLUMN_WIDTH, _default$9 as DataSourceAddButton, _default$10 as DataSourceConfigPanel, _default$11 as DataSourceFieldSelect, _default$12 as DataSourceFields, _default$13 as DataSourceInput, DataSourceListSlots, _default$14 as DataSourceMethodSelect, _default$15 as DataSourceMethods, _default$16 as DataSourceMocks, _default$17 as DataSourceSelect, DataSourceStepValue, DatasourceTypeOption, DepTargetType, DiffDialogPayload, _default$18 as DisplayConds, DragClassification, DragType, DslOpOptions, DslOpWithHistoryIdsResult, EditorEvents, EditorInstallOptions, EditorNodeInfo, EditorSlots, EventBus, EventBusEvent, _default$19 as EventSelect, Fixed2Other, _default$20 as FloatingBox, FrameworkSlots, GetCodeBlockFormConfigOptions, GetColumnWidth, GetConfig, H_GUIDE_LINE_STORAGE_KEY, HistoryBucketConfig, _default$21 as HistoryDiffDialog, _default$22 as HistoryListBucket, _default$23 as HistoryListBucketTab, HistoryListExtraTab, HistoryOpOptions, HistoryOpOptionsWithChangeRecords, HistoryOpSource, HistoryOpType, HistoryPersistOptions, HistoryRowDescriptor, HistoryState, _default$24 as Icon, IdleTask, IdleTaskEvents, IsExpandableFunction, KeyBindingCacheItem, KeyBindingCommand, KeyBindingItem, _default$25 as KeyValue, Keys, LEFT_COLUMN_WIDTH_STORAGE_KEY, LayerNodeSlots, LayerNodeStatus, LayerOffset, _default$26 as LayerPanel, LayerPanelSlots, Layout, _default$27 as LayoutContainer, _default$27 as SplitView, ListState, MIN_CENTER_COLUMN_WIDTH, MIN_LEFT_COLUMN_WIDTH, MIN_RIGHT_COLUMN_WIDTH, MenuBarData, MenuButton, MenuComponent, MenuItem, type OnDrag, PROPS_PANEL_WIDTH_STORAGE_KEY, PageBarSortOptions, _default$28 as PageFragmentSelect, PageHistoryGroup, PageHistoryStepEntry, PartSortableOptions, PastePosition, PersistedHistoryState, PropsFormConfigFunction, _default$29 as PropsFormPanel, PropsFormValueFunction, _default$30 as PropsPanel, PropsPanelSlots, PropsState, RIGHT_COLUMN_WIDTH_STORAGE_KEY, _default$31 as Resizer, ScrollViewer, ScrollViewerEvent, ScrollViewerSlots, SerializedUndoRedo, Services, SetColumnWidth, SideBarData, SideComponent, SideItem, SideItemKey, SidebarSlots, StackHistoryGroup, StageCore, StageOptions, StageOverlayState, StageRect, StageSlots, StepDiffItem, StepValue, StoreState, StoreStateKey, _default$32 as StyleSetter, SyncAfterHook, SyncBeforeHook, SyncHookPlugin, _default$33 as TMagicCodeEditor, _default$34 as TMagicEditor, _default$35 as ToolButton, _default$36 as Tree, _default$37 as TreeNode, TreeNodeData, UI_SELECT_MODE_EVENT_NAME, UiState, UndoRedo, V_GUIDE_LINE_STORAGE_KEY, WorkspaceSlots, advancedTabConfig, arrayOptions, beforePaste, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, canUsePluginMethods, change2Fixed, classifyDragSources, _default$38 as codeBlockService, collectRelatedNodes, createStackStep, _default$39 as dataSourceService, debug, _default$40 as default, defaultIsExpandable, _default$41 as depService, describeRevertStep, describeStepForRevert, deserializeStacks, designPlugin, detectPageTargetId, detectPageTargetName, detectStackOpType, displayTabConfig, editorNodeMergeCustomizer, _default$42 as editorService, eqOptions, error, eventTabConfig, _default$43 as eventsService, fillConfig, fixNodeLeft, fixNodePosition, formPlugin, generatePageName, generatePageNameByApp, getAddParent, getCascaderOptionsFromFields, getCodeBlockFormConfig, getDefaultConfig, getDisplayField, getEditorConfig, getFieldType, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getLastPushedHistoryIds, getNodeIndex, getOrCreateStack, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, _default$44 as historyService, idbDelete, idbGet, idbSet, info, isIncludeDataSource, isIndexedDBSupported, _default$45 as loadMonaco, log, markStackSaved, mergePageSteps, mergeStackSteps, moveItemsInContainer, numberOptions, openIndexedDB, _default$46 as propsService, resolveSelectedNode, serializeConfig, serializeStacks, setChildrenLayout, setEditorConfig, setLayout, _default$47 as stageOverlayService, _default$48 as storageService, styleTabConfig, tablePlugin, toggleFixedPosition, _default$49 as uiService, undoFloor, updateStatus, useCodeBlockEdit, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, warn };
|