amis-editor 3.3.6-beta.10 → 3.3.6-beta.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. package/dist/Animation.d.ts +22 -0
  2. package/dist/BasicContainerEditor.d.ts +46 -0
  3. package/dist/BasicEditor.d.ts +214 -0
  4. package/dist/Breadcrumb.d.ts +19 -0
  5. package/dist/ClassNameControl.d.ts +31 -0
  6. package/dist/CodeEditor.d.ts +34 -0
  7. package/dist/Editor.d.ts +251 -0
  8. package/dist/HighlightBox.d.ts +17 -0
  9. package/dist/MiniEditor.d.ts +9 -0
  10. package/dist/Outline.d.ts +38 -0
  11. package/dist/PositionRegion.d.ts +7 -0
  12. package/dist/Preview.d.ts +76 -0
  13. package/dist/Region.d.ts +61 -0
  14. package/dist/RendererThumb.d.ts +23 -0
  15. package/dist/Renderers.d.ts +39 -0
  16. package/dist/RenderersPicker.d.ts +28 -0
  17. package/dist/SettingForm.d.ts +20 -0
  18. package/dist/Settings.d.ts +58 -0
  19. package/dist/component/ScaffoldModal.d.ts +1 -1
  20. package/dist/dom-helper.d.ts +2 -0
  21. package/dist/editors/Action.d.ts +14 -0
  22. package/dist/editors/Alert.d.ts +11 -0
  23. package/dist/editors/Audio.d.ts +9 -0
  24. package/dist/editors/ButtonGroup.d.ts +15 -0
  25. package/dist/editors/ButtonToolbar.d.ts +7 -0
  26. package/dist/editors/CRUD.d.ts +27 -0
  27. package/dist/editors/Card.d.ts +47 -0
  28. package/dist/editors/Cards.d.ts +20 -0
  29. package/dist/editors/Carousel.d.ts +9 -0
  30. package/dist/editors/Chart.d.ts +13 -0
  31. package/dist/editors/Collapse.d.ts +13 -0
  32. package/dist/editors/Container.d.ts +13 -0
  33. package/dist/editors/Date.d.ts +18 -0
  34. package/dist/editors/Dialog.d.ts +27 -0
  35. package/dist/editors/DiffEditor.d.ts +8 -0
  36. package/dist/editors/Divdier.d.ts +8 -0
  37. package/dist/editors/Drawer.d.ts +26 -0
  38. package/dist/editors/DropDownButton.d.ts +16 -0
  39. package/dist/editors/Each.d.ts +16 -0
  40. package/dist/editors/Form/Array.d.ts +12 -0
  41. package/dist/editors/Form/Button.d.ts +13 -0
  42. package/dist/editors/Form/ButtonGroup.d.ts +17 -0
  43. package/dist/editors/Form/ButtonToolbar.d.ts +15 -0
  44. package/dist/editors/Form/ChainedSelect.d.ts +8 -0
  45. package/dist/editors/Form/Checkbox.d.ts +8 -0
  46. package/dist/editors/Form/Checkboxes.d.ts +8 -0
  47. package/dist/editors/Form/City.d.ts +8 -0
  48. package/dist/editors/Form/Color.d.ts +8 -0
  49. package/dist/editors/Form/Combo.d.ts +19 -0
  50. package/dist/editors/Form/Container.d.ts +22 -0
  51. package/dist/editors/Form/Control.d.ts +15 -0
  52. package/dist/editors/Form/Date.d.ts +9 -0
  53. package/dist/editors/Form/DateRange.d.ts +9 -0
  54. package/dist/editors/Form/Datetime.d.ts +9 -0
  55. package/dist/editors/Form/DiffEditor.d.ts +8 -0
  56. package/dist/editors/Form/Editor.d.ts +12 -0
  57. package/dist/editors/Form/Email.d.ts +8 -0
  58. package/dist/editors/Form/FieldSet.d.ts +22 -0
  59. package/dist/editors/Form/File.d.ts +8 -0
  60. package/dist/editors/Form/Form.d.ts +26 -0
  61. package/dist/editors/Form/Formula.d.ts +11 -0
  62. package/dist/editors/Form/Grid.d.ts +21 -0
  63. package/dist/editors/Form/Group.d.ts +21 -0
  64. package/dist/editors/Form/HBox.d.ts +20 -0
  65. package/dist/editors/Form/Hidden.d.ts +21 -0
  66. package/dist/editors/Form/Image.d.ts +8 -0
  67. package/dist/editors/Form/InputGroup.d.ts +12 -0
  68. package/dist/editors/Form/Item.d.ts +8 -0
  69. package/dist/editors/Form/List.d.ts +16 -0
  70. package/dist/editors/Form/Matrix.d.ts +8 -0
  71. package/dist/editors/Form/NestedSelect.d.ts +50 -0
  72. package/dist/editors/Form/Number.d.ts +8 -0
  73. package/dist/editors/Form/Panel.d.ts +22 -0
  74. package/dist/editors/Form/Password.d.ts +10 -0
  75. package/dist/editors/Form/Picker.d.ts +17 -0
  76. package/dist/editors/Form/QRCode.d.ts +8 -0
  77. package/dist/editors/Form/Radios.d.ts +8 -0
  78. package/dist/editors/Form/Range.d.ts +8 -0
  79. package/dist/editors/Form/Rating.d.ts +8 -0
  80. package/dist/editors/Form/Repeat.d.ts +8 -0
  81. package/dist/editors/Form/Reset.d.ts +8 -0
  82. package/dist/editors/Form/RichText.d.ts +8 -0
  83. package/dist/editors/Form/Select.d.ts +8 -0
  84. package/dist/editors/Form/Service.d.ts +25 -0
  85. package/dist/editors/Form/Static.d.ts +18 -0
  86. package/dist/editors/Form/SubForm.d.ts +12 -0
  87. package/dist/editors/Form/Submit.d.ts +9 -0
  88. package/dist/editors/Form/Switch.d.ts +8 -0
  89. package/dist/editors/Form/Tab.d.ts +12 -0
  90. package/dist/editors/Form/Table.d.ts +25 -0
  91. package/dist/editors/Form/Tabs.d.ts +6 -0
  92. package/dist/editors/Form/Tag.d.ts +10 -0
  93. package/dist/editors/Form/Text.d.ts +10 -0
  94. package/dist/editors/Form/Textarea.d.ts +8 -0
  95. package/dist/editors/Form/Time.d.ts +9 -0
  96. package/dist/editors/Form/Tree.d.ts +50 -0
  97. package/dist/editors/Form/TreeSelect.d.ts +50 -0
  98. package/dist/editors/Form/Url.d.ts +8 -0
  99. package/dist/editors/Grid.d.ts +16 -0
  100. package/dist/editors/HBox.d.ts +13 -0
  101. package/dist/editors/IFrame.d.ts +11 -0
  102. package/dist/editors/Image.d.ts +9 -0
  103. package/dist/editors/Json.d.ts +9 -0
  104. package/dist/editors/Link.d.ts +8 -0
  105. package/dist/editors/List.d.ts +70 -0
  106. package/dist/editors/Mapping.d.ts +9 -0
  107. package/dist/editors/Nav.d.ts +142 -0
  108. package/dist/editors/Operation.d.ts +17 -0
  109. package/dist/editors/Page.d.ts +15 -0
  110. package/dist/editors/Panel.d.ts +13 -0
  111. package/dist/editors/Plain.d.ts +9 -0
  112. package/dist/editors/Progress.d.ts +9 -0
  113. package/dist/editors/QRCode.d.ts +8 -0
  114. package/dist/editors/Service.d.ts +5 -0
  115. package/dist/editors/Status.d.ts +9 -0
  116. package/dist/editors/Switch.d.ts +9 -0
  117. package/dist/editors/Tab.d.ts +13 -0
  118. package/dist/editors/Table.d.ts +27 -0
  119. package/dist/editors/TableCell.d.ts +29 -0
  120. package/dist/editors/TableColumnsRegion.d.ts +6 -0
  121. package/dist/editors/Tabs.d.ts +15 -0
  122. package/dist/editors/Tasks.d.ts +8 -0
  123. package/dist/editors/Tpl.d.ts +8 -0
  124. package/dist/editors/Video.d.ts +8 -0
  125. package/dist/editors/Wizard.d.ts +15 -0
  126. package/dist/editors/WizardStep.d.ts +19 -0
  127. package/dist/editors/Wrapper.d.ts +11 -0
  128. package/dist/editors/index.d.ts +101 -0
  129. package/dist/editors/templates.d.ts +3 -0
  130. package/dist/index.d.ts +2 -1
  131. package/dist/index.min.js +1 -1
  132. package/dist/json-ast/index.d.ts +53 -0
  133. package/dist/plugin/CRUD.d.ts +5 -16
  134. package/dist/plugin/DiffEditor.d.ts +19 -0
  135. package/dist/plugin/Form/AnchorNav.d.ts +17 -0
  136. package/dist/plugin/Form/Array.d.ts +27 -0
  137. package/dist/plugin/Form/Button.d.ts +11 -0
  138. package/dist/plugin/Form/ButtonGroup.d.ts +22 -0
  139. package/dist/plugin/Form/City.d.ts +19 -0
  140. package/dist/plugin/Form/Container.d.ts +37 -0
  141. package/dist/plugin/Form/Date.d.ts +20 -0
  142. package/dist/plugin/Form/DateRange.d.ts +20 -0
  143. package/dist/plugin/Form/DateTime.d.ts +19 -0
  144. package/dist/plugin/Form/Email.d.ts +25 -0
  145. package/dist/plugin/Form/File.d.ts +19 -0
  146. package/dist/plugin/Form/Form.d.ts +2 -1
  147. package/dist/plugin/Form/Grid.d.ts +32 -0
  148. package/dist/plugin/Form/HBox.d.ts +73 -0
  149. package/dist/plugin/Form/Image.d.ts +20 -0
  150. package/dist/plugin/Form/List.d.ts +24 -0
  151. package/dist/plugin/Form/Location.d.ts +48 -0
  152. package/dist/plugin/Form/Matrix.d.ts +26 -0
  153. package/dist/plugin/Form/Month.d.ts +16 -0
  154. package/dist/plugin/Form/MonthRange.d.ts +20 -0
  155. package/dist/plugin/Form/Number.d.ts +20 -0
  156. package/dist/plugin/Form/Panel.d.ts +24 -0
  157. package/dist/plugin/Form/Password.d.ts +25 -0
  158. package/dist/plugin/Form/QRCode.d.ts +20 -0
  159. package/dist/plugin/Form/Range.d.ts +19 -0
  160. package/dist/plugin/Form/Rating.d.ts +19 -0
  161. package/dist/plugin/Form/Repeat.d.ts +19 -0
  162. package/dist/plugin/Form/RichText.d.ts +19 -0
  163. package/dist/plugin/Form/Service.d.ts +24 -0
  164. package/dist/plugin/Form/SubForm.d.ts +64 -0
  165. package/dist/plugin/Form/Table.d.ts +34 -0
  166. package/dist/plugin/Form/Tabs.d.ts +17 -0
  167. package/dist/plugin/Form/Tag.d.ts +21 -0
  168. package/dist/plugin/Form/Text.d.ts +20 -0
  169. package/dist/plugin/Form/Time.d.ts +19 -0
  170. package/dist/plugin/Form/Tree.d.ts +73 -0
  171. package/dist/plugin/Form/Url.d.ts +25 -0
  172. package/dist/plugin/Form/Year.d.ts +16 -0
  173. package/dist/plugin/Switch.d.ts +21 -0
  174. package/dist/types.d.ts +40 -0
  175. package/package.json +20 -43
@@ -0,0 +1,22 @@
1
+ interface Rect {
2
+ top: number;
3
+ left: number;
4
+ bottom: number;
5
+ right: number;
6
+ width: number;
7
+ height: number;
8
+ }
9
+ interface AnimationState {
10
+ rect: Rect;
11
+ target: HTMLElement;
12
+ }
13
+ export declare class AnimationManager {
14
+ animating: boolean;
15
+ animationCallbackId: any;
16
+ states: Array<AnimationState>;
17
+ capture(el: HTMLElement): void;
18
+ animateAll(callback?: () => void): void;
19
+ animate(target: HTMLElement, currentRect: Rect, toRect: Rect, duration: number): void;
20
+ }
21
+ declare const _default: AnimationManager;
22
+ export default _default;
@@ -0,0 +1,46 @@
1
+ /// <reference types="react" />
2
+ import BasicEditor from './BasicEditor';
3
+ import { Schema, RendererProps } from './types';
4
+ export default class BasicContainerEditor<T extends RendererProps = RendererProps> extends BasicEditor<T> {
5
+ dropable: boolean;
6
+ containers: Array<string>;
7
+ disabledContainers: Array<string>;
8
+ diyContainer: Array<string>;
9
+ containerLabels: Array<string>;
10
+ constructor(props: T, context: any);
11
+ componentWillReceiveProps(nextProps: RendererProps): void;
12
+ editorWillUpdate(activeId: string | null, prevId: string | null, mode: string): any;
13
+ modifyProps(props: any, context?: any): any;
14
+ isDropableRegion(region: string): boolean;
15
+ updateRegion(name?: string): void;
16
+ getContextMenus(): any[];
17
+ _allSubRenderers: Array<any>;
18
+ get allSubRenderers(): any[];
19
+ getAvaiableSubRenderers(region?: string): {
20
+ label: string | undefined;
21
+ value: any;
22
+ docLink: string | undefined;
23
+ previewSchema: Schema | undefined;
24
+ description: string | undefined;
25
+ id: string;
26
+ icon: string | undefined;
27
+ tags: string[];
28
+ }[];
29
+ /**
30
+ * 当把目标节点拖入到当前节点的区域时执行,用来完成数据写入。
31
+ * @param region
32
+ * @param dragId
33
+ * @param indexOrBeforeId
34
+ */
35
+ moveTo(region: string, dragId: string, indexOrBeforeId: string | number): void;
36
+ /**
37
+ * 从外面拖入一个组件时执行,实现拖入组件的逻辑。
38
+ * @param region
39
+ * @param index
40
+ * @param data
41
+ */
42
+ add(region: string, index: number, data: any, rendererId: string): Promise<void>;
43
+ regionRef(regionName: string, ref: any): void;
44
+ updateHighlight(viewOnly?: boolean): void;
45
+ renderChild(region: string, node: Schema, props?: any): JSX.Element;
46
+ }
@@ -0,0 +1,214 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Schema, RendererProps } from './types';
4
+ export declare const defaultChildrenSortList: string[];
5
+ export default class BasicEditor<T extends RendererProps = RendererProps> extends React.Component<T> {
6
+ static contextTypes: {
7
+ editor: PropTypes.Requireable<object>;
8
+ editorNode: PropTypes.Requireable<object>;
9
+ };
10
+ static childContextTypes: {
11
+ editorNode: PropTypes.Requireable<object>;
12
+ };
13
+ ref: any;
14
+ renderer: any;
15
+ tipName: string;
16
+ Renderer: React.ReactType;
17
+ static propsList: Array<string>;
18
+ static displayName: string;
19
+ highlight: any;
20
+ regions: any;
21
+ movable?: boolean;
22
+ regionDefaultNodes: Partial<T>;
23
+ toolbarBtns: Array<{
24
+ visible?: boolean;
25
+ icon: string;
26
+ tooltip?: string;
27
+ id: string;
28
+ placement?: string;
29
+ test?: (props: any, editor: any) => any;
30
+ }>;
31
+ toolbarDom: React.RefObject<HTMLDivElement>;
32
+ containers: Array<string>;
33
+ removable: boolean;
34
+ replaceable: boolean;
35
+ codeEditable: boolean;
36
+ duplicatable: boolean;
37
+ draggable: boolean;
38
+ dropable: boolean;
39
+ $schema: string;
40
+ settingsSchema: any;
41
+ clickIgnoreSelecor: string;
42
+ nodes: Array<any>;
43
+ placeholder: string;
44
+ mounted: boolean;
45
+ replaceSettings: boolean;
46
+ regions2path: any;
47
+ childrenSortList: {
48
+ [propName: string]: Array<string>;
49
+ };
50
+ syncOutlineLazy: any;
51
+ constructor(props: T);
52
+ getChildContext(this: any): {
53
+ editorNode: {
54
+ id: any;
55
+ add: any;
56
+ remove: any;
57
+ getNodes: any;
58
+ component: any;
59
+ parent: any;
60
+ };
61
+ };
62
+ componentWillMount(): void;
63
+ componentDidMount(): void;
64
+ componentDidUpdate(): void;
65
+ componentWillUnmount(): void;
66
+ /**
67
+ * 用来判断当前编辑器节点具备什么操作能力。
68
+ * 直接调用 toolbar 里面的 test 方法。
69
+ * @param type string
70
+ */
71
+ can(type: string): boolean;
72
+ /**
73
+ * 返回 dom 元素。
74
+ */
75
+ getElement(): HTMLElement | null;
76
+ /**
77
+ * 最外层的 Editor 会调用,一遍用来切换选中状态。
78
+ * @param activeId
79
+ * @param prevId
80
+ * @param mode
81
+ */
82
+ editorWillUpdate(activeId: string | null, prevId: string | null, mode: string): any;
83
+ patchSchema(): void;
84
+ childRef(ref: any): void;
85
+ highlightRef(ref: any): void;
86
+ updateHighlight(viewOnly?: boolean): void;
87
+ getWrappedInstance(): any;
88
+ getTarget(): HTMLElement;
89
+ addNode(node: any): void;
90
+ removeTo(node: any): void;
91
+ getNodes(): any[];
92
+ syncOutline(): void;
93
+ handleClick(e: Event): void;
94
+ handleToolbarBtnClick(e: React.MouseEvent<any>): void;
95
+ handleToolbarAction(id: string): void;
96
+ handleToolbarDragStart(e: any): void;
97
+ /**
98
+ * 选中父级编辑器节点。
99
+ */
100
+ selectParent(): void;
101
+ /**
102
+ * 向外选中
103
+ */
104
+ selectOutside(): void;
105
+ /**
106
+ * 向内选中
107
+ */
108
+ selectInside(): void;
109
+ /**
110
+ * 激活当前编辑器节点。
111
+ * @param forceOpen
112
+ */
113
+ active(forceOpen?: boolean): void;
114
+ /**
115
+ * 起到 deActive 的作用,取消选中。
116
+ */
117
+ closeSetting(): void;
118
+ /**
119
+ * 复制一份自己。
120
+ */
121
+ duplicateSelf(): void;
122
+ /**
123
+ * 点开当前节点的编辑面板。
124
+ */
125
+ openEditForm(forceOpen?: boolean): void;
126
+ /**
127
+ * 点开当前节点的代码面板。
128
+ */
129
+ openEditCode(): void;
130
+ /**
131
+ * 删除自己
132
+ */
133
+ deleteSelf(): void;
134
+ /**
135
+ * 剪切掉自己
136
+ */
137
+ cutSelf(): void;
138
+ /**
139
+ * 把自己往上移动
140
+ */
141
+ moveUp(): void;
142
+ /**
143
+ * 把自己往下移动
144
+ */
145
+ moveDown(): void;
146
+ /**
147
+ * 向上选中节点
148
+ */
149
+ selectBackward(): boolean;
150
+ /**
151
+ * 向下选中节点
152
+ */
153
+ selectForward(): boolean;
154
+ /**
155
+ * 获取当前节点的配置项。
156
+ */
157
+ getSettingsValue(): any;
158
+ /**
159
+ * 设置当前节点的配置项。
160
+ */
161
+ setSettingsValue(value: any, mode?: string, callback?: (data: any) => void): void;
162
+ attachAddBtn(container: any, btn: any, defaultValue?: any): any;
163
+ normalizeContainer(schema: any, containers: Array<string>): any;
164
+ onAddNode(region: string, child: any): any;
165
+ /**
166
+ * 给当前节点添加成员。
167
+ * @param key
168
+ * @param child
169
+ * @param updateSettings
170
+ */
171
+ addChild(key: string, child: any): void;
172
+ /**
173
+ * 清空容器里面的所有节点。
174
+ * @param key
175
+ */
176
+ emptyChild(key: string): void;
177
+ /**
178
+ * 选择一个选择渲染器的框,并进行添加。
179
+ * @param region
180
+ * @param key
181
+ * @param cb
182
+ * @param whiteList
183
+ * @param updateSettings
184
+ * @param sortList
185
+ */
186
+ pickChild(region: string, key?: string, cb?: (child: any, id: string, editor: any) => void, whiteList?: Array<string> | ((type: string) => boolean), updateSettings?: boolean, sortList?: Array<string>): void;
187
+ /**
188
+ * 询问当前节点知否能接收指定节点作为孩子。
189
+ * @param type
190
+ * @param region
191
+ * @param whiteList
192
+ * @param mode
193
+ */
194
+ acceptChild(type: string, region: string, rendererId?: string): boolean | null;
195
+ /**
196
+ * 把自己替换成别的渲染器。交互是弹出个框让用户选择,然后替换。
197
+ */
198
+ changeSelf(): void;
199
+ /**
200
+ * 用来生成右键功能菜单列表。
201
+ */
202
+ getContextMenus(): Array<any>;
203
+ updateRegion(name?: string): void;
204
+ regionRef(regionName: string, ref: any): void;
205
+ renderChild(region: string, node: Schema, props: any): JSX.Element;
206
+ renderRenderer(props?: any): JSX.Element;
207
+ renderPlaceholder(props?: any): JSX.Element;
208
+ renderTip(): JSX.Element;
209
+ renderToolbars(): JSX.Element;
210
+ renderSecondaryToolbars(): React.ReactNode;
211
+ renderButton(handler: (e: React.MouseEvent<HTMLButtonElement>) => void, tooltip?: string, icon?: string, props?: any): JSX.Element;
212
+ renderBasic(enabled?: boolean): JSX.Element | JSX.Element[];
213
+ render(): JSX.Element;
214
+ }
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ export interface BreadcrumbProps {
3
+ activeId?: any;
4
+ outline?: any;
5
+ onHover: (id: string | null) => void;
6
+ onSelect: (value: any, forceOpen?: boolean) => void;
7
+ }
8
+ export interface BreadcrumbState {
9
+ links: Array<any>;
10
+ }
11
+ export default class Breadcrumb extends React.Component<BreadcrumbProps, BreadcrumbState> {
12
+ state: BreadcrumbState;
13
+ componentDidMount(): void;
14
+ componentDidUpdate(prevProps: BreadcrumbProps): void;
15
+ syncOutline(): void;
16
+ handleClick(e: React.MouseEvent<HTMLAnchorElement>): void;
17
+ handleMouseEnter(e: React.MouseEvent<HTMLAnchorElement>): void;
18
+ render(): JSX.Element;
19
+ }
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { RendererProps } from 'amis/lib/factory';
3
+ import { Schema } from 'amis/lib/types';
4
+ interface ClassNameControlProps extends RendererProps {
5
+ schema: Schema;
6
+ }
7
+ interface ClassNameControlState {
8
+ isFocused: boolean;
9
+ isOpened: boolean;
10
+ }
11
+ export declare class ClassNameControl extends React.Component<ClassNameControlProps, ClassNameControlState> {
12
+ state: {
13
+ isFocused: boolean;
14
+ isOpened: boolean;
15
+ };
16
+ values: Array<string>;
17
+ open(): void;
18
+ close(): void;
19
+ toggle(): void;
20
+ handleFocus(e: any): void;
21
+ handleBlur(e: any): void;
22
+ handleChange(e: React.ChangeEvent<HTMLInputElement>): void;
23
+ getParent(): Element | Text | null;
24
+ getTarget(): ChildNode | null;
25
+ handlePopOverChange(option: any): void;
26
+ renderGroup(option: any, index: number): JSX.Element;
27
+ renderOptions(options: Array<any>, index: number): JSX.Element[];
28
+ renderPopover(): JSX.Element;
29
+ render(): JSX.Element;
30
+ }
31
+ export {};
@@ -0,0 +1,34 @@
1
+ /// <reference types="lodash" />
2
+ import React from 'react';
3
+ export interface AMisCodeEditorProps {
4
+ value: any;
5
+ onChange: (value: any, diff: any) => void;
6
+ disabled?: boolean;
7
+ $schemaUrl?: string;
8
+ $schema?: string;
9
+ className?: string;
10
+ theme?: string;
11
+ }
12
+ export default class AMisCodeEditor extends React.Component<AMisCodeEditorProps, any> {
13
+ state: {
14
+ value: any;
15
+ contents: any;
16
+ };
17
+ lastResult: any;
18
+ model: any;
19
+ editor: any;
20
+ monaco: any;
21
+ decorations: any;
22
+ static defaultProps: Partial<AMisCodeEditorProps>;
23
+ componentWillReceiveProps(nextProps: AMisCodeEditorProps): void;
24
+ obj2str(value: any, props: AMisCodeEditorProps): any;
25
+ str2obj(str: string): any;
26
+ emitChange: (() => void) & import("lodash").Cancelable;
27
+ getFileUri(props?: AMisCodeEditorProps): string;
28
+ changeModel(props?: AMisCodeEditorProps): void;
29
+ editorFactory: (containerElement: HTMLElement, monaco: any, options: any) => any;
30
+ editorDidMount: (editor: any, monaco: any) => void;
31
+ editorWillUnmount: (editor: any, monaco: any) => void;
32
+ handleChange: (value: string) => void;
33
+ render(): JSX.Element;
34
+ }
@@ -0,0 +1,251 @@
1
+ /// <reference types="node" />
2
+ import React from 'react';
3
+ import './editors/index';
4
+ import { scaffoldForm } from './Preview';
5
+ import { Schema } from './types';
6
+ import PropTypes from 'prop-types';
7
+ import { RenderOptions } from 'amis/lib/factory';
8
+ export interface EditorProps {
9
+ value: any;
10
+ onChange: (value: any) => void;
11
+ preview?: boolean;
12
+ autoFocus?: boolean;
13
+ pathPrefix?: string;
14
+ previewClassName?: string;
15
+ previewProps?: object;
16
+ clipboard?: any;
17
+ amis_env?: RenderOptions;
18
+ theme?: string;
19
+ $schemaUrl?: string;
20
+ onEditorMount?: (component: any) => void;
21
+ onEditorUnMount?: (component: any) => void;
22
+ onHover?: (id?: string, schema?: any) => boolean;
23
+ onActive?: (id?: string, schema?: any, onChange?: (newValue: any) => void) => boolean | void;
24
+ onAdd?: (path: string, id: string, region: string, callback: (json: any) => void) => boolean | void;
25
+ onAccept?: (id: string, region: string, index: number, data: any) => void | boolean;
26
+ onMove?: (id: string, region: string, index: number, sId: string) => boolean | void;
27
+ onMoveUp?: (id: string) => boolean | void;
28
+ onMoveDown?: (id: string) => boolean | void;
29
+ onDelete?: (id: string) => boolean | void;
30
+ [propName: string]: any;
31
+ }
32
+ export declare type PatchItem = {
33
+ op: 'update' | 'replace';
34
+ target: string;
35
+ value: any;
36
+ } | {
37
+ op: 'delete';
38
+ target: string;
39
+ } | {
40
+ op: 'push';
41
+ target: string;
42
+ key: string;
43
+ value: any;
44
+ } | {
45
+ op: 'splice';
46
+ target: string;
47
+ key: string;
48
+ args: Array<any>;
49
+ };
50
+ export interface DialogConfig {
51
+ title: string;
52
+ body: any;
53
+ onConfirm: (value: any) => void;
54
+ size?: string;
55
+ closeOnEsc?: boolean;
56
+ actions?: Array<any>;
57
+ onCancel?: () => void;
58
+ }
59
+ export interface EditorState {
60
+ settings: {
61
+ id: string;
62
+ editor: any;
63
+ $schema?: string;
64
+ schema: Schema;
65
+ value?: any;
66
+ getValue?: () => any;
67
+ getRaw: () => any;
68
+ onChange: (value: any, mode: string, callback?: (value: any) => void) => void;
69
+ } | null;
70
+ value: Schema;
71
+ clipboard?: any;
72
+ dialog?: DialogConfig | null;
73
+ drawer?: DialogConfig | null;
74
+ outline?: any;
75
+ seetingsSize: 'normal' | 'large';
76
+ draging: boolean;
77
+ dropId?: string | null;
78
+ dropRegion?: string | null;
79
+ }
80
+ export default class AMisEditor extends React.PureComponent<EditorProps, EditorState> {
81
+ static defaultProps: {
82
+ value: {
83
+ title: string;
84
+ body: string;
85
+ };
86
+ pathPrefix: string;
87
+ previewClassName: string;
88
+ theme: string;
89
+ autoFocus: boolean;
90
+ };
91
+ static childContextTypes: {
92
+ editor: PropTypes.Requireable<object>;
93
+ editorNode: PropTypes.Requireable<object>;
94
+ theme: PropTypes.Requireable<string>;
95
+ };
96
+ state: EditorState;
97
+ hoverId?: string | null;
98
+ hoverRegion?: string | null;
99
+ value: any;
100
+ settings?: null | {
101
+ id: string;
102
+ editor: any;
103
+ $schema: string;
104
+ value?: any;
105
+ getValue?: () => any;
106
+ getRaw: () => any;
107
+ schema: Schema;
108
+ onChange: (value: any, mode: string, callback?: (value: any) => void) => void;
109
+ };
110
+ outline: any;
111
+ lastValue: any;
112
+ widgetsLayer: HTMLElement;
113
+ nodes: Array<any>;
114
+ defaultOpenTimer: NodeJS.Timeout;
115
+ settingsInstance: any;
116
+ previewInstance: any;
117
+ mounted: boolean;
118
+ unSensor?: () => void;
119
+ emitChangeLazy: () => void;
120
+ constructor(props: EditorProps);
121
+ static contextTypes: {
122
+ editor: PropTypes.Requireable<object>;
123
+ };
124
+ id: string;
125
+ getChildContext(): any;
126
+ componentDidMount(): void;
127
+ componentWillReceiveProps(nextProps: EditorProps): void;
128
+ componentWillUnmount(): void;
129
+ focus(): void;
130
+ handlePreviewResize(): void;
131
+ resolveEditorById(id: string): any;
132
+ switchSettingPane(key: 'nav' | 'form' | 'code'): void;
133
+ handleClick(e: MouseEvent): void;
134
+ handleMouseMove(e: React.MouseEvent): void;
135
+ handleMouseLeave(e: React.MouseEvent): void;
136
+ addNode(node: any): void;
137
+ removeTo(node: any): void;
138
+ getWidgetsLayer(): HTMLElement;
139
+ getPreviewLayer(): Element | Text | null;
140
+ getEditorLayout(): Element | Text | null;
141
+ widgetsLayerRef(ref: any): void;
142
+ settingsRef(ref: any): void;
143
+ previewRef(ref: any): void;
144
+ refreshSettings(): void;
145
+ selectEditor(id: string, forceOpen?: boolean): void;
146
+ unSelectEditor(): void;
147
+ getSettings(id: string): any;
148
+ updateSettings(id: string | void, value: any, replace?: boolean, mode?: string, lazyEmit?: boolean): void;
149
+ getParentSettings(id: string, skipArray?: boolean): any;
150
+ moveSeetingsUp(id: string): void;
151
+ moveSeetingsDown(id: string): void;
152
+ deleteSettings(id: string, deleteIfEmpty?: boolean): string[] | null;
153
+ duplicateSettings(id: string): void;
154
+ cutSettings(id: string, cb: Function): void;
155
+ clearClipBoard(): void;
156
+ getSchema(): any;
157
+ handleChange(value: Schema, lazyEmit?: boolean, mode?: string): void;
158
+ versionIdIndex: number;
159
+ versionId: number;
160
+ history: Array<{
161
+ versionId: number;
162
+ value: any;
163
+ }>;
164
+ emitChange(mode?: string): void;
165
+ getVersionId(): number;
166
+ undo(): void;
167
+ redo(): void;
168
+ confirmForm(config: scaffoldForm, initalData?: any): Promise<unknown>;
169
+ getActiveId(): string;
170
+ getHoverId(): string | null | undefined;
171
+ getHoverRegion(): string | null | undefined;
172
+ getDropId(): string | null | undefined;
173
+ setDropId(target: string | null, force?: boolean, fn?: () => void): void;
174
+ getDropRegion(): string | null | undefined;
175
+ getDragId(): string | null | undefined;
176
+ setDragId(id: string | null): void;
177
+ handleEditorHover(target: string | null): void;
178
+ activeEditor(id: string, config?: {
179
+ editor: any;
180
+ $schema: string;
181
+ value?: any;
182
+ getValue?: () => any;
183
+ getRaw: () => any;
184
+ schema: Schema;
185
+ onChange: (value: any, mode: string, callback?: (value: any) => void) => void;
186
+ }, forceOpen?: boolean): void;
187
+ getRendererCandidates(path: string, whiteList?: Array<string> | ((type: string, path: string) => boolean), sortList?: Array<string>): {
188
+ label: string | undefined;
189
+ value: any;
190
+ image: string | undefined;
191
+ docLink: string | undefined;
192
+ previewSchema: Schema | undefined;
193
+ description: string | undefined;
194
+ icon: string | undefined;
195
+ tags: string[];
196
+ }[];
197
+ pickRenderer(path: string, id: string, region: string, callback: (json: any) => void, whiteList?: Array<string> | ((type: string, path: string) => boolean), sortList?: Array<string>): void;
198
+ openDialog(title: string, body: any, onConfirm: (value: any) => void, size?: string, mode?: 'dialog' | 'drawer', closeOnEsc?: boolean, onCancel?: () => void): void;
199
+ syncOutline(): void;
200
+ handleDialogClose(): void;
201
+ handleDialogConfirm(values: Array<any>): void;
202
+ handleDrawerClose(): void;
203
+ handleDrawerConfirm(values: Array<any>): void;
204
+ handleOutlineSelect(value: any, forceOpen?: boolean): void;
205
+ handleSettingsSizeToggle(): void;
206
+ dragGhost: HTMLElement;
207
+ dragCallback: () => void;
208
+ dragData?: {
209
+ type: string;
210
+ [propName: string]: any;
211
+ };
212
+ dragRendererId?: string;
213
+ dragEl: HTMLElement | null;
214
+ dragElRaw: HTMLElement | null;
215
+ dragId?: string | null;
216
+ dropId?: string | null;
217
+ dropRegion?: string | null;
218
+ lastX: number;
219
+ lastY: number;
220
+ dragCache: any;
221
+ dragImage: HTMLDivElement | null;
222
+ getDragElement(): HTMLElement | null;
223
+ setDragElement(el: HTMLElement | null): void;
224
+ handleDragStart(e: any, el?: HTMLElement): any;
225
+ handleDragEnter(e: React.DragEvent): void;
226
+ lastMoveAt: number;
227
+ highlightedRegion: HTMLElement;
228
+ handleDragOver(e: any, el?: HTMLElement, ignoreMovement?: boolean): void;
229
+ handleDrop(e: any): void;
230
+ handleDragLeave(e: React.DragEvent): void;
231
+ handleDragEnd(e: any): void;
232
+ highlightRegion(e: Event): void;
233
+ unhighlightRegion(): void;
234
+ switchRegion(e: Event): void;
235
+ handleContextMenu(e: React.MouseEvent<HTMLElement>): void;
236
+ handleKeyDown(e: KeyboardEvent): void;
237
+ moveBackward(): void;
238
+ moveForward(): void;
239
+ selectBackward(): void;
240
+ selectForward(): void;
241
+ selectOutside(): void;
242
+ selectInside(): void;
243
+ cutActive(): void;
244
+ pasteOnActive(): void;
245
+ deleteActive(): void;
246
+ openActiveSetting(): void;
247
+ openActiveCode(): void;
248
+ duplicateActive(): void;
249
+ renderToolbar(): JSX.Element | null;
250
+ render(): JSX.Element;
251
+ }
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ export interface HighlightBoxProps {
3
+ editor: any;
4
+ id: string;
5
+ getTarget: () => HTMLElement;
6
+ className?: string;
7
+ children?: () => React.ReactNode;
8
+ }
9
+ export default class HighlightBox extends React.PureComponent<HighlightBoxProps, any> {
10
+ dom?: HTMLElement;
11
+ domRef: (ref: any) => void;
12
+ componentDidMount(): void;
13
+ componentDidUpdate(): void;
14
+ setView(): void;
15
+ update(): void;
16
+ render(): JSX.Element;
17
+ }
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import './editors/index';
3
+ import Editor, { PatchItem } from './Editor';
4
+ export default class MiniEditor extends Editor {
5
+ getChildContext(): any;
6
+ applyPatches(patches: Array<PatchItem>): void;
7
+ handleKeyDown(e: KeyboardEvent): void;
8
+ render(): JSX.Element;
9
+ }
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ interface OutlineProps {
4
+ options: Array<any>;
5
+ value: any;
6
+ onHover: (id: string | null) => void;
7
+ onSelect: (value: any, forceOpen?: boolean) => void;
8
+ showDropableNodesOnly?: boolean;
9
+ }
10
+ declare type OutlineNode = {
11
+ label: string;
12
+ value: string;
13
+ isRegion?: boolean;
14
+ draggable: boolean;
15
+ dropable: boolean;
16
+ children?: Array<OutlineNode>;
17
+ };
18
+ interface OutlineState {
19
+ options: Array<OutlineNode>;
20
+ folded: {
21
+ [propName: string]: boolean;
22
+ };
23
+ }
24
+ export default class Outline extends React.PureComponent<OutlineProps, OutlineState> {
25
+ static contextTypes: {
26
+ editor: PropTypes.Requireable<object>;
27
+ };
28
+ constructor(props: OutlineProps);
29
+ componentWillReceiveProps(nextProps: OutlineProps): void;
30
+ handleClick(e: React.MouseEvent<HTMLElement>): void;
31
+ handleEnter(e: React.MouseEvent<HTMLElement>): void;
32
+ handleExpanderClick(e: React.MouseEvent<HTMLSpanElement>): void;
33
+ handleDragStart(e: React.DragEvent<HTMLElement>): void;
34
+ handleDragOver(e: React.DragEvent<HTMLElement>): void;
35
+ renderItem(option: OutlineNode, index: number): JSX.Element;
36
+ render(): JSX.Element;
37
+ }
38
+ export {};
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import Region from './Region';
3
+ export default class PositionRegion extends Region {
4
+ handleDragEnter(e: React.DragEvent, ghost: HTMLElement): void;
5
+ handleDragLeave(e: React.DragEvent, ghost: HTMLElement): void;
6
+ handleDragOver(e: React.DragEvent, ghost: HTMLElement): void;
7
+ }