amis-editor 4.1.0-beta.24 → 4.1.0-beta.27
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/component/ScaffoldModal.d.ts +1 -1
- package/dist/exports.min.js +1 -1
- package/dist/index.min.js +1 -1
- package/dist/manager.d.ts +20 -10
- package/dist/plugin.d.ts +2 -2
- package/dist/store/editor.d.ts +11 -11
- package/package.json +1 -1
- package/src/plugin/Others/Action.tsx +1 -1
- package/src/plugin/Panel/AvailableRenderers.tsx +1 -1
- package/src/plugin.ts +6 -5
package/dist/manager.d.ts
CHANGED
@@ -44,6 +44,8 @@ export declare class EditorManager {
|
|
44
44
|
readonly dnd: EditorDNDManager;
|
45
45
|
readonly id: string;
|
46
46
|
disableHover: boolean;
|
47
|
+
private renderersId;
|
48
|
+
private panelsId;
|
47
49
|
private clipboardData;
|
48
50
|
readonly hackIn: any;
|
49
51
|
constructor(config: EditorManagerConfig, store: EditorStoreType, parent?: EditorManager | undefined);
|
@@ -118,13 +120,12 @@ export declare class EditorManager {
|
|
118
120
|
widthMutable?: boolean | undefined;
|
119
121
|
memberIndex?: number | undefined;
|
120
122
|
}): any;
|
121
|
-
|
122
|
-
|
123
|
+
removeChild(child: any): void;
|
124
|
+
toggleFold(e: import("react").MouseEvent<HTMLAnchorElement, MouseEvent>): void; /**
|
125
|
+
* 显示插入面板
|
123
126
|
* @param region
|
124
127
|
* @param preferTag
|
125
128
|
*/
|
126
|
-
removeChild(child: any): void;
|
127
|
-
toggleFold(e: import("react").MouseEvent<HTMLAnchorElement, MouseEvent>): void;
|
128
129
|
patch(store: any, force?: boolean): void;
|
129
130
|
updateSchema(value: any): void;
|
130
131
|
setComponent(value: any): void;
|
@@ -132,6 +133,11 @@ export declare class EditorManager {
|
|
132
133
|
calculateHighlightBox(root?: any): void;
|
133
134
|
resetHighlightBox(root: any): void;
|
134
135
|
updateState(state: any, replace?: boolean): void;
|
136
|
+
/**
|
137
|
+
* 在当前选中元素插入或追加新的元素
|
138
|
+
* @param rendererIdOrSchema
|
139
|
+
* 备注:可以根据渲染器ID添加新元素,也可以根据现有schema片段添加新元素
|
140
|
+
*/
|
135
141
|
setWidthMutable(value: any): void;
|
136
142
|
setHeightMutable(value: any): void;
|
137
143
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
@@ -203,13 +209,12 @@ export declare class EditorManager {
|
|
203
209
|
widthMutable?: boolean | undefined;
|
204
210
|
memberIndex?: number | undefined;
|
205
211
|
}): any;
|
206
|
-
|
207
|
-
|
212
|
+
removeChild(child: any): void;
|
213
|
+
toggleFold(e: import("react").MouseEvent<HTMLAnchorElement, MouseEvent>): void; /**
|
214
|
+
* 显示插入面板
|
208
215
|
* @param region
|
209
216
|
* @param preferTag
|
210
217
|
*/
|
211
|
-
removeChild(child: any): void;
|
212
|
-
toggleFold(e: import("react").MouseEvent<HTMLAnchorElement, MouseEvent>): void;
|
213
218
|
patch(store: any, force?: boolean): void;
|
214
219
|
updateSchema(value: any): void;
|
215
220
|
setComponent(value: any): void;
|
@@ -217,6 +222,11 @@ export declare class EditorManager {
|
|
217
222
|
calculateHighlightBox(root?: any): void;
|
218
223
|
resetHighlightBox(root: any): void;
|
219
224
|
updateState(state: any, replace?: boolean): void;
|
225
|
+
/**
|
226
|
+
* 在当前选中元素插入或追加新的元素
|
227
|
+
* @param rendererIdOrSchema
|
228
|
+
* 备注:可以根据渲染器ID添加新元素,也可以根据现有schema片段添加新元素
|
229
|
+
*/
|
220
230
|
setWidthMutable(value: any): void;
|
221
231
|
setHeightMutable(value: any): void;
|
222
232
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
@@ -233,8 +243,8 @@ export declare class EditorManager {
|
|
233
243
|
buildJSONSchemaUri(): void;
|
234
244
|
buildToolbars(): void;
|
235
245
|
collectPanels(node: EditorNodeType, triggerEvent?: boolean, secondFactor?: boolean): BasicPanelItem[];
|
236
|
-
buildPanels(): void;
|
237
|
-
collectRenderers(region?: string,
|
246
|
+
buildPanels(curRendererId?: string): void;
|
247
|
+
collectRenderers(region?: string, activeContainerId?: string): Promise<SubRendererInfo[]>;
|
238
248
|
buildRenderers(region?: string): Promise<void>;
|
239
249
|
rebuild(): Promise<void>;
|
240
250
|
/**
|
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:
|
284
|
+
onDragStart?: (e: any) => void;
|
285
285
|
icon?: string;
|
286
286
|
iconSvg?: string;
|
287
|
-
onClick?: (e:
|
287
|
+
onClick?: (e: any) => void;
|
288
288
|
tooltip?: string;
|
289
289
|
placement?: 'top' | 'bottom' | 'right' | 'left';
|
290
290
|
}
|
package/dist/store/editor.d.ts
CHANGED
@@ -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
|
366
|
+
getNodeById(id: string, region?: string): EditorNodeType | undefined;
|
367
367
|
readonly activeNodeInfo: RendererInfo | null | undefined;
|
368
|
-
getSchema(id?: string
|
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
|
881
|
+
groupedRenderersByKeyword(_subRenderers: Array<SubRendererInfo>, keywords?: string): {
|
882
882
|
[propName: string]: SubRendererInfo[];
|
883
883
|
};
|
884
884
|
/** 根据关键字过滤预置组件
|
885
885
|
* 备注:组件搜索中需要
|
886
886
|
*/
|
887
|
-
groupedSubRenderersByKeyword(_subRenderers?: SubRendererInfo
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
994
|
+
traceableSetSchema(schema: any, noTrace?: boolean): void;
|
995
995
|
undo(): void;
|
996
996
|
redo(): void;
|
997
997
|
resetHistory(): void;
|
package/package.json
CHANGED
@@ -21,7 +21,7 @@ export class AvailableRenderersPlugin extends BasePlugin {
|
|
21
21
|
return;
|
22
22
|
}
|
23
23
|
|
24
|
-
if (store.
|
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:
|
377
|
+
onDragStart?: (e: any) => void;
|
378
378
|
icon?: string;
|
379
379
|
iconSvg?: string; // 自定义icon(svg格式)
|
380
|
-
onClick?: (e:
|
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?:
|
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
|
|