amis-editor-core 6.9.0 → 6.10.0-beta.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.
- package/esm/component/Editor.d.ts +5 -1
- package/esm/component/ModalForm.d.ts +25 -0
- package/esm/deepSplice.d.ts +12 -0
- package/esm/index.d.ts +4 -1
- package/esm/index.js +2 -2
- package/esm/manager.d.ts +13 -2
- package/esm/plugin.d.ts +13 -0
- package/esm/store/editor.d.ts +25 -36
- package/lib/component/Editor.d.ts +5 -1
- package/lib/component/ModalForm.d.ts +25 -0
- package/lib/deepSplice.d.ts +12 -0
- package/lib/editor.js +1 -1
- package/lib/index.d.ts +4 -1
- package/lib/index.js +2 -2
- package/lib/manager.d.ts +13 -2
- package/lib/plugin.d.ts +13 -0
- package/lib/store/editor.d.ts +26 -36
- package/lib/style.css +1 -1
- package/package.json +4 -4
package/lib/manager.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { EditorDNDManager } from './dnd';
|
|
|
10
10
|
import { VariableManager } from './variable';
|
|
11
11
|
import type { IScopedContext } from 'amis';
|
|
12
12
|
import type { SchemaObject, SchemaCollection } from 'amis';
|
|
13
|
-
import type { RendererConfig } from 'amis-core';
|
|
13
|
+
import type { Api, Payload, RendererConfig } from 'amis-core';
|
|
14
14
|
export interface EditorManagerConfig extends Omit<EditorProps, 'value' | 'onChange'> {
|
|
15
15
|
}
|
|
16
16
|
export interface PluginClass {
|
|
@@ -61,6 +61,7 @@ export declare class EditorManager {
|
|
|
61
61
|
dataSchema: DataSchema;
|
|
62
62
|
/** 变量管理 */
|
|
63
63
|
readonly variableManager: VariableManager;
|
|
64
|
+
fetch?: (api: Api, data?: any, options?: object) => Promise<Payload>;
|
|
64
65
|
constructor(config: EditorManagerConfig, store: EditorStoreType, parent?: EditorManager | undefined);
|
|
65
66
|
normalizeScene(plugins?: Array<PluginClass | [PluginClass, Record<string, any> | (() => Record<string, any>)]>): (PluginClass | [PluginClass, Record<string, any> | (() => Record<string, any>)])[];
|
|
66
67
|
dynamicAddPlugin(pluginName: string): void;
|
|
@@ -440,6 +441,11 @@ export declare class EditorManager {
|
|
|
440
441
|
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
441
442
|
calculateHighlightBox(root?: any): void;
|
|
442
443
|
resetHighlightBox(root: any): void;
|
|
444
|
+
/**
|
|
445
|
+
* 显示插入面板
|
|
446
|
+
* @param region
|
|
447
|
+
* @param preferTag
|
|
448
|
+
*/
|
|
443
449
|
updateState(state: any, replace?: boolean): void;
|
|
444
450
|
setWidthMutable(value: any): void;
|
|
445
451
|
setHeightMutable(value: any): void;
|
|
@@ -817,6 +823,11 @@ export declare class EditorManager {
|
|
|
817
823
|
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
818
824
|
calculateHighlightBox(root?: any): void;
|
|
819
825
|
resetHighlightBox(root: any): void;
|
|
826
|
+
/**
|
|
827
|
+
* 显示插入面板
|
|
828
|
+
* @param region
|
|
829
|
+
* @param preferTag
|
|
830
|
+
*/
|
|
820
831
|
updateState(state: any, replace?: boolean): void;
|
|
821
832
|
setWidthMutable(value: any): void;
|
|
822
833
|
setHeightMutable(value: any): void;
|
|
@@ -1039,7 +1050,7 @@ export declare class EditorManager {
|
|
|
1039
1050
|
toggleSelection(id: string): void;
|
|
1040
1051
|
setSelection(selections: Array<string>, id?: string): void;
|
|
1041
1052
|
startDrag(id: string, e: React.DragEvent): void;
|
|
1042
|
-
scaffold(form:
|
|
1053
|
+
scaffold(form: ScaffoldForm, value: any): Promise<SchemaObject>;
|
|
1043
1054
|
reScaffold(id: string, form: ScaffoldForm, value: any): Promise<void>;
|
|
1044
1055
|
reScaffoldV2(id: string): Promise<void>;
|
|
1045
1056
|
lazyPatchSchema: import("lodash").DebouncedFunc<any>;
|
package/lib/plugin.d.ts
CHANGED
|
@@ -243,11 +243,14 @@ export interface PopOverForm {
|
|
|
243
243
|
* @deprecated 改用 body 代替
|
|
244
244
|
*/
|
|
245
245
|
controls?: Array<any>;
|
|
246
|
+
initApi?: any;
|
|
247
|
+
api?: any;
|
|
246
248
|
}
|
|
247
249
|
export interface ScaffoldForm extends PopOverForm {
|
|
248
250
|
stepsBody?: boolean;
|
|
249
251
|
/** 是否可跳过创建向导直接创建 */
|
|
250
252
|
canSkip?: boolean;
|
|
253
|
+
getSchema?: (value: any) => PopOverForm | Promise<PopOverForm>;
|
|
251
254
|
mode?: 'normal' | 'horizontal' | 'inline' | {
|
|
252
255
|
mode: string;
|
|
253
256
|
horizontal: any;
|
|
@@ -336,6 +339,7 @@ export interface PanelProps {
|
|
|
336
339
|
manager: EditorManager;
|
|
337
340
|
popOverContainer?: () => HTMLElement | void;
|
|
338
341
|
readonly?: boolean;
|
|
342
|
+
children?: React.ReactNode | ((props: PanelProps) => React.ReactNode);
|
|
339
343
|
}
|
|
340
344
|
/**
|
|
341
345
|
* 面板信息定义
|
|
@@ -379,6 +383,15 @@ export interface RendererInfoResolveEventContext extends EventContext {
|
|
|
379
383
|
export interface RendererJSONSchemaResolveEventContext extends BaseEventContext {
|
|
380
384
|
data: string;
|
|
381
385
|
}
|
|
386
|
+
export interface IGlobalEvent {
|
|
387
|
+
label: string;
|
|
388
|
+
name: string;
|
|
389
|
+
description: string;
|
|
390
|
+
mapping: Array<{
|
|
391
|
+
key: string;
|
|
392
|
+
type: string;
|
|
393
|
+
}>;
|
|
394
|
+
}
|
|
382
395
|
/**
|
|
383
396
|
* 右键菜单事件的上下文。
|
|
384
397
|
*/
|
package/lib/store/editor.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { Instance } from 'mobx-state-tree';
|
|
2
3
|
import { InsertEventContext, PluginEvent, RendererInfo, SubRendererInfo, ToolbarItem, PanelItem, MoveEventContext, ScaffoldForm, PopOverForm, DeleteEventContext, BaseEventContext } from '../plugin';
|
|
3
4
|
import type { Schema } from 'amis';
|
|
@@ -50,6 +51,13 @@ export interface PopOverFormContext extends PopOverForm {
|
|
|
50
51
|
callback: (value: any, diff: any) => void;
|
|
51
52
|
node?: EditorNodeType;
|
|
52
53
|
}
|
|
54
|
+
export interface ModalFormContext extends PopOverForm {
|
|
55
|
+
mode?: 'dialog' | 'drawer';
|
|
56
|
+
size?: string;
|
|
57
|
+
postion?: string;
|
|
58
|
+
value: any;
|
|
59
|
+
callback: (value: any, diff: any) => void;
|
|
60
|
+
}
|
|
53
61
|
/**
|
|
54
62
|
* 搜集的 name 信息
|
|
55
63
|
*/
|
|
@@ -440,10 +448,7 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
|
|
|
440
448
|
updateSchemaStyle(value: any): void;
|
|
441
449
|
setComponent(value: any): void;
|
|
442
450
|
getComponent(): any;
|
|
443
|
-
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
444
|
-
* 根据当前分类和关键字获取预置组件
|
|
445
|
-
* 备注:组件面板展示需要
|
|
446
|
-
*/
|
|
451
|
+
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
447
452
|
calculateHighlightBox(root?: any): void;
|
|
448
453
|
resetHighlightBox(root: any): void;
|
|
449
454
|
updateState(state: any, replace?: boolean): void;
|
|
@@ -502,6 +507,10 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
|
|
|
502
507
|
scaffoldFormBuzy: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
503
508
|
scaffoldError: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
504
509
|
popOverForm: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IType<PopOverFormContext, PopOverFormContext, PopOverFormContext>>;
|
|
510
|
+
modalForm: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IType<ModalFormContext, ModalFormContext, ModalFormContext>>;
|
|
511
|
+
modalMode: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
512
|
+
modalFormBuzy: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
513
|
+
modalFormError: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
505
514
|
subEditorContext: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IType<SubEditorContext, SubEditorContext, SubEditorContext>>;
|
|
506
515
|
superEditorData: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IType<any, any, any>>;
|
|
507
516
|
calculateStarted: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
@@ -515,6 +524,7 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
|
|
|
515
524
|
readonly filteredSchema: any;
|
|
516
525
|
readonly filteredSchemaForPreview: any;
|
|
517
526
|
isRootSchema(id: string): boolean;
|
|
527
|
+
readonly rootId: any;
|
|
518
528
|
getRootId(): any;
|
|
519
529
|
isHoved(id: string): boolean | "";
|
|
520
530
|
isActive(id: string): boolean | "";
|
|
@@ -895,10 +905,7 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
|
|
|
895
905
|
updateSchemaStyle(value: any): void;
|
|
896
906
|
setComponent(value: any): void;
|
|
897
907
|
getComponent(): any;
|
|
898
|
-
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
899
|
-
* 根据当前分类和关键字获取预置组件
|
|
900
|
-
* 备注:组件面板展示需要
|
|
901
|
-
*/
|
|
908
|
+
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
902
909
|
calculateHighlightBox(root?: any): void;
|
|
903
910
|
resetHighlightBox(root: any): void;
|
|
904
911
|
updateState(state: any, replace?: boolean): void;
|
|
@@ -1275,10 +1282,7 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
|
|
|
1275
1282
|
updateSchemaStyle(value: any): void;
|
|
1276
1283
|
setComponent(value: any): void;
|
|
1277
1284
|
getComponent(): any;
|
|
1278
|
-
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
1279
|
-
* 根据当前分类和关键字获取预置组件
|
|
1280
|
-
* 备注:组件面板展示需要
|
|
1281
|
-
*/
|
|
1285
|
+
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
1282
1286
|
calculateHighlightBox(root?: any): void;
|
|
1283
1287
|
resetHighlightBox(root: any): void;
|
|
1284
1288
|
updateState(state: any, replace?: boolean): void;
|
|
@@ -1678,10 +1682,7 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
|
|
|
1678
1682
|
updateSchemaStyle(value: any): void;
|
|
1679
1683
|
setComponent(value: any): void;
|
|
1680
1684
|
getComponent(): any;
|
|
1681
|
-
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
1682
|
-
* 根据当前分类和关键字获取预置组件
|
|
1683
|
-
* 备注:组件面板展示需要
|
|
1684
|
-
*/
|
|
1685
|
+
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
1685
1686
|
calculateHighlightBox(root?: any): void;
|
|
1686
1687
|
resetHighlightBox(root: any): void;
|
|
1687
1688
|
updateState(state: any, replace?: boolean): void;
|
|
@@ -2058,10 +2059,7 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
|
|
|
2058
2059
|
updateSchemaStyle(value: any): void;
|
|
2059
2060
|
setComponent(value: any): void;
|
|
2060
2061
|
getComponent(): any;
|
|
2061
|
-
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
2062
|
-
* 根据当前分类和关键字获取预置组件
|
|
2063
|
-
* 备注:组件面板展示需要
|
|
2064
|
-
*/
|
|
2062
|
+
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
2065
2063
|
calculateHighlightBox(root?: any): void;
|
|
2066
2064
|
resetHighlightBox(root: any): void;
|
|
2067
2065
|
updateState(state: any, replace?: boolean): void;
|
|
@@ -2439,10 +2437,7 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
|
|
|
2439
2437
|
updateSchemaStyle(value: any): void;
|
|
2440
2438
|
setComponent(value: any): void;
|
|
2441
2439
|
getComponent(): any;
|
|
2442
|
-
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
2443
|
-
* 根据当前分类和关键字获取预置组件
|
|
2444
|
-
* 备注:组件面板展示需要
|
|
2445
|
-
*/
|
|
2440
|
+
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
2446
2441
|
calculateHighlightBox(root?: any): void;
|
|
2447
2442
|
resetHighlightBox(root: any): void;
|
|
2448
2443
|
updateState(state: any, replace?: boolean): void;
|
|
@@ -2819,10 +2814,7 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
|
|
|
2819
2814
|
updateSchemaStyle(value: any): void;
|
|
2820
2815
|
setComponent(value: any): void;
|
|
2821
2816
|
getComponent(): any;
|
|
2822
|
-
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
2823
|
-
* 根据当前分类和关键字获取预置组件
|
|
2824
|
-
* 备注:组件面板展示需要
|
|
2825
|
-
*/
|
|
2817
|
+
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
2826
2818
|
calculateHighlightBox(root?: any): void;
|
|
2827
2819
|
resetHighlightBox(root: any): void;
|
|
2828
2820
|
updateState(state: any, replace?: boolean): void;
|
|
@@ -3200,10 +3192,7 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
|
|
|
3200
3192
|
updateSchemaStyle(value: any): void;
|
|
3201
3193
|
setComponent(value: any): void;
|
|
3202
3194
|
getComponent(): any;
|
|
3203
|
-
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
3204
|
-
* 根据当前分类和关键字获取预置组件
|
|
3205
|
-
* 备注:组件面板展示需要
|
|
3206
|
-
*/
|
|
3195
|
+
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
3207
3196
|
calculateHighlightBox(root?: any): void;
|
|
3208
3197
|
resetHighlightBox(root: any): void;
|
|
3209
3198
|
updateState(state: any, replace?: boolean): void;
|
|
@@ -3580,10 +3569,7 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
|
|
|
3580
3569
|
updateSchemaStyle(value: any): void;
|
|
3581
3570
|
setComponent(value: any): void;
|
|
3582
3571
|
getComponent(): any;
|
|
3583
|
-
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
3584
|
-
* 根据当前分类和关键字获取预置组件
|
|
3585
|
-
* 备注:组件面板展示需要
|
|
3586
|
-
*/
|
|
3572
|
+
getTarget(): HTMLElement | HTMLElement[] | null;
|
|
3587
3573
|
calculateHighlightBox(root?: any): void;
|
|
3588
3574
|
resetHighlightBox(root: any): void;
|
|
3589
3575
|
updateState(state: any, replace?: boolean): void;
|
|
@@ -3750,6 +3736,10 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
|
|
|
3750
3736
|
updateScaffoldData(value: any, replace?: boolean): void;
|
|
3751
3737
|
openPopOverForm(context: PopOverFormContext): void;
|
|
3752
3738
|
closePopOverForm(): void;
|
|
3739
|
+
openModalForm(context: ModalFormContext): void;
|
|
3740
|
+
closeModalForm(): void;
|
|
3741
|
+
markModalFormBuzy(value: any): void;
|
|
3742
|
+
setModalFormError(msg?: string): void;
|
|
3753
3743
|
activeHighlightNodes(ids: Array<string>): void;
|
|
3754
3744
|
deActiveHighlightNodes(ids: Array<string>): void;
|
|
3755
3745
|
calculateHighlightBox(ids?: Array<string>): void;
|