amis-editor 4.1.0-beta.25 → 4.1.0-beta.28

Sign up to get free protection for your applications and to get access to all the features.
package/dist/manager.d.ts CHANGED
@@ -48,6 +48,7 @@ export declare class EditorManager {
48
48
  readonly hackIn: any;
49
49
  constructor(config: EditorManagerConfig, store: EditorStoreType, parent?: EditorManager | undefined);
50
50
  dynamicAddPlugin(pluginName: string): void;
51
+ buildRenderersAndPanels(): void;
51
52
  buildEventContext(idOrNode: string | EditorNodeType): {
52
53
  node: {
53
54
  parentId: string;
@@ -223,8 +224,8 @@ export declare class EditorManager {
223
224
  buildJSONSchemaUri(): void;
224
225
  buildToolbars(): void;
225
226
  collectPanels(node: EditorNodeType, triggerEvent?: boolean, secondFactor?: boolean): BasicPanelItem[];
226
- buildPanels(): void;
227
- collectRenderers(region?: string, id?: string): Promise<SubRendererInfo[]>;
227
+ buildPanels(curRendererId?: string): void;
228
+ collectRenderers(region?: string, activeContainerId?: string): Promise<SubRendererInfo[]>;
228
229
  buildRenderers(region?: string): Promise<void>;
229
230
  rebuild(): Promise<void>;
230
231
  /**
package/dist/plugin.d.ts CHANGED
@@ -281,10 +281,10 @@ export interface ToolbarItem {
281
281
  level?: 'primary' | 'secondary' | 'special';
282
282
  className?: string;
283
283
  draggable?: boolean;
284
- onDragStart?: (e: React.DragEvent) => void;
284
+ onDragStart?: (e: any) => void;
285
285
  icon?: string;
286
286
  iconSvg?: string;
287
- onClick?: (e: React.MouseEvent) => void;
287
+ onClick?: (e: any) => void;
288
288
  tooltip?: string;
289
289
  placement?: 'top' | 'bottom' | 'right' | 'left';
290
290
  }
@@ -363,9 +363,9 @@ export declare const EditorStore: import("mobx-state-tree").IModelType<{
363
363
  setWidthMutable(value: any): void;
364
364
  setHeightMutable(value: any): void;
365
365
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>)[];
366
- getNodeById(id: string, region?: string | undefined): EditorNodeType | undefined;
366
+ getNodeById(id: string, region?: string): EditorNodeType | undefined;
367
367
  readonly activeNodeInfo: RendererInfo | null | undefined;
368
- getSchema(id?: string | undefined): any;
368
+ getSchema(id?: string): any;
369
369
  getSchemaParentById(id: string): any;
370
370
  getSchemaPath(id: string): string;
371
371
  getSimpleSchema(curSchema: any): any;
@@ -878,13 +878,13 @@ export declare const EditorStore: import("mobx-state-tree").IModelType<{
878
878
  */
879
879
  readonly customRenderersByOrder: SubRendererInfo[];
880
880
  /** 根据关键字过滤组件 */
881
- groupedRenderersByKeyword(_subRenderers: Array<SubRendererInfo>, keywords?: string | undefined): {
881
+ groupedRenderersByKeyword(_subRenderers: Array<SubRendererInfo>, keywords?: string): {
882
882
  [propName: string]: SubRendererInfo[];
883
883
  };
884
884
  /** 根据关键字过滤预置组件
885
885
  * 备注:组件搜索中需要
886
886
  */
887
- groupedSubRenderersByKeyword(_subRenderers?: SubRendererInfo[] | undefined, keywords?: string | undefined): {
887
+ groupedSubRenderersByKeyword(_subRenderers?: Array<SubRendererInfo>, keywords?: string): {
888
888
  [propName: string]: SubRendererInfo[];
889
889
  };
890
890
  /**
@@ -895,7 +895,7 @@ export declare const EditorStore: import("mobx-state-tree").IModelType<{
895
895
  [propName: string]: SubRendererInfo[];
896
896
  };
897
897
  /** 根据关键字过滤自定义组件 */
898
- groupedCustomRenderersByKeyword(_subRenderers?: SubRendererInfo[] | undefined, keywords?: string | undefined): {
898
+ groupedCustomRenderersByKeyword(_subRenderers?: Array<SubRendererInfo>, keywords?: string): {
899
899
  [propName: string]: SubRendererInfo[];
900
900
  };
901
901
  /**
@@ -920,7 +920,7 @@ export declare const EditorStore: import("mobx-state-tree").IModelType<{
920
920
  getDoc(): Document;
921
921
  setIframe(value: any): void;
922
922
  getIframe(): HTMLIFrameElement | undefined;
923
- setIsMobile(value?: boolean | undefined): void;
923
+ setIsMobile(value?: boolean): void;
924
924
  setCtx(value: any): void;
925
925
  setTheme(value: string): void;
926
926
  setIsSubEditor(isSubEditor: boolean): void;
@@ -931,7 +931,7 @@ export declare const EditorStore: import("mobx-state-tree").IModelType<{
931
931
  setActiveId(id: string, region?: string, selections?: Array<string>): void;
932
932
  setSelections(ids: Array<string>): void;
933
933
  clearSelection(): void;
934
- setHoverId(id: string, region?: string | undefined): void;
934
+ setHoverId(id: string, region?: string): void;
935
935
  setMouseMoveRegion(region: string): void;
936
936
  setInsertId(id: string): void;
937
937
  setContextId(id: string): void;
@@ -952,9 +952,9 @@ export declare const EditorStore: import("mobx-state-tree").IModelType<{
952
952
  changeLeftPanelKey(key: string): void;
953
953
  changeRenderersTabsKey(key: string): void;
954
954
  changeLeftPanelOpenStatus(isOpenStatus: boolean): void;
955
- showRendererPanel(tag?: string | undefined, msg?: string | undefined): void;
955
+ showRendererPanel(tag?: string, msg?: string): void;
956
956
  changeValue(value: Schema, diff?: any): void;
957
- changeValueById(id: string, value: Schema, diff?: any, replace?: boolean | undefined, noTrace?: boolean | undefined): void;
957
+ changeValueById(id: string, value: Schema, diff?: any, replace?: boolean, noTrace?: boolean): void;
958
958
  moveUp(id: string): void;
959
959
  moveDown(id: string): void;
960
960
  del(id: string): void;
@@ -962,7 +962,7 @@ export declare const EditorStore: import("mobx-state-tree").IModelType<{
962
962
  duplicate(id: string | Array<string>): void;
963
963
  emptyRegion(id: string, region: string): void;
964
964
  replaceChild(id: string, json: any): void;
965
- setInsertRegion(region: string, id?: string, tag?: string, mode?: 'insert' | 'replace', originId?: string, beforeId?: string | undefined): void;
965
+ setInsertRegion(region: string, id?: string, tag?: string, mode?: 'insert' | 'replace', originId?: string, beforeId?: string): void;
966
966
  closeInsertPanel(): void;
967
967
  showInsertRendererPanel(): void;
968
968
  closeInsertRendererPanel(): void;
@@ -991,7 +991,7 @@ export declare const EditorStore: import("mobx-state-tree").IModelType<{
991
991
  * 更新可供 target 及 reload 使用的名称列表
992
992
  */
993
993
  updateTargetName(): void;
994
- traceableSetSchema(schema: any, noTrace?: boolean | undefined): void;
994
+ traceableSetSchema(schema: any, noTrace?: boolean): void;
995
995
  undo(): void;
996
996
  redo(): void;
997
997
  resetHistory(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amis-editor",
3
- "version": "4.1.0-beta.25",
3
+ "version": "4.1.0-beta.28",
4
4
  "description": "amis 可视化编辑器",
5
5
  "main": "dist/index.min.js",
6
6
  "types": "dist/index.d.ts",
@@ -60,7 +60,7 @@
60
60
  "@types/react-router": "^4.0.16",
61
61
  "@types/sortablejs": "^1.10.7",
62
62
  "ajv": "^8.8.2",
63
- "amis": "^1.9.0",
63
+ "amis": "^1.9.1-beta.21",
64
64
  "axios": "0.21.1",
65
65
  "concurrently": "^6.2.0",
66
66
  "css-loader": "^6.2.0",
@@ -21,7 +21,7 @@ export class AvailableRenderersPlugin extends BasePlugin {
21
21
  return;
22
22
  }
23
23
 
24
- if (store.activeContainerId && store.subRenderers.length) {
24
+ if (store.subRenderers.length) {
25
25
  panels.push({
26
26
  key: 'renderers',
27
27
  icon: 'png-icon renderers-png', // 'fa fa-cube',
package/src/plugin.ts CHANGED
@@ -374,10 +374,10 @@ export interface ToolbarItem {
374
374
  level?: 'primary' | 'secondary' | 'special';
375
375
  className?: string;
376
376
  draggable?: boolean;
377
- onDragStart?: (e: React.DragEvent) => void;
377
+ onDragStart?: (e: any) => void;
378
378
  icon?: string;
379
379
  iconSvg?: string; // 自定义icon(svg格式)
380
- onClick?: (e: React.MouseEvent) => void;
380
+ onClick?: (e: any) => void;
381
381
  tooltip?: string;
382
382
  placement?: 'top' | 'bottom' | 'right' | 'left';
383
383
  }
@@ -412,7 +412,7 @@ export interface PanelItem {
412
412
  component?: React.ComponentType<PanelProps | any>;
413
413
  order: number;
414
414
  position?: 'left' | 'right';
415
- render?: (props: PanelProps) => JSX.Element;
415
+ render?:(props: PanelProps) => JSX.Element;
416
416
  menus?: Array<any>;
417
417
  }
418
418
 
@@ -841,9 +841,10 @@ export abstract class BasePlugin implements PluginInterface {
841
841
  panels: Array<BasicPanelItem>
842
842
  ) {
843
843
  const plugin: PluginInterface = this;
844
+ const store = this.manager.store;
844
845
 
845
- // 多选时不处理
846
- if (context.selections.length) {
846
+ // 没有选中元素 或者 多选时不处理
847
+ if (!store.activeId || context.selections.length) {
847
848
  return;
848
849
  }
849
850