amis-editor-core 5.2.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.
Files changed (105) hide show
  1. package/lib/cebfe0bc5a1dbde02da1.svg +10 -0
  2. package/lib/compat.d.ts +30 -0
  3. package/lib/component/Breadcrumb.d.ts +33 -0
  4. package/lib/component/ClassNameControl.d.ts +31 -0
  5. package/lib/component/CommonConfigWrapper.d.ts +6 -0
  6. package/lib/component/ContainerWrapper.d.ts +12 -0
  7. package/lib/component/Editor.d.ts +99 -0
  8. package/lib/component/HighlightBox.d.ts +29 -0
  9. package/lib/component/IFrameBridge.d.ts +32 -0
  10. package/lib/component/IFramePreview.d.ts +38 -0
  11. package/lib/component/MiniEditor.d.ts +9 -0
  12. package/lib/component/NodeWrapper.d.ts +20 -0
  13. package/lib/component/Panel/AMisCodeEditor.d.ts +37 -0
  14. package/lib/component/Panel/AvailableRenderersPanel.d.ts +10 -0
  15. package/lib/component/Panel/CodeEditorPanel.d.ts +6 -0
  16. package/lib/component/Panel/ContextMenuPanel.d.ts +8 -0
  17. package/lib/component/Panel/DrawerPanel.d.ts +15 -0
  18. package/lib/component/Panel/DrawerRendererPanel.d.ts +15 -0
  19. package/lib/component/Panel/InsertSubRendererPanel.d.ts +11 -0
  20. package/lib/component/Panel/LeftPanels.d.ts +20 -0
  21. package/lib/component/Panel/Outline.d.ts +18 -0
  22. package/lib/component/Panel/RenderersPanel.d.ts +31 -0
  23. package/lib/component/Panel/RightPanels.d.ts +21 -0
  24. package/lib/component/Panel/TargetNamePanel.d.ts +7 -0
  25. package/lib/component/PopOverForm.d.ts +22 -0
  26. package/lib/component/Preview.d.ts +67 -0
  27. package/lib/component/RegionHLBox.d.ts +20 -0
  28. package/lib/component/RegionWrapper.d.ts +206 -0
  29. package/lib/component/RendererThumb.d.ts +22 -0
  30. package/lib/component/ScaffoldModal.d.ts +24 -0
  31. package/lib/component/SubEditor.d.ts +67 -0
  32. package/lib/component/VRenderer.d.ts +191 -0
  33. package/lib/component/base/BackTop.d.ts +26 -0
  34. package/lib/component/base/ErrorRenderer.d.ts +4 -0
  35. package/lib/component/base/SearchCustomRendererPanel.d.ts +15 -0
  36. package/lib/component/base/SearchPanel.d.ts +83 -0
  37. package/lib/component/base/SearchRendererPanel.d.ts +19 -0
  38. package/lib/component/base/WidthDraggableBtn.d.ts +16 -0
  39. package/lib/component/base/WidthDraggableContainer.d.ts +2 -0
  40. package/lib/component/factory.d.ts +19 -0
  41. package/lib/dnd/default.d.ts +47 -0
  42. package/lib/dnd/index.d.ts +119 -0
  43. package/lib/dnd/interface.d.ts +14 -0
  44. package/lib/dnd/position-h.d.ts +7 -0
  45. package/lib/env.d.ts +5 -0
  46. package/lib/icons/index.d.ts +2 -0
  47. package/lib/index.d.ts +36 -0
  48. package/lib/index.min.js +1 -0
  49. package/lib/manager.d.ts +509 -0
  50. package/lib/mocker.d.ts +1 -0
  51. package/lib/plugin/AvailableRenderers.d.ts +8 -0
  52. package/lib/plugin/BasicToolbar.d.ts +11 -0
  53. package/lib/plugin/Code.d.ts +9 -0
  54. package/lib/plugin/DataDebug.d.ts +19 -0
  55. package/lib/plugin/ErrorRenderer.d.ts +7 -0
  56. package/lib/plugin/Name.d.ts +8 -0
  57. package/lib/plugin/Outline.d.ts +8 -0
  58. package/lib/plugin/Unknown.d.ts +5 -0
  59. package/lib/plugin.d.ts +639 -0
  60. package/lib/store/editor.d.ts +1048 -0
  61. package/lib/store/node.d.ts +281 -0
  62. package/lib/style.css +1 -0
  63. package/lib/tpl.d.ts +5 -0
  64. package/lib/util.d.ts +80 -0
  65. package/package.json +102 -0
  66. package/scss/_backTop.scss +55 -0
  67. package/scss/_bcn.scss +157 -0
  68. package/scss/_classname-picker.scss +57 -0
  69. package/scss/_context-menu-setting.scss +109 -0
  70. package/scss/_data-chain.scss +39 -0
  71. package/scss/_leftPanel.scss +237 -0
  72. package/scss/_mixin.scss +95 -0
  73. package/scss/_outline.scss +206 -0
  74. package/scss/_renderers.scss +536 -0
  75. package/scss/_rightPanel.scss +424 -0
  76. package/scss/_searchRendererPanel.scss +244 -0
  77. package/scss/_selection.scss +6 -0
  78. package/scss/_tableview.scss +53 -0
  79. package/scss/_targetname.scss +30 -0
  80. package/scss/_tooltip.scss +111 -0
  81. package/scss/_variables.scss +41 -0
  82. package/scss/control/_api-control.scss +61 -0
  83. package/scss/control/_badge-control.scss +46 -0
  84. package/scss/control/_dateshortcut-control.scss +108 -0
  85. package/scss/control/_formItem-control.scss +121 -0
  86. package/scss/control/_formula-control.scss +108 -0
  87. package/scss/control/_option-control.scss +170 -0
  88. package/scss/control/_switch-more-control.scss +121 -0
  89. package/scss/control/_validation-control.scss +101 -0
  90. package/scss/editor.scss +1563 -0
  91. package/scss/style-control/_background.scss +204 -0
  92. package/scss/style-control/_border.scss +105 -0
  93. package/scss/style-control/_box-model.scss +100 -0
  94. package/scss/style-control/_box-shadow.scss +12 -0
  95. package/scss/style-control/_font.scss +28 -0
  96. package/scss/style-control/_size.scss +40 -0
  97. package/scss/style-control/_style-common.scss +22 -0
  98. package/static/Code-hover.png +0 -0
  99. package/static/Code.png +0 -0
  100. package/static/Outline-hover.png +0 -0
  101. package/static/Outline.png +0 -0
  102. package/static/Renderers-hover.png +0 -0
  103. package/static/Renderers.png +0 -0
  104. package/static/empty.png +0 -0
  105. package/static/side_hide_left.svg +10 -0
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { EditorStoreType } from '../../store/editor';
3
+ import { SubRendererInfo } from '../../plugin';
4
+ interface SearchRendererProps {
5
+ store: EditorStoreType;
6
+ }
7
+ interface SearchRendererStates {
8
+ subRenderersByOrder: Array<SubRendererInfo>;
9
+ defaultKeyword: string;
10
+ }
11
+ export default class SearchRendererPanel extends React.Component<SearchRendererProps, SearchRendererStates> {
12
+ localStorageKey: string;
13
+ lastSubRenderersTag: string;
14
+ constructor(props: any);
15
+ UNSAFE_componentWillReceiveProps(nextProps: any): void;
16
+ changeSubRenderersTag(curTag: string): void;
17
+ render(): JSX.Element;
18
+ }
19
+ export {};
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ interface WidthDraggableProps {
3
+ isLeftDragIcon?: boolean;
4
+ className?: any;
5
+ }
6
+ export declare class WidthDraggableBtn extends React.Component<WidthDraggableProps> {
7
+ startX: number;
8
+ startWidth: number;
9
+ dragWrap: HTMLElement;
10
+ constructor(props: any);
11
+ handleResizeMouseDown(e: React.MouseEvent): void;
12
+ handleResizeMouseMove(e: MouseEvent): void;
13
+ handleResizeMouseUp(): void;
14
+ render(): JSX.Element;
15
+ }
16
+ export {};
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function (NeedWidthDraggableComp: React.ComponentType, isLeftDragIcon?: boolean): React.ComponentType;
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import { PanelProps, RegionConfig, RendererInfo } from '../plugin';
3
+ import { EditorNodeType } from '../store/node';
4
+ import { EditorManager } from '../manager';
5
+ import type { RendererConfig } from 'amis-core/lib/factory';
6
+ export declare function makeWrapper(manager: EditorManager, info: RendererInfo, rendererConfig: RendererConfig): any;
7
+ export declare function makeSchemaFormRender(manager: EditorManager, schema: {
8
+ body?: Array<any>;
9
+ controls?: Array<any>;
10
+ definitions?: any;
11
+ api?: any;
12
+ submitOnChange?: boolean;
13
+ justify?: boolean;
14
+ rendererName?: string;
15
+ formKey?: string;
16
+ }): ({ value, onChange, popOverContainer, id, store, node }: PanelProps) => JSX.Element;
17
+ export declare function hackIn(renderer: RendererConfig, regions?: Array<RegionConfig>, overrides?: any): void;
18
+ export declare function mapReactElement(dom: JSX.Element, iterator: (dom: JSX.Element, index?: number) => JSX.Element, index?: number): JSX.Element;
19
+ export declare function renderThumbToGhost(ghost: HTMLElement, region: EditorNodeType, schema: any, manager: EditorManager): void;
@@ -0,0 +1,47 @@
1
+ import { EditorDNDManager } from '.';
2
+ import { EditorNodeType } from '../store/node';
3
+ import { DNDModeInterface } from './interface';
4
+ export declare class DefaultDNDMode implements DNDModeInterface {
5
+ readonly dnd: EditorDNDManager;
6
+ readonly region: EditorNodeType;
7
+ readonly dndContainer: HTMLElement;
8
+ dropBeforeId?: string;
9
+ constructor(dnd: EditorDNDManager, region: EditorNodeType);
10
+ /**
11
+ * 记录上次交换时的鼠标位置。
12
+ */
13
+ exchangeX: number;
14
+ exchangeY: number;
15
+ /**
16
+ * 首次拖入,把 ghost 插入进来。让用户有个直观感受。
17
+ * @param e
18
+ * @param ghost
19
+ */
20
+ enter(e: DragEvent, ghost: HTMLElement): void;
21
+ /**
22
+ * 拖出去了,就移除 ghost
23
+ * @param e
24
+ * @param ghost
25
+ */
26
+ leave(e: DragEvent, ghost: HTMLElement): void;
27
+ over(e: DragEvent, ghost: HTMLElement): void;
28
+ /**
29
+ * 返回个相对位置,如果没有数据会插入到结尾。
30
+ */
31
+ getDropBeforeId(): string | undefined;
32
+ /**
33
+ * 获取当时拖动到了哪个节点上面。
34
+ */
35
+ getTarget(e: DragEvent): HTMLElement | null;
36
+ /**
37
+ * 获取区域的直接孩子,因为有时候会在孩子的孩子里面。
38
+ * 但是插入 ghost 的相对位置,insertBefore 只能是当前孩子。
39
+ * @param dom
40
+ * @param descend
41
+ */
42
+ getChild(dom: HTMLElement, descend: HTMLElement): HTMLElement;
43
+ /**
44
+ * 销毁
45
+ */
46
+ dispose(): void;
47
+ }
@@ -0,0 +1,119 @@
1
+ import { EditorManager } from '../manager';
2
+ import { EditorStoreType } from '../store/editor';
3
+ import { EditorNodeType } from '../store/node';
4
+ import { DNDModeInterface } from './interface';
5
+ export declare class EditorDNDManager {
6
+ readonly manager: EditorManager;
7
+ readonly store: EditorStoreType;
8
+ toDispose: Array<() => void>;
9
+ /**
10
+ * 这个会随着 region 的切换,每次动态创建。
11
+ */
12
+ dndMode?: DNDModeInterface;
13
+ /**
14
+ * 拖拽对象 dom。
15
+ */
16
+ readonly dragGhost: HTMLElement;
17
+ /**
18
+ * 统计dragEnter 的次数,因为这个方法会调用很多次,
19
+ * 有时候只想第一次进来的时候处理逻辑
20
+ */
21
+ dragEnterCount: number;
22
+ /**
23
+ * 当前被拖动的渲染器元素。注意这里不一定是 e.target。
24
+ */
25
+ dragElement?: HTMLElement;
26
+ /**
27
+ * 拖拽跟随元素
28
+ */
29
+ dragImage?: HTMLElement;
30
+ /**
31
+ * 记录上次鼠标位置信息,协助拖拽计算的。
32
+ */
33
+ lastX: number;
34
+ lastY: number;
35
+ lastMoveAt: number;
36
+ constructor(manager: EditorManager, store: EditorStoreType);
37
+ /**
38
+ * 创建拖拽跟随元素,如果用默认太大了,而且有时候不统一。
39
+ * @param id
40
+ * @param node
41
+ */
42
+ createDragImage(id: string, node: EditorNodeType): HTMLDivElement;
43
+ /**
44
+ * 销毁拖拽跟随元素
45
+ */
46
+ disposeDragImage(): void;
47
+ /**
48
+ * 切换到目标区域。
49
+ * @param e
50
+ * @param id
51
+ * @param region
52
+ */
53
+ switchToRegion(e: DragEvent, id: string, region: string): boolean;
54
+ /**
55
+ * 根据区域的配置,创建拖拽模式实例。
56
+ * 比如 table 列区域的拖拽就是放根线表示拖入的位置。
57
+ * @param region
58
+ */
59
+ makeDNDModeInstance(region: EditorNodeType): DNDModeInterface | null;
60
+ /**
61
+ * 拖拽入口,一个是拖拽按钮 toolbar,一个是 outline 里面的导航项
62
+ * @param id
63
+ * @param e
64
+ */
65
+ startDrag(id: string, e: DragEvent): void;
66
+ /**
67
+ * 有东西拖进来了。目前只支持内部面边里面的可用组件,后续还会支持其他类型。
68
+ * @param e
69
+ */
70
+ dragEnter(e: DragEvent): void;
71
+ /**
72
+ * 拖入后的每一次移动,除了切换区域的逻辑外都丢给 DNDMode 那个去处理了。
73
+ * @param e
74
+ */
75
+ dragOver(e: DragEvent): void;
76
+ /**
77
+ * 拖拽释放的逻辑。
78
+ * @param e
79
+ */
80
+ drop(e: DragEvent): Promise<void>;
81
+ /**
82
+ * 拖拽离开时调用。
83
+ * @param e
84
+ */
85
+ dragLeave(e: DragEvent): void;
86
+ /**
87
+ * 拖拽结束了。
88
+ * @param e
89
+ */
90
+ dragEnd(e: DragEvent): void;
91
+ /**
92
+ * 自动给正在拖拽的元素加 is-draging 之类的 css。
93
+ */
94
+ updateDragElements(dragId: string): void;
95
+ /**
96
+ * 自动给拖入的区域添加 is-dragenter 之类的 css。
97
+ */
98
+ updateDropRegion(value: {
99
+ id: string;
100
+ region: string;
101
+ }, oldValue?: {
102
+ id: string;
103
+ region: string;
104
+ }): void;
105
+ /**
106
+ * 自动给即将激活的区域添加高亮。
107
+ */
108
+ updatePlanDropRegion(value: {
109
+ id: string;
110
+ region: string;
111
+ }, oldValue?: {
112
+ id: string;
113
+ region: string;
114
+ }): void;
115
+ /**
116
+ * 销毁函数。
117
+ */
118
+ dispose(): void;
119
+ }
@@ -0,0 +1,14 @@
1
+ import { EditorNodeType } from '../store/node';
2
+ import { EditorDNDManager } from './index';
3
+ /**
4
+ * 每种拖拽模式都需要实现这些约定。
5
+ */
6
+ export interface DNDModeInterface {
7
+ readonly dnd: EditorDNDManager;
8
+ readonly region: EditorNodeType;
9
+ enter: (e: DragEvent, ghost: HTMLElement) => void;
10
+ leave: (e: DragEvent, ghost: HTMLElement) => void;
11
+ over: (e: DragEvent, ghost: HTMLElement) => void;
12
+ getDropBeforeId: () => string | undefined;
13
+ dispose: () => void;
14
+ }
@@ -0,0 +1,7 @@
1
+ import { DefaultDNDMode } from './default';
2
+ import { DNDModeInterface } from './interface';
3
+ export declare class PositionHDNDMode extends DefaultDNDMode implements DNDModeInterface {
4
+ enter(e: DragEvent, ghost: HTMLElement): void;
5
+ leave(e: DragEvent, ghost: HTMLElement): void;
6
+ over(e: DragEvent, ghost: HTMLElement): void;
7
+ }
package/lib/env.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 传给 amis 渲染器的默认 env
3
+ */
4
+ import { RenderOptions } from 'amis-core';
5
+ export declare const env: RenderOptions;
@@ -0,0 +1,2 @@
1
+ import { Icon } from 'amis';
2
+ export { Icon };
package/lib/index.d.ts ADDED
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @file 总入口
3
+ */
4
+ import Editor from './component/Editor';
5
+ import './component/ClassNameControl';
6
+ import 'amis-editor-comp';
7
+ import 'amis-editor-comp/dist/index.css';
8
+ import './plugin/AvailableRenderers';
9
+ import './plugin/BasicToolbar';
10
+ import './plugin/Code';
11
+ import './plugin/DataDebug';
12
+ import './plugin/ErrorRenderer';
13
+ import './plugin/Outline';
14
+ import './plugin/Unknown';
15
+ import * as utils from './util';
16
+ export * from './util';
17
+ export * from './tpl';
18
+ export * from './manager';
19
+ export * from './plugin';
20
+ export * from './icons/index';
21
+ export * from './mocker';
22
+ import { BasicEditor, RendererEditor } from './compat';
23
+ import MiniEditor from './component/MiniEditor';
24
+ import CodeEditor from './component/Panel/AMisCodeEditor';
25
+ import IFramePreview from './component/IFramePreview';
26
+ import { mountInIframe } from './component/IFrameBridge';
27
+ import SearchPanel from './component/base/SearchPanel';
28
+ import { VRenderer } from './component/VRenderer';
29
+ import { RegionWrapper } from './component/RegionWrapper';
30
+ import { mapReactElement } from './component/factory';
31
+ import { EditorNodeType } from './store/node';
32
+ import { ContainerWrapper } from './component/ContainerWrapper';
33
+ import { EditorStoreType } from './store/editor';
34
+ import { AvailableRenderersPlugin } from './plugin/AvailableRenderers';
35
+ export default Editor;
36
+ export { Editor, MiniEditor, utils, mapReactElement, RendererEditor, BasicEditor, CodeEditor, VRenderer, RegionWrapper, mountInIframe, IFramePreview as IFrameEditor, SearchPanel, EditorNodeType, EditorStoreType, ContainerWrapper, AvailableRenderersPlugin };