amis-editor 4.1.0-beta.22 → 4.1.0-beta.23

Sign up to get free protection for your applications and to get access to all the features.
@@ -65,7 +65,7 @@ export declare class CardsPlugin extends BasePlugin {
65
65
  panelBodyCreator: (context: BaseEventContext) => any[];
66
66
  editDetail(id: string): void;
67
67
  buildEditorToolbar({ id, info, schema }: BaseEventContext, toolbars: Array<BasicToolbarItem>): void;
68
- buildEditorContextMenu({ id, schema, region, info }: ContextMenuEventContext, menus: Array<ContextMenuItem>): void;
68
+ buildEditorContextMenu({ id, schema, region, info, selections }: ContextMenuEventContext, menus: Array<ContextMenuItem>): void;
69
69
  filterProps(props: any): any;
70
70
  getRendererInfo(context: RendererInfoResolveEventContext): BasicRendererInfo | void;
71
71
  }
@@ -38,6 +38,6 @@ export declare class DropDownButtonPlugin extends BasePlugin {
38
38
  panelBodyCreator: (context: BaseEventContext) => any;
39
39
  buildEditorToolbar({ id, info }: BaseEventContext, toolbars: Array<BasicToolbarItem>): void;
40
40
  editDetail(id: string): void;
41
- buildEditorContextMenu({ id, schema, region, info }: ContextMenuEventContext, menus: Array<ContextMenuItem>): void;
41
+ buildEditorContextMenu({ id, schema, region, info, selections }: ContextMenuEventContext, menus: Array<ContextMenuItem>): void;
42
42
  filterProps(props: any): any;
43
43
  }
@@ -30,6 +30,6 @@ export declare class EachPlugin extends BasePlugin {
30
30
  panelBodyCreator: (context: BaseEventContext) => any[];
31
31
  filterProps(props: any): any;
32
32
  buildEditorToolbar({ id, info }: BaseEventContext, toolbars: Array<BasicToolbarItem>): void;
33
- buildEditorContextMenu({ id, schema, region, info }: ContextMenuEventContext, menus: Array<ContextMenuItem>): void;
33
+ buildEditorContextMenu({ id, schema, region, info, selections }: ContextMenuEventContext, menus: Array<ContextMenuItem>): void;
34
34
  editDetail(id: string): void;
35
35
  }
@@ -50,6 +50,6 @@ export declare class ListPlugin extends BasePlugin {
50
50
  };
51
51
  editDetail(id: string): void;
52
52
  buildEditorToolbar({ id, info, schema }: BaseEventContext, toolbars: Array<BasicToolbarItem>): void;
53
- buildEditorContextMenu({ id, schema, region, info }: ContextMenuEventContext, menus: Array<ContextMenuItem>): void;
53
+ buildEditorContextMenu({ id, schema, region, info, selections }: ContextMenuEventContext, menus: Array<ContextMenuItem>): void;
54
54
  getRendererInfo(context: RendererInfoResolveEventContext): BasicRendererInfo | void;
55
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amis-editor",
3
- "version": "4.1.0-beta.22",
3
+ "version": "4.1.0-beta.23",
4
4
  "description": "amis 可视化编辑器",
5
5
  "main": "dist/index.min.js",
6
6
  "types": "dist/index.d.ts",
@@ -40,6 +40,7 @@
40
40
  "mobx": "^4.5.0",
41
41
  "mobx-react": "^6.1.4",
42
42
  "mobx-state-tree": "^3.17.3",
43
+ "react-hook-form": "^7.31.1",
43
44
  "react-json-view": "^1.21.3",
44
45
  "sortablejs": "^1.14.0"
45
46
  },
@@ -236,9 +236,12 @@ export class CardsPlugin extends BasePlugin {
236
236
  }
237
237
 
238
238
  buildEditorContextMenu(
239
- {id, schema, region, info}: ContextMenuEventContext,
239
+ {id, schema, region, info, selections}: ContextMenuEventContext,
240
240
  menus: Array<ContextMenuItem>
241
241
  ) {
242
+ if (selections.length || info?.plugin !== this) {
243
+ return;
244
+ }
242
245
  if (
243
246
  info.renderer.name === 'cards' ||
244
247
  (info.renderer.name === 'crud' && schema.mode === 'cards')
@@ -213,9 +213,12 @@ export class DropDownButtonPlugin extends BasePlugin {
213
213
  }
214
214
 
215
215
  buildEditorContextMenu(
216
- {id, schema, region, info}: ContextMenuEventContext,
216
+ {id, schema, region, info, selections}: ContextMenuEventContext,
217
217
  menus: Array<ContextMenuItem>
218
218
  ) {
219
+ if (selections.length || info?.plugin !== this) {
220
+ return;
221
+ }
219
222
  if (info.renderer.name === 'dropdown-button') {
220
223
  menus.push('|', {
221
224
  label: '配置下拉按钮集合',
@@ -110,9 +110,12 @@ export class EachPlugin extends BasePlugin {
110
110
  }
111
111
 
112
112
  buildEditorContextMenu(
113
- {id, schema, region, info}: ContextMenuEventContext,
113
+ {id, schema, region, info, selections}: ContextMenuEventContext,
114
114
  menus: Array<ContextMenuItem>
115
115
  ) {
116
+ if (selections.length || info?.plugin !== this) {
117
+ return;
118
+ }
116
119
  if (info.renderer.name === 'each') {
117
120
  menus.push('|', {
118
121
  label: '配置成员渲染器',
@@ -232,9 +232,12 @@ export class ListPlugin extends BasePlugin {
232
232
  }
233
233
 
234
234
  buildEditorContextMenu(
235
- {id, schema, region, info}: ContextMenuEventContext,
235
+ {id, schema, region, info, selections}: ContextMenuEventContext,
236
236
  menus: Array<ContextMenuItem>
237
237
  ) {
238
+ if (selections.length || info?.plugin !== this) {
239
+ return;
240
+ }
238
241
  if (
239
242
  info.renderer.name === 'list' ||
240
243
  (info.renderer.name === 'crud' && schema.mode === 'list')