neo-cmp-cli 1.2.2 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/module/index.js +3 -5
- package/src/module/main.js +3 -7
- package/src/neo/neoRequire.js +18 -0
- package/src/template/antd-custom-cmp-template/neo.config.js +2 -0
- package/src/template/antd-custom-cmp-template/package.json +2 -2
- package/src/template/antd-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/src/template/antd-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/src/template/antd-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/src/template/antd-custom-cmp-template/src/components/info-card/index.tsx +3 -3
- package/src/template/develop/neo-custom-cmp-template/.prettierrc.js +12 -0
- package/src/template/develop/neo-custom-cmp-template/README.md +48 -0
- package/src/template/develop/neo-custom-cmp-template/commitlint.config.js +59 -0
- package/src/template/develop/neo-custom-cmp-template/docs/README.md +13 -0
- package/src/template/develop/neo-custom-cmp-template/neo.config.js +121 -0
- package/src/template/develop/neo-custom-cmp-template/package.json +63 -0
- package/src/template/develop/neo-custom-cmp-template/public/css/base.css +283 -0
- package/src/template/develop/neo-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/src/template/develop/neo-custom-cmp-template/public/template.html +13 -0
- package/src/template/develop/neo-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/src/template/develop/neo-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/src/template/develop/neo-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/src/template/develop/neo-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/src/template/develop/neo-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/src/template/develop/neo-custom-cmp-template/src/assets/img/table.svg +1 -0
- package/src/template/develop/neo-custom-cmp-template/src/components/contact-card-list/README.md +65 -0
- package/src/template/develop/neo-custom-cmp-template/src/components/contact-card-list/index.tsx +180 -0
- package/src/template/develop/neo-custom-cmp-template/src/components/contact-card-list/model.ts +56 -0
- package/src/template/develop/neo-custom-cmp-template/src/components/contact-card-list/style.scss +260 -0
- package/src/template/develop/neo-custom-cmp-template/src/components/contact-form/README.md +94 -0
- package/src/template/develop/neo-custom-cmp-template/src/components/contact-form/index.tsx +251 -0
- package/src/template/develop/neo-custom-cmp-template/src/components/contact-form/model.ts +56 -0
- package/src/template/develop/neo-custom-cmp-template/src/components/contact-form/style.scss +120 -0
- package/src/template/{neo-custom-cmp-template → develop/neo-custom-cmp-template}/src/components/neo-entity-grid/index.tsx +41 -32
- package/src/template/{neo-custom-cmp-template → develop/neo-custom-cmp-template}/src/components/neo-entity-grid/model.ts +0 -7
- package/src/template/develop/neo-custom-cmp-template/src/utils/axiosFetcher.ts +29 -0
- package/src/template/develop/neo-custom-cmp-template/src/utils/queryObjectData.ts +39 -0
- package/src/template/develop/neo-custom-cmp-template/src/utils/xobjects.ts +203 -0
- package/src/template/develop/neo-custom-cmp-template/tsconfig.json +68 -0
- package/src/template/echarts-custom-cmp-template/package.json +2 -2
- package/src/template/echarts-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/src/template/echarts-custom-cmp-template/src/assets/img/chart.svg +1 -0
- package/src/template/echarts-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/src/template/echarts-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/src/template/neo-custom-cmp-template/README.md +4 -3
- package/src/template/neo-custom-cmp-template/docs/README.md +244 -0
- package/src/template/neo-custom-cmp-template/neo.config.js +1 -0
- package/src/template/neo-custom-cmp-template/package.json +6 -3
- package/src/template/neo-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/src/template/neo-custom-cmp-template/src/assets/img/card-list.svg +1 -0
- package/src/template/neo-custom-cmp-template/src/assets/img/contact-form.svg +1 -0
- package/src/template/neo-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/src/template/neo-custom-cmp-template/src/assets/img/table.svg +1 -0
- package/src/template/neo-custom-cmp-template/src/components/contact-card-list/README.md +66 -0
- package/src/template/neo-custom-cmp-template/src/components/contact-card-list/index.tsx +180 -0
- package/src/template/neo-custom-cmp-template/src/components/contact-card-list/model.ts +56 -0
- package/src/template/neo-custom-cmp-template/src/components/contact-card-list/style.scss +260 -0
- package/src/template/neo-custom-cmp-template/src/components/contact-form/README.md +94 -0
- package/src/template/neo-custom-cmp-template/src/components/contact-form/index.tsx +251 -0
- package/src/template/neo-custom-cmp-template/src/components/contact-form/model.ts +56 -0
- package/src/template/neo-custom-cmp-template/src/components/contact-form/style.scss +120 -0
- package/src/template/neo-custom-cmp-template/src/components/xobject-table/README.md +113 -0
- package/src/template/neo-custom-cmp-template/src/components/xobject-table/index.tsx +744 -0
- package/src/template/neo-custom-cmp-template/src/components/xobject-table/model.ts +122 -0
- package/src/template/neo-custom-cmp-template/src/components/xobject-table/style.scss +304 -0
- package/src/template/neo-custom-cmp-template/src/utils/axiosFetcher.ts +37 -0
- package/src/template/neo-custom-cmp-template/src/utils/queryObjectData.ts +65 -0
- package/src/template/neo-custom-cmp-template/src/utils/xobjects.ts +162 -0
- package/src/template/neo-custom-cmp-template/tsconfig.json +4 -1
- package/src/template/react-custom-cmp-template/package.json +1 -1
- package/src/template/react-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/src/template/react-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/src/template/react-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/src/template/react-ts-custom-cmp-template/package.json +1 -1
- package/src/template/react-ts-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/src/template/react-ts-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/src/template/react-ts-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/src/template/vue2-custom-cmp-template/package.json +1 -1
- package/src/template/vue2-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/src/template/vue2-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/src/template/vue2-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/bin/neo.js +0 -2
- package/src/template/neo-custom-cmp-template/src/components/info-card/index.tsx +0 -69
- package/src/template/neo-custom-cmp-template/src/components/info-card/model.ts +0 -78
- package/src/template/neo-custom-cmp-template/src/components/info-card/style.scss +0 -105
- /package/src/template/{neo-custom-cmp-template → develop/neo-custom-cmp-template}/src/components/neo-entity-grid/README.md +0 -0
- /package/src/template/{neo-custom-cmp-template → develop/neo-custom-cmp-template}/src/components/neo-entity-grid/style.scss +0 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
.contact-form-container {
|
|
2
|
+
.contact-form-card {
|
|
3
|
+
.ant-card-head {
|
|
4
|
+
border-bottom: 1px solid #f0f0f0;
|
|
5
|
+
|
|
6
|
+
.ant-card-head-title {
|
|
7
|
+
font-size: 18px;
|
|
8
|
+
font-weight: 600;
|
|
9
|
+
color: #262626;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.contact-form {
|
|
14
|
+
.ant-form-item {
|
|
15
|
+
margin-bottom: 20px;
|
|
16
|
+
|
|
17
|
+
.ant-form-item-label {
|
|
18
|
+
padding-bottom: 4px;
|
|
19
|
+
|
|
20
|
+
label {
|
|
21
|
+
font-weight: 500;
|
|
22
|
+
color: #262626;
|
|
23
|
+
|
|
24
|
+
&.ant-form-item-required::before {
|
|
25
|
+
color: #ff4d4f;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.ant-input,
|
|
31
|
+
.ant-select-selector {
|
|
32
|
+
border-radius: 6px;
|
|
33
|
+
border-color: #d9d9d9;
|
|
34
|
+
|
|
35
|
+
&:hover {
|
|
36
|
+
border-color: #40a9ff;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&:focus,
|
|
40
|
+
&.ant-select-focused .ant-select-selector {
|
|
41
|
+
border-color: #1890ff;
|
|
42
|
+
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ant-select {
|
|
47
|
+
.ant-select-selector {
|
|
48
|
+
height: 40px;
|
|
49
|
+
|
|
50
|
+
.ant-select-selection-item {
|
|
51
|
+
line-height: 38px;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.ant-input {
|
|
57
|
+
height: 40px;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.form-actions {
|
|
62
|
+
margin-bottom: 0;
|
|
63
|
+
padding-top: 16px;
|
|
64
|
+
border-top: 1px solid #f0f0f0;
|
|
65
|
+
text-align: right;
|
|
66
|
+
|
|
67
|
+
.ant-btn {
|
|
68
|
+
height: 40px;
|
|
69
|
+
padding: 8px 24px;
|
|
70
|
+
border-radius: 6px;
|
|
71
|
+
font-weight: 500;
|
|
72
|
+
|
|
73
|
+
&.ant-btn-primary {
|
|
74
|
+
background-color: #1890ff;
|
|
75
|
+
border-color: #1890ff;
|
|
76
|
+
|
|
77
|
+
&:hover {
|
|
78
|
+
background-color: #40a9ff;
|
|
79
|
+
border-color: #40a9ff;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&:active {
|
|
83
|
+
background-color: #096dd9;
|
|
84
|
+
border-color: #096dd9;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&:not(.ant-btn-primary) {
|
|
89
|
+
color: #262626;
|
|
90
|
+
background-color: #fff;
|
|
91
|
+
border-color: #d9d9d9;
|
|
92
|
+
|
|
93
|
+
&:hover {
|
|
94
|
+
color: #1890ff;
|
|
95
|
+
border-color: #1890ff;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// 响应式设计
|
|
105
|
+
@media (max-width: 768px) {
|
|
106
|
+
.contact-form-container {
|
|
107
|
+
.contact-form-card {
|
|
108
|
+
.contact-form {
|
|
109
|
+
.form-actions {
|
|
110
|
+
text-align: center;
|
|
111
|
+
|
|
112
|
+
.ant-btn {
|
|
113
|
+
width: 100%;
|
|
114
|
+
margin: 4px 0;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
// @ts-ignore
|
|
3
3
|
import { EntityGrid, EntityGridStore } from 'neo-ui-component-web';
|
|
4
|
-
|
|
5
|
-
import axios from 'axios';
|
|
4
|
+
import axiosFetcher from '../../utils/axiosFetcher';
|
|
6
5
|
import './style.scss'; // 组件内容样式
|
|
7
6
|
|
|
8
7
|
interface NeoEntityGridProps {
|
|
@@ -19,50 +18,59 @@ interface NeoEntityGridProps {
|
|
|
19
18
|
export default class NeoEntityGrid extends React.PureComponent<NeoEntityGridProps> {
|
|
20
19
|
private entityGridStore: any;
|
|
21
20
|
|
|
21
|
+
private entityGridRef: React.RefObject<EntityGrid>;
|
|
22
|
+
|
|
22
23
|
constructor(props: NeoEntityGridProps) {
|
|
23
24
|
super(props);
|
|
25
|
+
this.entityGridRef = React.createRef();
|
|
24
26
|
this.onSelectedCall = this.onSelectedCall.bind(this);
|
|
25
27
|
this.initStore();
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
shouldComponentUpdate(nextProps: Readonly<NeoEntityGridProps>): boolean {
|
|
31
|
+
if (nextProps.objectApiKey !== this.props.objectApiKey) {
|
|
32
|
+
// this.initStore();
|
|
33
|
+
}
|
|
34
|
+
const entityGridRef = this.entityGridRef.current || {};
|
|
35
|
+
const nexObj = entityGridRef.nexObj;
|
|
36
|
+
|
|
29
37
|
const {
|
|
38
|
+
title,
|
|
30
39
|
objectApiKey = 'account',
|
|
31
40
|
tableType = 'lookup',
|
|
32
41
|
selectionMode = 'multiple',
|
|
33
|
-
env,
|
|
34
42
|
showFooter = false,
|
|
35
43
|
showHeader = true,
|
|
44
|
+
...restProps
|
|
36
45
|
} = this.props;
|
|
37
|
-
// 创建基于 axios 的 fetcher 函数
|
|
38
|
-
const axiosFetcher = async (options: any) => {
|
|
39
|
-
const url = options?.url || '';
|
|
40
46
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
entityGridRef.resetGrid({
|
|
48
|
+
// ...restProps,
|
|
49
|
+
pattern: 'pickView',
|
|
50
|
+
objectApiKey,
|
|
51
|
+
name: `${objectApiKey}Picker`,
|
|
52
|
+
tableType,
|
|
53
|
+
selectionMode,
|
|
54
|
+
skipExt: true,
|
|
55
|
+
onSelectedCall: this.onSelectedCall,
|
|
56
|
+
funPermission: true,
|
|
57
|
+
nexObj,
|
|
58
|
+
// store: this.entityGridStore,
|
|
59
|
+
});
|
|
54
60
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
// 不重新渲染整个组件
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
58
64
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
initStore() {
|
|
66
|
+
const {
|
|
67
|
+
objectApiKey = 'account',
|
|
68
|
+
tableType = 'lookup',
|
|
69
|
+
selectionMode = 'multiple',
|
|
70
|
+
env,
|
|
71
|
+
showFooter = false,
|
|
72
|
+
showHeader = true,
|
|
73
|
+
} = this.props;
|
|
66
74
|
|
|
67
75
|
try {
|
|
68
76
|
// 生成唯一的实例ID
|
|
@@ -124,7 +132,7 @@ export default class NeoEntityGrid extends React.PureComponent<NeoEntityGridProp
|
|
|
124
132
|
getFooterAmis: (options: any) => ({
|
|
125
133
|
type: 'container',
|
|
126
134
|
body: '分页信息',
|
|
127
|
-
...options
|
|
135
|
+
...options,
|
|
128
136
|
}),
|
|
129
137
|
getSelectedData: () => this.entityGridStore?.selectedData || [],
|
|
130
138
|
setSelectedRowsId: (ids: any) => {
|
|
@@ -189,7 +197,7 @@ export default class NeoEntityGrid extends React.PureComponent<NeoEntityGridProp
|
|
|
189
197
|
getFooterAmis: (options: any) => ({
|
|
190
198
|
type: 'container',
|
|
191
199
|
body: '分页信息',
|
|
192
|
-
...options
|
|
200
|
+
...options,
|
|
193
201
|
}),
|
|
194
202
|
getSelectedData: () => this.entityGridStore?.selectedData || [],
|
|
195
203
|
setSelectedRowsId: (ids: any) => {
|
|
@@ -277,6 +285,7 @@ export default class NeoEntityGrid extends React.PureComponent<NeoEntityGridProp
|
|
|
277
285
|
</div>
|
|
278
286
|
<div className="entity-grid-wrapper">
|
|
279
287
|
<EntityGrid
|
|
288
|
+
ref={this.entityGridRef}
|
|
280
289
|
{...restProps}
|
|
281
290
|
pattern="pickView"
|
|
282
291
|
objectApiKey={objectApiKey}
|
|
@@ -42,13 +42,6 @@ export class NeoEntityGridModel {
|
|
|
42
42
|
* 组件面板配置,用于生成编辑器右侧属性配置面板内容
|
|
43
43
|
*/
|
|
44
44
|
propsSchema = [
|
|
45
|
-
{
|
|
46
|
-
type: 'textarea',
|
|
47
|
-
name: 'title',
|
|
48
|
-
label: '卡片title',
|
|
49
|
-
value:
|
|
50
|
-
'营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。',
|
|
51
|
-
},
|
|
52
45
|
{
|
|
53
46
|
type: 'select',
|
|
54
47
|
name: 'objectApiKey',
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
|
|
3
|
+
// 创建基于 axios 的 fetcher 函数
|
|
4
|
+
const axiosFetcher = async (options: any) => {
|
|
5
|
+
try {
|
|
6
|
+
const config = {
|
|
7
|
+
...options,
|
|
8
|
+
method: options?.method || 'GET',
|
|
9
|
+
data: options?.data || {},
|
|
10
|
+
headers: {
|
|
11
|
+
'Content-Type': 'application/json',
|
|
12
|
+
...options?.headers,
|
|
13
|
+
},
|
|
14
|
+
timeout: options?.timeout || 10000,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
if (config?.method === 'GET') {
|
|
18
|
+
config.params = options?.data || {};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const response = await axios(config);
|
|
22
|
+
return response;
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.error('接口请求报错:', error, ',请求参数:', options);
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default axiosFetcher;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { message } from 'antd';
|
|
2
|
+
import axiosFetcher from './axiosFetcher';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 这里存放通用查询类 Open API
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// 获取业务对象数据列表
|
|
9
|
+
export const queryXObjectData = async (options?: any) => {
|
|
10
|
+
const apiUrl = '/rest/data/v2/query';
|
|
11
|
+
const curOptions = options || {};
|
|
12
|
+
const xObjectApiKey = curOptions.xObjectApiKey || '';
|
|
13
|
+
const fields = curOptions.fields || [];
|
|
14
|
+
|
|
15
|
+
const querySql = `select ${fields.join(',')} from ${xObjectApiKey}`;
|
|
16
|
+
try {
|
|
17
|
+
const config = {
|
|
18
|
+
url: apiUrl,
|
|
19
|
+
method: 'GET',
|
|
20
|
+
headers: {
|
|
21
|
+
'Content-Type': 'application/json',
|
|
22
|
+
...curOptions.headers,
|
|
23
|
+
},
|
|
24
|
+
data: {
|
|
25
|
+
q: querySql,
|
|
26
|
+
},
|
|
27
|
+
timeout: curOptions.timeout || 10000,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const response = await axiosFetcher(config);
|
|
31
|
+
return response?.data;
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error('获取业务类型失败:', error);
|
|
34
|
+
message.error('获取业务类型失败。');
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default queryXObjectData;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { message } from 'antd';
|
|
2
|
+
import axiosFetcher from './axiosFetcher';
|
|
3
|
+
|
|
4
|
+
// 获取业务类型列表
|
|
5
|
+
export const getEntityTypeList = async (
|
|
6
|
+
xObjectApiKey: string,
|
|
7
|
+
options?: any,
|
|
8
|
+
) => {
|
|
9
|
+
const curOptions = options || {};
|
|
10
|
+
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/busiType`;
|
|
11
|
+
try {
|
|
12
|
+
const config = {
|
|
13
|
+
...curOptions,
|
|
14
|
+
url: apiUrl,
|
|
15
|
+
method: 'GET',
|
|
16
|
+
headers: {
|
|
17
|
+
'Content-Type': 'application/json',
|
|
18
|
+
...curOptions.headers,
|
|
19
|
+
},
|
|
20
|
+
timeout: curOptions.timeout || 10000,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const response = await axiosFetcher(config);
|
|
24
|
+
return response?.data;
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error('获取业务类型失败:', error);
|
|
27
|
+
message.error('获取业务类型失败。');
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// 获取对象列表
|
|
33
|
+
export const getEntityList = async (options?: any) => {
|
|
34
|
+
const curOptions = options || {};
|
|
35
|
+
const custom = curOptions.custom || false; // 默认获取标准对象列表
|
|
36
|
+
const active = curOptions.active || true; // 仅获取有权限的对象
|
|
37
|
+
const apiUrl = `/rest/metadata/v2.0/xobjects/filter?custom=${custom}&active=${active}`;
|
|
38
|
+
try {
|
|
39
|
+
const config = {
|
|
40
|
+
...curOptions,
|
|
41
|
+
url: apiUrl,
|
|
42
|
+
method: 'GET',
|
|
43
|
+
headers: {
|
|
44
|
+
'Content-Type': 'application/json',
|
|
45
|
+
...curOptions.headers,
|
|
46
|
+
},
|
|
47
|
+
timeout: curOptions.timeout || 10000,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const response = await axiosFetcher(config);
|
|
51
|
+
return response?.data;
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error('获取对象列表失败:', error);
|
|
54
|
+
message.error('获取对象列表失败。');
|
|
55
|
+
return {};
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// 创建业务数据
|
|
60
|
+
export const createXObject = async (
|
|
61
|
+
xObjectApiKey: string,
|
|
62
|
+
options: any
|
|
63
|
+
) => {
|
|
64
|
+
const curOptions = options || {};
|
|
65
|
+
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}`;
|
|
66
|
+
const formData = curOptions.data || {};
|
|
67
|
+
try {
|
|
68
|
+
const config = {
|
|
69
|
+
...options,
|
|
70
|
+
url: apiUrl,
|
|
71
|
+
method: curOptions.method || 'GET',
|
|
72
|
+
data: {
|
|
73
|
+
data: formData,
|
|
74
|
+
},
|
|
75
|
+
headers: {
|
|
76
|
+
'Content-Type': 'application/json',
|
|
77
|
+
...curOptions.headers,
|
|
78
|
+
},
|
|
79
|
+
timeout: curOptions.timeout || 10000,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const response = await axiosFetcher(config);
|
|
83
|
+
return response?.data;
|
|
84
|
+
} catch (error) {
|
|
85
|
+
console.error('创建业务数据失败:', error);
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// 获取业务对象描述
|
|
91
|
+
export const getXObjectDesc = async (
|
|
92
|
+
xObjectApiKey: string,
|
|
93
|
+
options?: any,
|
|
94
|
+
) => {
|
|
95
|
+
const curOptions = options || {};
|
|
96
|
+
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/description`;
|
|
97
|
+
try {
|
|
98
|
+
const config = {
|
|
99
|
+
...options,
|
|
100
|
+
url: apiUrl,
|
|
101
|
+
method: curOptions.method || 'GET',
|
|
102
|
+
headers: {
|
|
103
|
+
'Content-Type': 'application/json',
|
|
104
|
+
...curOptions.headers,
|
|
105
|
+
},
|
|
106
|
+
timeout: curOptions.timeout || 10000,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const response = await axiosFetcher(config);
|
|
110
|
+
return response?.data;
|
|
111
|
+
} catch (error) {
|
|
112
|
+
console.error('获取业务对象描述:', error);
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// 更新业务数据
|
|
118
|
+
export const updateXObject = async (
|
|
119
|
+
xObjectApiKey: string,
|
|
120
|
+
objectId: string,
|
|
121
|
+
options: any
|
|
122
|
+
) => {
|
|
123
|
+
const curOptions = options || {};
|
|
124
|
+
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
|
|
125
|
+
const formData = curOptions.data || {};
|
|
126
|
+
try {
|
|
127
|
+
const config = {
|
|
128
|
+
...curOptions,
|
|
129
|
+
url: apiUrl,
|
|
130
|
+
method: curOptions.method || 'PATCH',
|
|
131
|
+
data: {
|
|
132
|
+
data: formData,
|
|
133
|
+
},
|
|
134
|
+
headers: {
|
|
135
|
+
'Content-Type': 'application/json',
|
|
136
|
+
...curOptions.headers,
|
|
137
|
+
},
|
|
138
|
+
timeout: curOptions.timeout || 10000,
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const response = await axiosFetcher(config);
|
|
142
|
+
return response?.data;
|
|
143
|
+
} catch (error) {
|
|
144
|
+
console.error('更新业务数据失败:', error);
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// 获取业务数据信息
|
|
150
|
+
export const getXObject = async (
|
|
151
|
+
xObjectApiKey: string,
|
|
152
|
+
objectId: string,
|
|
153
|
+
options?: any
|
|
154
|
+
) => {
|
|
155
|
+
const curOptions = options || {};
|
|
156
|
+
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
|
|
157
|
+
try {
|
|
158
|
+
const config = {
|
|
159
|
+
...curOptions,
|
|
160
|
+
url: apiUrl,
|
|
161
|
+
method: curOptions.method || 'GET',
|
|
162
|
+
headers: {
|
|
163
|
+
'Content-Type': 'application/json',
|
|
164
|
+
...curOptions.headers,
|
|
165
|
+
},
|
|
166
|
+
timeout: curOptions.timeout || 10000,
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const response = await axiosFetcher(config);
|
|
170
|
+
return response?.data;
|
|
171
|
+
} catch (error) {
|
|
172
|
+
console.error('获取业务数据信息失败:', error);
|
|
173
|
+
throw error;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// 删除业务数据
|
|
178
|
+
export const deleteXObject = async (
|
|
179
|
+
xObjectApiKey: string,
|
|
180
|
+
objectId: string,
|
|
181
|
+
options?: any
|
|
182
|
+
) => {
|
|
183
|
+
const curOptions = options || {};
|
|
184
|
+
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
|
|
185
|
+
try {
|
|
186
|
+
const config = {
|
|
187
|
+
...curOptions,
|
|
188
|
+
url: apiUrl,
|
|
189
|
+
method: curOptions.method || 'DELETE',
|
|
190
|
+
headers: {
|
|
191
|
+
'Content-Type': 'application/json',
|
|
192
|
+
...curOptions.headers,
|
|
193
|
+
},
|
|
194
|
+
timeout: curOptions.timeout || 10000,
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const response = await axiosFetcher(config);
|
|
198
|
+
return response?.data;
|
|
199
|
+
} catch (error) {
|
|
200
|
+
console.error('删除业务数据:', error);
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
203
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"experimentalDecorators": true,
|
|
4
|
+
/* Basic Options */
|
|
5
|
+
"target": "esnext",
|
|
6
|
+
/* 指定编译之后的版本: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
|
|
7
|
+
"module": "esnext" /* 指定要使用的模板标准: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
|
|
8
|
+
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
9
|
+
"allowJs": false /* 指定是否允许编译JS文件,默认false,即不编译JS文件. */,
|
|
10
|
+
// "checkJs": true, /* 指定是否检查和报告JS文件中的错误,默认false */
|
|
11
|
+
"jsx": "react" /* 指定jsx代码用于的开发环境:'preserve','react-native', or 'react'. */,
|
|
12
|
+
"declaration": false /* 指定是否在编译的时候生成相的d.ts声明文件 */,
|
|
13
|
+
// "declarationMap": true, /* 指定编译时是否生成.map文件 */
|
|
14
|
+
// "sourceMap": true, /* 指定编译时是否生成.map文件 */
|
|
15
|
+
// "outFile": "./", /* 指定输出文件合并为一个文件 */
|
|
16
|
+
// "outDir": "dist", /* 指定输出文件夹,值为一个文件夹路径字符串,输出的文件都将放置在这个文件夹*/
|
|
17
|
+
// "rootDir": "src", /* 指定编译文件的根目录,编译器会在根目录查找入口文件 */
|
|
18
|
+
// "composite": true, /* 是否编译构建引用项目 */
|
|
19
|
+
// "removeComments": true, /* 指定是否将编译后的文件注释删掉,设为true的话即删除注释,默认为false */
|
|
20
|
+
"noEmit": false /* 不生成编译文件 */,
|
|
21
|
+
"importHelpers": true /* 指定是否引入tslib里的复制工具函数,默认为false */,
|
|
22
|
+
// "downlevelIteration": true, /* 当target为"ES5"或"ES3"时,为"for-of" "spread"和"destructuring"中的迭代器提供完全支持 */
|
|
23
|
+
"isolatedModules": false /* 指定是否将每个文件作为单独的模块,默认为true */,
|
|
24
|
+
|
|
25
|
+
/* Strict Type-Checking Options */
|
|
26
|
+
"strict": false /* 指定是否启动所有类型检查 */,
|
|
27
|
+
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
|
|
28
|
+
"strictNullChecks": true /* Enable strict null checks. */,
|
|
29
|
+
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
30
|
+
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
31
|
+
"noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
|
|
32
|
+
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
33
|
+
|
|
34
|
+
/* Additional Checks */
|
|
35
|
+
"noUnusedLocals": false /* Report errors on unused locals. */,
|
|
36
|
+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
37
|
+
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
|
|
38
|
+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
39
|
+
|
|
40
|
+
/* Module Resolution Options */
|
|
41
|
+
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
|
|
42
|
+
"baseUrl": "./" /* Base directory to resolve non-absolute module names. */,
|
|
43
|
+
"paths": {
|
|
44
|
+
"@": ["./src"]
|
|
45
|
+
} /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
|
|
46
|
+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
47
|
+
/* 指定声明文件或文件夹的路径列表,如果指定了此项,则只有在这里列出的声明文件才会被加载 */
|
|
48
|
+
"typeRoots": ["./@types", "./node_modules/@types"],
|
|
49
|
+
// "types": [], /* 指定需要包含的模块,只有在这里列出的模块的声明文件才会被加载 */
|
|
50
|
+
"allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
|
|
51
|
+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
|
52
|
+
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
53
|
+
|
|
54
|
+
/* Source Map Options */
|
|
55
|
+
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
56
|
+
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
57
|
+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
58
|
+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
59
|
+
|
|
60
|
+
/* Experimental Options */
|
|
61
|
+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
62
|
+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
63
|
+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
|
64
|
+
// "suppressImplicitAnyIndexErrors": true /* Suppress --noImplicitAny errors for indexing objects lacking index signatures. See issue #1232 for more details. */
|
|
65
|
+
},
|
|
66
|
+
"include": ["src", "test"],
|
|
67
|
+
"exclude": ["node_modules"]
|
|
68
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "echarts-custom-cmp-template",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.19",
|
|
4
4
|
"description": "neo自定义组件模板(react&ts技术栈)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"自定义组件模板",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@commitlint/config-conventional": "^9.1.1",
|
|
48
48
|
"@types/react": "^16.9.11",
|
|
49
49
|
"@types/react-dom": "^16.9.15",
|
|
50
|
-
"neo-cmp-cli": "^1.2.
|
|
50
|
+
"neo-cmp-cli": "^1.2.3",
|
|
51
51
|
"husky": "^4.2.5",
|
|
52
52
|
"lint-staged": "^10.2.9",
|
|
53
53
|
"prettier": "^2.0.5",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1757492173072" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2395" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M929.295093 873.474968 119.673029 873.474968 63.904067 873.474968 63.904067 817.603677l0-586.341561c0-15.451584 12.484061-27.935645 27.935645-27.935645 15.451584 0 27.935645 12.484061 27.935645 27.935645l0 586.341561 809.622065 0c15.451584 0 27.935645 12.484061 27.935645 27.935645C957.230738 860.990906 944.746677 873.474968 929.295093 873.474968L929.295093 873.474968zM845.590487 761.732387l-55.87129 0c-30.800839 0-55.87129-24.968122-55.87129-55.87129L733.847906 370.940342c0-30.800839 24.968122-55.87129 55.87129-55.87129l55.87129 0c30.800839 0 55.87129 24.968122 55.87129 55.87129l0 335.023084C901.461777 736.764265 876.391326 761.732387 845.590487 761.732387L845.590487 761.732387zM566.438693 761.732387l-55.87129 0c-30.800839 0-55.87129-24.968122-55.87129-55.87129L454.696113 203.4288c0-30.800839 24.968122-55.87129 55.87129-55.87129l55.87129 0c30.800839 0 55.87129 24.968122 55.87129 55.87129l0 502.534626C622.207655 736.764265 597.239532 761.732387 566.438693 761.732387L566.438693 761.732387zM287.184571 761.732387l-55.87129 0c-30.800839 0-55.87129-24.968122-55.87129-55.87129L175.441991 482.580594c0-30.800839 24.968122-55.87129 55.87129-55.87129l55.87129 0c30.800839 0 55.87129 24.968122 55.87129 55.87129l0 223.382832C343.055861 736.764265 318.087739 761.732387 287.184571 761.732387L287.184571 761.732387z" p-id="2396" fill="#0764f5"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1756957113315" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5395" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M288 768v115.2c0 25.6 19.2 44.8 44.8 44.8h556.8c25.6 0 44.8-19.2 44.8-44.8v-198.4s0-6.4-6.4-6.4h-83.2c-38.4 0-70.4-32-70.4-70.4 0-38.4 32-70.4 70.4-70.4h83.2s6.4 0 6.4-6.4V332.8c0-25.6-19.2-44.8-44.8-44.8H768C768 198.4 697.6 128 608 128S448 198.4 448 288H332.8c-25.6 0-44.8 19.2-44.8 44.8V448C198.4 448 128 518.4 128 608S198.4 768 288 768z m0-249.6h70.4V358.4h160V288c0-51.2 38.4-89.6 89.6-89.6 51.2 0 89.6 38.4 89.6 89.6v70.4h160v108.8h-19.2c-76.8 0-140.8 64-140.8 140.8 0 76.8 64 140.8 140.8 140.8h19.2v108.8H358.4v-160H288c-51.2 0-89.6-38.4-89.6-89.6 0-51.2 38.4-89.6 89.6-89.6z" p-id="5396" fill="#0764f5"></path></svg>
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
- src: 自定义组件源码;
|
|
3
3
|
- src/assets: 存放组件静态资源,比如 css、img等;
|
|
4
4
|
- src/components: 存放自定义组件代码,每个自定义组件以自身名称(cmpType 数值)作为目录进行存放;
|
|
5
|
-
- src/components/
|
|
6
|
-
- src/components/
|
|
5
|
+
- src/components/contact-form/index.tsx: 自定义组件的内容文件;
|
|
6
|
+
- src/components/contact-form/model.ts: 自定义组件的模型文件,用于对接页面设计器;
|
|
7
7
|
- neo.config.js: neo-cmp-cli 配置文件。
|
|
8
8
|
|
|
9
9
|
### 组件开发规范
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
- 自定义组件中可用的配置项类型 请见 [当前可用表单项](https://github.com/wibetter/neo-register/blob/master/docs/FormItemType.md);
|
|
13
13
|
- 自定义组件最外层请设置一个唯一的 ClassName(比如 xx-cmpType-container),所有内容样式请放在该 ClassName 中,避免自定义组件样式相互干扰;
|
|
14
14
|
- 默认开启代码规范检测(含样式内容),如需关闭,请调整 neo.config.js 相关配置;
|
|
15
|
-
- 请使用 react 16
|
|
15
|
+
- 请使用 react 16版本;
|
|
16
|
+
- 支持在自定义组件中使用 Open API,详细见[使用说明](./docs/README.md)。
|
|
16
17
|
|
|
17
18
|
### 自定义组件注册器使用说明
|
|
18
19
|
- [neo-register 使用说明](https://www.npmjs.com/package/neo-register?activeTab=readme)
|