amis-editor-core 6.4.1 → 6.5.0

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.
@@ -0,0 +1,3 @@
1
+ import { EditorNodeType } from '../store/node';
2
+ import { LayoutInterface } from './interface';
3
+ export default function getLayoutInstance(schema: any, region: EditorNodeType): LayoutInterface;
@@ -0,0 +1,16 @@
1
+ import { BaseEventContext, InsertEventContext, MoveEventContext } from '../plugin';
2
+ /**
3
+ * 每种布局模式在数据变更前后的处理逻辑
4
+ */
5
+ export interface LayoutInterface {
6
+ beforeInsert?: (context: InsertEventContext, store: any) => InsertEventContext;
7
+ afterInsert?: (context: InsertEventContext, store: any) => InsertEventContext;
8
+ beforeMove?: (context: MoveEventContext, store: any) => MoveEventContext;
9
+ afterMove?: (context: MoveEventContext, store: any) => MoveEventContext;
10
+ beforeDelete?: (context: BaseEventContext, store: any) => BaseEventContext;
11
+ afterDelete?: (context: BaseEventContext, store: any) => BaseEventContext;
12
+ beforeMoveDown?: (context: BaseEventContext, store: any) => BaseEventContext;
13
+ afterMoveDown?: (context: BaseEventContext, store: any) => BaseEventContext;
14
+ beforeMoveUp?: (context: BaseEventContext, store: any) => BaseEventContext;
15
+ afterMoveUp?: (context: BaseEventContext, store: any) => BaseEventContext;
16
+ }
package/lib/manager.d.ts CHANGED
@@ -113,7 +113,7 @@ export declare class EditorManager {
113
113
  readonly isRegion: boolean;
114
114
  readonly childRegions: any[];
115
115
  readonly uniqueChildren: any[];
116
- readonly sameIdChild: any;
116
+ readonly sameIdChild: any; /** 在顶层对外部注册的Plugin和builtInPlugins合并去重 */
117
117
  readonly singleRegion: boolean;
118
118
  isExists(id: string): boolean;
119
119
  getChildById(id: string): any;
@@ -175,7 +175,7 @@ export declare class EditorManager {
175
175
  readonly isRegion: boolean;
176
176
  readonly childRegions: any[];
177
177
  readonly uniqueChildren: any[];
178
- readonly sameIdChild: any;
178
+ readonly sameIdChild: any; /** 在顶层对外部注册的Plugin和builtInPlugins合并去重 */
179
179
  readonly singleRegion: boolean;
180
180
  isExists(id: string): boolean;
181
181
  getChildById(id: string): any;
@@ -236,7 +236,7 @@ export declare class EditorManager {
236
236
  readonly isRegion: boolean;
237
237
  readonly childRegions: any[];
238
238
  readonly uniqueChildren: any[];
239
- readonly sameIdChild: any;
239
+ readonly sameIdChild: any; /** 在顶层对外部注册的Plugin和builtInPlugins合并去重 */
240
240
  readonly singleRegion: boolean;
241
241
  isExists(id: string): boolean;
242
242
  getChildById(id: string): any;
@@ -323,7 +323,7 @@ export declare class EditorManager {
323
323
  readonly isRegion: boolean;
324
324
  readonly childRegions: any[];
325
325
  readonly uniqueChildren: any[];
326
- readonly sameIdChild: any;
326
+ readonly sameIdChild: any; /** 在顶层对外部注册的Plugin和builtInPlugins合并去重 */
327
327
  readonly singleRegion: boolean;
328
328
  isExists(id: string): boolean;
329
329
  getChildById(id: string): any;
@@ -384,7 +384,7 @@ export declare class EditorManager {
384
384
  readonly isRegion: boolean;
385
385
  readonly childRegions: any[];
386
386
  readonly uniqueChildren: any[];
387
- readonly sameIdChild: any;
387
+ readonly sameIdChild: any; /** 在顶层对外部注册的Plugin和builtInPlugins合并去重 */
388
388
  readonly singleRegion: boolean;
389
389
  isExists(id: string): boolean;
390
390
  getChildById(id: string): any;
@@ -476,7 +476,7 @@ export declare class EditorManager {
476
476
  readonly isRegion: boolean;
477
477
  readonly childRegions: any[];
478
478
  readonly uniqueChildren: any[];
479
- readonly sameIdChild: any;
479
+ readonly sameIdChild: any; /** 在顶层对外部注册的Plugin和builtInPlugins合并去重 */
480
480
  readonly singleRegion: boolean;
481
481
  isExists(id: string): boolean;
482
482
  getChildById(id: string): any;
@@ -538,7 +538,7 @@ export declare class EditorManager {
538
538
  readonly isRegion: boolean;
539
539
  readonly childRegions: any[];
540
540
  readonly uniqueChildren: any[];
541
- readonly sameIdChild: any;
541
+ readonly sameIdChild: any; /** 在顶层对外部注册的Plugin和builtInPlugins合并去重 */
542
542
  readonly singleRegion: boolean;
543
543
  isExists(id: string): boolean;
544
544
  getChildById(id: string): any;
@@ -599,7 +599,7 @@ export declare class EditorManager {
599
599
  readonly isRegion: boolean;
600
600
  readonly childRegions: any[];
601
601
  readonly uniqueChildren: any[];
602
- readonly sameIdChild: any;
602
+ readonly sameIdChild: any; /** 在顶层对外部注册的Plugin和builtInPlugins合并去重 */
603
603
  readonly singleRegion: boolean;
604
604
  isExists(id: string): boolean;
605
605
  getChildById(id: string): any;
@@ -686,7 +686,7 @@ export declare class EditorManager {
686
686
  readonly isRegion: boolean;
687
687
  readonly childRegions: any[];
688
688
  readonly uniqueChildren: any[];
689
- readonly sameIdChild: any;
689
+ readonly sameIdChild: any; /** 在顶层对外部注册的Plugin和builtInPlugins合并去重 */
690
690
  readonly singleRegion: boolean;
691
691
  isExists(id: string): boolean;
692
692
  getChildById(id: string): any;
@@ -747,7 +747,7 @@ export declare class EditorManager {
747
747
  readonly isRegion: boolean;
748
748
  readonly childRegions: any[];
749
749
  readonly uniqueChildren: any[];
750
- readonly sameIdChild: any;
750
+ readonly sameIdChild: any; /** 在顶层对外部注册的Plugin和builtInPlugins合并去重 */
751
751
  readonly singleRegion: boolean;
752
752
  isExists(id: string): boolean;
753
753
  getChildById(id: string): any;
@@ -960,6 +960,10 @@ export declare class EditorManager {
960
960
  * @param region
961
961
  */
962
962
  paste(id: string, region?: string): Promise<void>;
963
+ /**
964
+ * 重新生成当前节点的 id
965
+ */
966
+ reGenerateCurrentNodeID(): void;
963
967
  /**
964
968
  * 清空区域
965
969
  * @param id
@@ -977,6 +981,7 @@ export declare class EditorManager {
977
981
  id: string;
978
982
  type: string;
979
983
  data: any;
984
+ position?: string;
980
985
  }, reGenerateId?: boolean): any | null;
981
986
  /**
982
987
  * 移动节点
@@ -985,7 +990,7 @@ export declare class EditorManager {
985
990
  * @param sourceId 移动的节点 id
986
991
  * @param beforeId 移动到哪个节点前面
987
992
  */
988
- move(id: string, region: string, sourceId: string, beforeId?: string): boolean;
993
+ move(id: string, region: string, sourceId: string, beforeId?: string, dragInfo?: any): boolean;
989
994
  /**
990
995
  * 替换节点。
991
996
  * @param id
@@ -1,5 +1,5 @@
1
1
  import { BasePlugin, BasicRendererInfo, RendererInfoResolveEventContext } from '../plugin';
2
- export declare class UnkownRendererPlugin extends BasePlugin {
2
+ export declare class UnknownRendererPlugin extends BasePlugin {
3
3
  static scene: string[];
4
4
  order: number;
5
5
  getRendererInfo({ renderer, schema, path }: RendererInfoResolveEventContext): BasicRendererInfo | void;
package/lib/plugin.d.ts CHANGED
@@ -5,8 +5,6 @@ import { RegionWrapperProps } from './component/RegionWrapper';
5
5
  import { EditorManager } from './manager';
6
6
  import { EditorStoreType } from './store/editor';
7
7
  import { EditorNodeType } from './store/node';
8
- import { DNDModeInterface } from './dnd/interface';
9
- import { EditorDNDManager } from './dnd';
10
8
  import React from 'react';
11
9
  import { DiffChange } from './util';
12
10
  import type { RendererConfig, Schema } from 'amis-core';
@@ -80,7 +78,7 @@ export interface RegionConfig {
80
78
  /**
81
79
  * dnd 拖拽模式。比如 table 那种需要配置成 position-h
82
80
  */
83
- dndMode?: 'default' | 'position-h' | 'position-v' | (new (dnd: EditorDNDManager) => DNDModeInterface);
81
+ dndMode?: 'default' | 'position-h' | 'position-v' | 'flex' | ((node: any) => string | undefined);
84
82
  /**
85
83
  * 可以用来判断是否允许拖入当前节点。
86
84
  */
@@ -150,6 +148,10 @@ export interface RendererInfo extends RendererScaffoldInfo {
150
148
  * 配置区域。
151
149
  */
152
150
  regions?: Array<RegionConfig>;
151
+ /**
152
+ * 选中不需要高亮
153
+ */
154
+ notHighlight?: boolean;
153
155
  /**
154
156
  * 哪些容器属性需要自动转成数组的。如果不配置默认就从 regions 里面读取。
155
157
  */
@@ -410,6 +412,7 @@ export interface InsertEventContext extends BaseEventContext {
410
412
  id: string;
411
413
  type: string;
412
414
  data: any;
415
+ position?: string;
413
416
  };
414
417
  }
415
418
  export interface ReplaceEventContext extends BaseEventContext {
@@ -588,6 +591,10 @@ export interface PluginInterface extends Partial<BasicRendererInfo>, Partial<Bas
588
591
  * panelBodyAsyncCreator设置后异步加载层的配置项
589
592
  */
590
593
  async?: AsyncLayerOptions;
594
+ /**
595
+ * 拖拽模式
596
+ */
597
+ dragMode?: string;
591
598
  /**
592
599
  * 有数据域的容器,可以为子组件提供读取的字段绑定页面
593
600
  */