@tmagic/editor 1.8.0-beta.15 → 1.8.0-beta.17

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/types/index.d.ts CHANGED
@@ -520,6 +520,9 @@ declare class Dep extends BaseService {
520
520
  private idleTask;
521
521
  private watcher;
522
522
  private waitingWorker?;
523
+ private resolveWaitingWorker?;
524
+ private workerGeneration;
525
+ private activeBatches;
523
526
  constructor();
524
527
  set<K extends StateKey, T extends State$1[K]>(name: K, value: T): void;
525
528
  get<K extends StateKey>(name: K): State$1[K];
@@ -533,7 +536,7 @@ declare class Dep extends BaseService {
533
536
  removeTarget(id: Id, type?: string): void;
534
537
  clearTargets(): void;
535
538
  collect(nodes: MNode[], depExtendedData?: DepExtendedData, deep?: boolean, type?: DepTargetType$1): void;
536
- collectIdle(nodes: MNode[], depExtendedData?: DepExtendedData, deep?: boolean, type?: DepTargetType$1): Promise<void>;
539
+ collectIdle(nodes: MNode[], depExtendedData?: DepExtendedData, deep?: boolean, type?: DepTargetType$1): Promise<boolean>;
537
540
  collectByWorker(dsl: MApp): Promise<Record<string, Record<string, DepData>>>;
538
541
  collectNode(node: MNode, target: Target, depExtendedData?: DepExtendedData, deep?: boolean): void;
539
542
  clear(nodes?: MNode[]): void;
@@ -552,6 +555,16 @@ declare class Dep extends BaseService {
552
555
  */
553
556
  private removePageDep;
554
557
  private enqueueTask;
558
+ private onBatchTaskDone;
559
+ private settleBatchDs;
560
+ private finishBatch;
561
+ /**
562
+ * idleTask 被清空时,在途批次的任务不会再执行,必须主动结算,
563
+ * 否则对应的 collectIdle Promise 永远不会 resolve(collecting 卡在 true、once 监听器泄漏)。
564
+ * 收集被中断(通常紧跟一次全量重新收集),因此不再 emit collected/ds-collected,仅结算 Promise。
565
+ */
566
+ private abortActiveBatches;
567
+ private updateCollectingState;
555
568
  }
556
569
  type DepService = Dep;
557
570
  declare const _default$44: Dep;
@@ -1700,6 +1713,11 @@ interface StageOptions {
1700
1713
  containerHighlightClassName?: string;
1701
1714
  containerHighlightDuration?: number;
1702
1715
  containerHighlightType?: ContainerHighlightType;
1716
+ /**
1717
+ * 是否仅在新增组件(从组件列表拖入新组件)时才启用识别容器,
1718
+ * 开启后在画布中拖动已有组件不会识别容器,默认 false
1719
+ */
1720
+ containerHighlightAddOnly?: boolean;
1703
1721
  disabledDragStart?: boolean;
1704
1722
  render?: (stage: StageCore$1) => HTMLDivElement | void | Promise<HTMLDivElement | void>;
1705
1723
  moveableOptions?: CustomizeMoveableOptions;
@@ -3109,70 +3127,6 @@ declare const fillConfig: (config?: FormConfig, {
3109
3127
  * @returns 处理后的表单配置(不修改入参,返回浅拷贝)
3110
3128
  */
3111
3129
  declare const removeStyleDisplayConfig: (formConfig: FormConfig) => FormConfig;
3112
- /**
3113
- * validatePropsForm 参数
3114
- */
3115
- interface ValidatePropsFormOptions {
3116
- /** 组件属性表单配置 */
3117
- config: FormConfig;
3118
- /** 待校验的表单值 */
3119
- values: FormValue;
3120
- /**
3121
- * 当前组件实例的 appContext(通常为 `getCurrentInstance()?.appContext`)。
3122
- * 会与 services 一并合入临时 MForm 的 appContext,使编辑器字段组件(DataSourceInput 等)能正常 inject。
3123
- */
3124
- appContext?: AppContext | null;
3125
- /** 编辑器服务集合,注入到临时表单的 formState */
3126
- services?: Services;
3127
- /** stage 实例,注入到临时表单的 formState */
3128
- stage?: any;
3129
- /** 外部扩展的 formState */
3130
- extendState?: (_state: FormState) => Record<string, any> | Promise<Record<string, any>>;
3131
- /**
3132
- * 调试模式,默认 `true`:以弹层形式可见地渲染表单,点击「确定」才触发校验。
3133
- * 置为 `false` 时静默挂载后自动校验。
3134
- */
3135
- debug?: boolean;
3136
- typeMatchValid?: boolean;
3137
- }
3138
- /**
3139
- * 对一份「组件属性表单配置 + 值」做一次独立的校验,**不复用也不污染页面上正在展示的表单**。
3140
- *
3141
- * 内部基于 `@tmagic/form` 的 `validateForm` 另建一个独立的 MForm 实例完成校验,并统一处理
3142
- * 编辑器场景所需的上下文注入:将当前组件实例的 provides 合入 appContext,并向 formState 注入
3143
- * stage / services 及外部扩展状态,保证校验规则依赖的上下文可用。
3144
- *
3145
- * 常用于源码编辑器保存后,对最新配置做一次校验,并将校验结果(错误信息)随提交一并抛给上层记录,
3146
- * 使源码保存的错误状态与表单编辑保持一致。
3147
- *
3148
- * @returns 校验通过返回空字符串 `''`,否则返回以 `<br>` 拼接的错误文案。
3149
- * 仅在初始化超时或挂载失败等异常情况下才会 reject。
3150
- *
3151
- * @example
3152
- * ```ts
3153
- * const error = await validatePropsForm({
3154
- * config,
3155
- * values,
3156
- * appContext: getCurrentInstance()?.appContext,
3157
- * services,
3158
- * stage: editorService.get('stage'),
3159
- * extendState,
3160
- * });
3161
- * if (error) {
3162
- * // 配置不合法,error 为错误文案
3163
- * }
3164
- * ```
3165
- */
3166
- declare const validatePropsForm: ({
3167
- config,
3168
- values,
3169
- appContext,
3170
- services,
3171
- stage,
3172
- extendState,
3173
- debug,
3174
- typeMatchValid
3175
- }: ValidatePropsFormOptions) => Promise<string>;
3176
3130
  //#endregion
3177
3131
  //#region temp/packages/editor/src/utils/code-block.d.ts
3178
3132
  /**
@@ -3221,7 +3175,7 @@ declare const getCodeBlockFormConfig: (options?: GetCodeBlockFormConfigOptions)
3221
3175
  declare const log: (...args: any[]) => void;
3222
3176
  declare const info: (...args: any[]) => void;
3223
3177
  declare const warn: (...args: any[]) => void;
3224
- declare const debug$1: (...args: any[]) => void;
3178
+ declare const debug: (...args: any[]) => void;
3225
3179
  declare const error: (...args: any[]) => void;
3226
3180
  //#endregion
3227
3181
  //#region temp/packages/editor/src/utils/editor.d.ts
@@ -3721,6 +3675,11 @@ interface EditorProps {
3721
3675
  containerHighlightDuration?: number;
3722
3676
  /** 拖入画布中容器时,识别容器的操作类型 */
3723
3677
  containerHighlightType?: ContainerHighlightType;
3678
+ /**
3679
+ * 是否仅在新增组件(从组件列表拖入新组件)时才启用识别容器,
3680
+ * 开启后在画布中拖动已有组件不会识别容器,默认 false
3681
+ */
3682
+ containerHighlightAddOnly?: boolean;
3724
3683
  /** 画布大小 */
3725
3684
  stageRect?: StageRect;
3726
3685
  /** monaco editor 的配置 */
@@ -4784,6 +4743,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
4784
4743
  datasourceConfigs: Record<string, import("@tmagic/form-schema").FormConfig>;
4785
4744
  containerHighlightDuration: number;
4786
4745
  containerHighlightType: import("@tmagic/stage").ContainerHighlightType;
4746
+ containerHighlightAddOnly: boolean;
4787
4747
  canSelect: (el: HTMLElement) => boolean | Promise<boolean>;
4788
4748
  }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
4789
4749
  declare const __VLS_export$39: __VLS_WithSlots$12<typeof __VLS_base$12, __VLS_Slots$12>;
@@ -6906,4 +6866,4 @@ declare const _default$43: {
6906
6866
  install: (app: App, opt?: Partial<EditorInstallOptions | DesignPluginOptions | FormInstallOptions>) => void;
6907
6867
  };
6908
6868
  //#endregion
6909
- export { ALL_COND_OPS, 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, CompareFormBaseProps, CompareFormLoadConfig, CompareFormLoadConfigContext, ComponentGroup, ComponentGroupState, ComponentItem, _default$6 as ComponentListPanel, ComponentListPanelSlots, _default$7 as CondOpSelect, ConfirmAndRevertOptions, _default$8 as ContentMenu, ContentMenuTarget, ContentMenuType, CustomContentMenuFunction, CustomDiffFormOptions, 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, EVENT_NAME_VALUE_SEPARATOR, EditorChangeEvent, EditorChangeEventHistoryMeta, EditorChangeItem, EditorEvents, EditorInstallOptions, EditorNodeInfo, EditorSlots, EditorUpdateChangeItem, EventBus, EventBusEvent, EventNameOption, EventNameSelectOption, _default$19 as EventSelect, Fixed2Other, _default$20 as FloatingBox, FrameworkSlots, GetCodeBlockFormConfigOptions, GetColumnWidth, GetConfig, H_GUIDE_LINE_STORAGE_KEY, HistoryBucketConfig, _default$21 as HistoryDiffDialog, HistoryEvents, HistoryGroup, _default$22 as HistoryListBucket, _default$23 as HistoryListBucketTab, HistoryListExtraTab, HistoryOpOptions, HistoryOpOptionsWithChangeRecords, HistoryOpSource, HistoryOpType, HistoryPersistOptions, HistoryRowDescriptor, HistoryState, HistoryStepEntry, HistoryStepType, HistorySteps, _default$24 as Icon, IdleTask, IdleTaskEvents, IsExpandableFunction, KeyBindingCacheItem, KeyBindingCommand, KeyBindingItem, _default$25 as KeyValue, Keys, LEFT_COLUMN_WIDTH_STORAGE_KEY, _default$26 as LayerNodeContent, LayerNodeSlots, LayerNodeStatus, LayerOffset, _default$27 as LayerPanel, LayerPanelSlots, Layout, _default$28 as LayoutContainer, _default$28 as SplitView, ListState, MIN_CENTER_COLUMN_WIDTH, MIN_LEFT_COLUMN_WIDTH, MIN_RIGHT_COLUMN_WIDTH, MenuBarData, MenuButton, MenuComponent, MenuItem, NodeInvalidInfo, NodeInvalidSource, type OnDrag, PROPS_PANEL_WIDTH_STORAGE_KEY, PageBarSortOptions, _default$29 as PageFragmentSelect, PartSortableOptions, PastePosition, PersistedHistoryState, PropsFormConfigFunction, _default$30 as PropsFormPanel, PropsFormValueFunction, _default$31 as PropsPanel, PropsPanelSlots, PropsState, RIGHT_COLUMN_WIDTH_STORAGE_KEY, _default$32 as Resizer, ScrollViewer, ScrollViewerEvent, ScrollViewerSlots, SerializedUndoRedo, Services, SetColumnWidth, SideBarData, SideComponent, SideItem, SideItemKey, SidebarSlots, StageCore, StageOptions, StageOverlayState, StageRect, StageSlots, StepDiffItem, StepExtra, StepValue, StoreState, StoreStateKey, _default$33 as StyleSetter, SyncAfterHook, SyncBeforeHook, SyncHookPlugin, _default$34 as TMagicCodeEditor, _default$35 as TMagicEditor, _default$36 as ToolButton, _default$37 as Tree, _default$38 as TreeNode, TreeNodeData, type TypeMatchValidateContext, UI_SELECT_MODE_EVENT_NAME, UiState, UndoRedo, UseCompareFormReturn, UseHistoryRevertOptions, V_GUIDE_LINE_STORAGE_KEY, ValidatePropsFormOptions, _default$39 as ViewForm, WorkspaceSlots, advancedTabConfig, arrayOptions, beforePaste, booleanOptions, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, canUsePluginMethods, change2Fixed, classifyDragSources, _default$40 as codeBlockService, collectEventNameOptionValues, collectRelatedNodes, _default$41 as componentListService, confirmHistoryAction, createStackStep, _default$42 as dataSourceService, debug$1 as debug, _default$43 as default, defaultIsExpandable, _default$44 as depService, describeRevertStep, describeStepForRevert, deserializeStacks, designPlugin, detectStackOpType, detectTargetId, detectTargetName, displayTabConfig, editorNodeMergeCustomizer, _default$45 as editorService, editorTypeMatchRules, eqOptions, error, eventTabConfig, _default$46 as eventsService, fillConfig, fixNodeLeft, fixNodePosition, formPlugin, generatePageName, generatePageNameByApp, getAddParent, getCascaderOptionsFromFields, getCodeBlockFormConfig, getCompActionAllowedValues, getCompActionOptions, getCondOpOptionsByFieldType, getDefaultConfig, getDisplayField, getEditorConfig, getEventNameAllowedValues, getEventNameOptions, getFieldType, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getLastPushedHistoryIds, getNodeIndex, getOrCreateStack, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, _default$47 as historyService, idbDelete, idbGet, idbSet, info, isEventNameCheckStrictly, isGlobalFlat, isIncludeDataSource, isIndexedDBSupported, _default$48 as keybindingService, _default$49 as loadMonaco, log, markStackSaved, mergeSteps, moveItemsInContainer, normalizeCompActionValue, numberOptions, openIndexedDB, _default$50 as propsService, removeStyleDisplayConfig, resolveFieldByPath, resolveSelectedNode, serializeConfig, serializeStacks, setChildrenLayout, setEditorConfig, setLayout, _default$51 as stageOverlayService, _default$52 as storageService, styleTabConfig, tablePlugin, toggleFixedPosition, _default$53 as uiService, undoFloor, updateStatus, useCodeBlockEdit, useCompareForm, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useHistoryRevert, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, validatePropsForm, warn };
6869
+ export { ALL_COND_OPS, 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, CompareFormBaseProps, CompareFormLoadConfig, CompareFormLoadConfigContext, ComponentGroup, ComponentGroupState, ComponentItem, _default$6 as ComponentListPanel, ComponentListPanelSlots, _default$7 as CondOpSelect, ConfirmAndRevertOptions, _default$8 as ContentMenu, ContentMenuTarget, ContentMenuType, CustomContentMenuFunction, CustomDiffFormOptions, 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, EVENT_NAME_VALUE_SEPARATOR, EditorChangeEvent, EditorChangeEventHistoryMeta, EditorChangeItem, EditorEvents, EditorInstallOptions, EditorNodeInfo, EditorSlots, EditorUpdateChangeItem, EventBus, EventBusEvent, EventNameOption, EventNameSelectOption, _default$19 as EventSelect, Fixed2Other, _default$20 as FloatingBox, FrameworkSlots, GetCodeBlockFormConfigOptions, GetColumnWidth, GetConfig, H_GUIDE_LINE_STORAGE_KEY, HistoryBucketConfig, _default$21 as HistoryDiffDialog, HistoryEvents, HistoryGroup, _default$22 as HistoryListBucket, _default$23 as HistoryListBucketTab, HistoryListExtraTab, HistoryOpOptions, HistoryOpOptionsWithChangeRecords, HistoryOpSource, HistoryOpType, HistoryPersistOptions, HistoryRowDescriptor, HistoryState, HistoryStepEntry, HistoryStepType, HistorySteps, _default$24 as Icon, IdleTask, IdleTaskEvents, IsExpandableFunction, KeyBindingCacheItem, KeyBindingCommand, KeyBindingItem, _default$25 as KeyValue, Keys, LEFT_COLUMN_WIDTH_STORAGE_KEY, _default$26 as LayerNodeContent, LayerNodeSlots, LayerNodeStatus, LayerOffset, _default$27 as LayerPanel, LayerPanelSlots, Layout, _default$28 as LayoutContainer, _default$28 as SplitView, ListState, MIN_CENTER_COLUMN_WIDTH, MIN_LEFT_COLUMN_WIDTH, MIN_RIGHT_COLUMN_WIDTH, MenuBarData, MenuButton, MenuComponent, MenuItem, NodeInvalidInfo, NodeInvalidSource, type OnDrag, PROPS_PANEL_WIDTH_STORAGE_KEY, PageBarSortOptions, _default$29 as PageFragmentSelect, PartSortableOptions, PastePosition, PersistedHistoryState, PropsFormConfigFunction, _default$30 as PropsFormPanel, PropsFormValueFunction, _default$31 as PropsPanel, PropsPanelSlots, PropsState, RIGHT_COLUMN_WIDTH_STORAGE_KEY, _default$32 as Resizer, ScrollViewer, ScrollViewerEvent, ScrollViewerSlots, SerializedUndoRedo, Services, SetColumnWidth, SideBarData, SideComponent, SideItem, SideItemKey, SidebarSlots, StageCore, StageOptions, StageOverlayState, StageRect, StageSlots, StepDiffItem, StepExtra, StepValue, StoreState, StoreStateKey, _default$33 as StyleSetter, SyncAfterHook, SyncBeforeHook, SyncHookPlugin, _default$34 as TMagicCodeEditor, _default$35 as TMagicEditor, _default$36 as ToolButton, _default$37 as Tree, _default$38 as TreeNode, TreeNodeData, type TypeMatchValidateContext, UI_SELECT_MODE_EVENT_NAME, UiState, UndoRedo, UseCompareFormReturn, UseHistoryRevertOptions, V_GUIDE_LINE_STORAGE_KEY, _default$39 as ViewForm, WorkspaceSlots, advancedTabConfig, arrayOptions, beforePaste, booleanOptions, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, canUsePluginMethods, change2Fixed, classifyDragSources, _default$40 as codeBlockService, collectEventNameOptionValues, collectRelatedNodes, _default$41 as componentListService, confirmHistoryAction, createStackStep, _default$42 as dataSourceService, debug, _default$43 as default, defaultIsExpandable, _default$44 as depService, describeRevertStep, describeStepForRevert, deserializeStacks, designPlugin, detectStackOpType, detectTargetId, detectTargetName, displayTabConfig, editorNodeMergeCustomizer, _default$45 as editorService, editorTypeMatchRules, eqOptions, error, eventTabConfig, _default$46 as eventsService, fillConfig, fixNodeLeft, fixNodePosition, formPlugin, generatePageName, generatePageNameByApp, getAddParent, getCascaderOptionsFromFields, getCodeBlockFormConfig, getCompActionAllowedValues, getCompActionOptions, getCondOpOptionsByFieldType, getDefaultConfig, getDisplayField, getEditorConfig, getEventNameAllowedValues, getEventNameOptions, getFieldType, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getLastPushedHistoryIds, getNodeIndex, getOrCreateStack, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, _default$47 as historyService, idbDelete, idbGet, idbSet, info, isEventNameCheckStrictly, isGlobalFlat, isIncludeDataSource, isIndexedDBSupported, _default$48 as keybindingService, _default$49 as loadMonaco, log, markStackSaved, mergeSteps, moveItemsInContainer, normalizeCompActionValue, numberOptions, openIndexedDB, _default$50 as propsService, removeStyleDisplayConfig, resolveFieldByPath, resolveSelectedNode, serializeConfig, serializeStacks, setChildrenLayout, setEditorConfig, setLayout, _default$51 as stageOverlayService, _default$52 as storageService, styleTabConfig, tablePlugin, toggleFixedPosition, _default$53 as uiService, undoFloor, updateStatus, useCodeBlockEdit, useCompareForm, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useHistoryRevert, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, warn };