neo-cmp-cli 1.7.15 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/neo/neoLogin.js +6 -6
- package/src/neo/neoService.js +131 -22
- package/src/template/antd-custom-cmp-template/package.json +2 -2
- package/src/template/antd-custom-cmp-template/src/components/dataDashboard/model.ts +15 -16
- package/src/template/antd-custom-cmp-template/src/components/infoCard/model.ts +15 -13
- package/src/template/develop/neo-custom-cmp-template/src/components/contactCardList/model.ts +1 -7
- package/src/template/develop/neo-custom-cmp-template/src/components/contactForm/model.ts +1 -1
- package/src/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/model.ts +1 -1
- package/src/template/echarts-custom-cmp-template/neo.config.js +1 -1
- package/src/template/echarts-custom-cmp-template/package.json +2 -2
- package/src/template/echarts-custom-cmp-template/src/components/chartWidget/model.ts +15 -17
- package/src/template/echarts-custom-cmp-template/src/components/mapWidget/model.ts +15 -13
- package/src/template/empty-cmp/model.ts +15 -13
- package/src/template/empty-custom-cmp-template/package.json +2 -2
- package/src/template/neo-custom-cmp-template/neo.config.js +4 -10
- package/src/template/neo-custom-cmp-template/package.json +5 -3
- package/src/template/neo-custom-cmp-template/src/components/entityCardList/model.ts +15 -14
- package/src/template/neo-custom-cmp-template/src/components/entityDetail/model.ts +15 -19
- package/src/template/neo-custom-cmp-template/src/components/entityForm/model.ts +15 -17
- package/src/template/neo-custom-cmp-template/src/components/entityTable/model.ts +15 -17
- package/src/template/neo-custom-cmp-template/tsconfig.json +42 -64
- package/src/template/react-custom-cmp-template/package.json +2 -2
- package/src/template/react-custom-cmp-template/src/components/infoCard/model.js +15 -13
- package/src/template/react-ts-custom-cmp-template/package.json +2 -2
- package/src/template/react-ts-custom-cmp-template/src/components/listWidget/model.ts +15 -13
- package/src/template/vue2-custom-cmp-template/package.json +2 -2
- package/src/template/vue2-custom-cmp-template/src/components/vueInfoCard/model.js +15 -13
- package/src/utils/cmpUtils/createCmpByZip.js +17 -6
- package/src/utils/cmpUtils/pullCmp.js +10 -9
- package/src/utils/cmpUtils/pushCmp.js +30 -11
- package/test/deprecate-versions.js +2 -2
package/package.json
CHANGED
package/src/neo/neoLogin.js
CHANGED
|
@@ -236,7 +236,7 @@ class NeoLoginService {
|
|
|
236
236
|
<title>授权失败</title>
|
|
237
237
|
<style>
|
|
238
238
|
.container {
|
|
239
|
-
margin:
|
|
239
|
+
margin: 0 auto;
|
|
240
240
|
padding-top: 30px;
|
|
241
241
|
text-align: center;
|
|
242
242
|
|
|
@@ -246,7 +246,7 @@ class NeoLoginService {
|
|
|
246
246
|
|
|
247
247
|
h1, p {
|
|
248
248
|
text-align: center;
|
|
249
|
-
margin-top:
|
|
249
|
+
margin-top: 30px;
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
</style>
|
|
@@ -273,7 +273,7 @@ class NeoLoginService {
|
|
|
273
273
|
<title>授权成功</title>
|
|
274
274
|
<style>
|
|
275
275
|
.container {
|
|
276
|
-
margin:
|
|
276
|
+
margin: 0 auto;
|
|
277
277
|
padding-top: 30px;
|
|
278
278
|
text-align: center;
|
|
279
279
|
|
|
@@ -283,7 +283,7 @@ class NeoLoginService {
|
|
|
283
283
|
|
|
284
284
|
h1, p {
|
|
285
285
|
text-align: center;
|
|
286
|
-
margin-top:
|
|
286
|
+
margin-top: 30px;
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
</style>
|
|
@@ -309,7 +309,7 @@ class NeoLoginService {
|
|
|
309
309
|
<title>授权失败</title>
|
|
310
310
|
<style>
|
|
311
311
|
.container {
|
|
312
|
-
margin:
|
|
312
|
+
margin: 0 auto;
|
|
313
313
|
padding-top: 30px;
|
|
314
314
|
text-align: center;
|
|
315
315
|
|
|
@@ -319,7 +319,7 @@ class NeoLoginService {
|
|
|
319
319
|
|
|
320
320
|
h1, p {
|
|
321
321
|
text-align: center;
|
|
322
|
-
margin-top:
|
|
322
|
+
margin-top: 30px;
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
</style>
|
package/src/neo/neoService.js
CHANGED
|
@@ -14,11 +14,14 @@ const NeoCrmAPI = {
|
|
|
14
14
|
neoBaseURL: 'https://crm.xiaoshouyi.com', // 平台根地址
|
|
15
15
|
loginAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/auth', // code 获取接口地址
|
|
16
16
|
tokenAPI: 'https://login.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址
|
|
17
|
-
uploadAPI: '/rest/metadata/v3.0/ui/customComponents/actions/upload', // 文件上传接口地址
|
|
18
17
|
delete: '/rest/metadata/v3.0/ui/customComponents',
|
|
19
|
-
|
|
20
|
-
queryAll: '/rest/metadata/v3.0/ui/
|
|
21
|
-
|
|
18
|
+
saveAPI: '/rest/metadata/v3.0/ui/customComponents/actions/saveOrUpdateComponent', // 创建或者保存接口地址
|
|
19
|
+
queryAll: '/rest/metadata/v3.0/ui/components/filter?custom=true', // 不带分页
|
|
20
|
+
getCodeLibAPI: (cmpType) => `/rest/metadata/v3.0/ui/customComponents/${cmpType}/codeLib`, // 组件源码下载
|
|
21
|
+
|
|
22
|
+
uploadAPI: '/rest/metadata/v3.0/ui/customComponents/actions/upload', // 文件上传接口地址(已废弃)
|
|
23
|
+
query: '/rest/metadata/v3.0/ui/customComponents/actions/queryCustomComponents' // 带分页(暂未使用)
|
|
24
|
+
// queryAll_v1: '/rest/metadata/v3.0/ui/customComponents/actions/queryAllCustomComponents', // 不带分页(已废弃)
|
|
22
25
|
};
|
|
23
26
|
|
|
24
27
|
const cmpFields = [
|
|
@@ -28,15 +31,15 @@ const cmpFields = [
|
|
|
28
31
|
'description',
|
|
29
32
|
'framework',
|
|
30
33
|
'icon',
|
|
34
|
+
'iconUrl',
|
|
31
35
|
'orderNo',
|
|
32
36
|
'version',
|
|
33
37
|
'propsSchema',
|
|
34
38
|
'defaultProps',
|
|
35
39
|
'previewProps',
|
|
36
40
|
'events',
|
|
37
|
-
'
|
|
41
|
+
'functions',
|
|
38
42
|
'asset',
|
|
39
|
-
'plugin',
|
|
40
43
|
'modelAsset',
|
|
41
44
|
'cssAsset',
|
|
42
45
|
'codeLib'
|
|
@@ -294,7 +297,8 @@ class NeoService {
|
|
|
294
297
|
}
|
|
295
298
|
|
|
296
299
|
/**
|
|
297
|
-
* 上传文件到 Neo
|
|
300
|
+
* 上传文件到 Neo 平台(已废弃)
|
|
301
|
+
* 备注:已废弃,改为 保存时直接上传组件资源文件
|
|
298
302
|
* @param {string} filePath 文件路径
|
|
299
303
|
* @param {object} options 可选配置
|
|
300
304
|
* @param {string} options.fieldName 表单字段名,默认为 'customComponentCode'
|
|
@@ -323,7 +327,7 @@ class NeoService {
|
|
|
323
327
|
}
|
|
324
328
|
|
|
325
329
|
// 检查文件大小
|
|
326
|
-
const maxSize = options.maxSize ||
|
|
330
|
+
const maxSize = options.maxSize || 5 * 1024 * 1024; // 默认 5MB
|
|
327
331
|
if (fileStat.size > maxSize) {
|
|
328
332
|
const sizeMB = (fileStat.size / 1024 / 1024).toFixed(2);
|
|
329
333
|
const maxSizeMB = (maxSize / 1024 / 1024).toFixed(2);
|
|
@@ -454,7 +458,8 @@ class NeoService {
|
|
|
454
458
|
}
|
|
455
459
|
|
|
456
460
|
/**
|
|
457
|
-
* 将构建产物上传到 NeoCRM
|
|
461
|
+
* 将构建产物上传到 NeoCRM 平台端(已废弃)
|
|
462
|
+
* 备注:已废弃,改为 保存时直接上传组件资源文件
|
|
458
463
|
*
|
|
459
464
|
* @param {object} cmpType 自定义组件名称
|
|
460
465
|
* @param {array} fileExtensions 需要上传的文件类型,默认 ['.js', '.css', '.zip']
|
|
@@ -521,6 +526,74 @@ class NeoService {
|
|
|
521
526
|
return curCmpInfo;
|
|
522
527
|
}
|
|
523
528
|
|
|
529
|
+
/**
|
|
530
|
+
* 处理组件构建产物
|
|
531
|
+
*
|
|
532
|
+
* @param {object} cmpType 自定义组件名称
|
|
533
|
+
* @param {array} fileExtensions 需要处理的文件类型,默认 ['.js', '.css', '.zip']
|
|
534
|
+
*/
|
|
535
|
+
async getCmpAssets(cmpType, fileExtensions = ['.js', '.css', '.zip']) {
|
|
536
|
+
if (!cmpType) {
|
|
537
|
+
errorLog(`自定义组件名称不能为空: ${cmpType}`);
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
if (!fs.existsSync(this.assetsRoot)) {
|
|
541
|
+
errorLog(`未找到自定义组件资源目录: ${this.assetsRoot}`);
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// 当前组件信息
|
|
546
|
+
const curCmpInfo = {
|
|
547
|
+
cmpType
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
const files = fs.readdirSync(this.assetsRoot); // 读取构建目录下的所有文件
|
|
551
|
+
|
|
552
|
+
// 处理构建产物目录下所有指定类型的文件
|
|
553
|
+
files.forEach((file) => {
|
|
554
|
+
const filePath = path.join(this.assetsRoot, file);
|
|
555
|
+
// 获取文件状态
|
|
556
|
+
const fileStat = fs.statSync(filePath);
|
|
557
|
+
// 检查文件扩展名
|
|
558
|
+
// const fileExt = path.extname(file);
|
|
559
|
+
const fileInfo = path.parse(filePath);
|
|
560
|
+
if (fileStat.isFile() && fileExtensions.includes(fileInfo.ext)) {
|
|
561
|
+
let widgetName = _.camelCase(cmpType);
|
|
562
|
+
|
|
563
|
+
if (file.indexOf(widgetName) < 0) {
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// 检查文件大小
|
|
568
|
+
const maxSize = 5 * 1024 * 1024; // 默认 5MB
|
|
569
|
+
if (fileStat.size > maxSize) {
|
|
570
|
+
const sizeMB = (fileStat.size / 1024 / 1024).toFixed(2);
|
|
571
|
+
const maxSizeMB = (maxSize / 1024 / 1024).toFixed(2);
|
|
572
|
+
throw new Error(`${file} 文件大小超过限制: ${sizeMB}MB > ${maxSizeMB}MB`);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
const fileContent = fs.createReadStream(filePath);
|
|
576
|
+
const fileInfo = {
|
|
577
|
+
fileContent,
|
|
578
|
+
fileName: file,
|
|
579
|
+
fileSize: fileStat.size,
|
|
580
|
+
};
|
|
581
|
+
if (file.indexOf('Model') > -1) {
|
|
582
|
+
// 使用文件流而不是读取整个文件到内存(对大文件更友好)
|
|
583
|
+
curCmpInfo.modelAssetFile = fileInfo;
|
|
584
|
+
} else if (file.endsWith('.css')) {
|
|
585
|
+
curCmpInfo.cssAssetFile = fileInfo;
|
|
586
|
+
} else if (file.endsWith('.zip')) {
|
|
587
|
+
curCmpInfo.codeLibFile = fileInfo;
|
|
588
|
+
} else {
|
|
589
|
+
curCmpInfo.assetFile = fileInfo;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
return curCmpInfo;
|
|
595
|
+
}
|
|
596
|
+
|
|
524
597
|
/**
|
|
525
598
|
* 更新自定义组件
|
|
526
599
|
* @param {object} componentData 组件数据
|
|
@@ -534,31 +607,56 @@ class NeoService {
|
|
|
534
607
|
throw new Error('componentData 不能为空');
|
|
535
608
|
}
|
|
536
609
|
|
|
537
|
-
const spinner = ora('
|
|
610
|
+
const spinner = ora('正在保存自定义组件信息...').start();
|
|
538
611
|
|
|
539
612
|
try {
|
|
540
613
|
const fullUpdateAPI = this.saveAPI();
|
|
541
|
-
|
|
614
|
+
|
|
615
|
+
// 创建 FormData
|
|
616
|
+
const formData = new FormData();
|
|
617
|
+
// 处理 componentData 中的 fileInfo 文件
|
|
618
|
+
if (componentData.assetFile) {
|
|
619
|
+
formData.append('assetFile', componentData.assetFile.fileContent, componentData.assetFile.fileName);
|
|
620
|
+
}
|
|
621
|
+
if (componentData.modelAssetFile) {
|
|
622
|
+
formData.append('modelAssetFile', componentData.modelAssetFile.fileContent, componentData.modelAssetFile.fileName);
|
|
623
|
+
}
|
|
624
|
+
if (componentData.cssAssetFile) {
|
|
625
|
+
formData.append('cssAssetFile', componentData.cssAssetFile.fileContent, componentData.cssAssetFile.fileName);
|
|
626
|
+
}
|
|
627
|
+
if (componentData.codeLibFile) {
|
|
628
|
+
formData.append('codeLibFile', componentData.codeLibFile.fileContent, componentData.codeLibFile.fileName);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
// 将 componentData 中组件基本信息
|
|
632
|
+
formData.append('component', JSON.stringify(_.omit(componentData, ['assetFile', 'modelAssetFile', 'cssAssetFile', 'codeLibFile'])));
|
|
633
|
+
|
|
634
|
+
const response = await axios.post(fullUpdateAPI, formData, {
|
|
542
635
|
headers: {
|
|
543
636
|
Authorization: `Bearer ${token}`,
|
|
544
637
|
'xsy-inner-source': 'bff',
|
|
545
|
-
|
|
546
|
-
|
|
638
|
+
// 无需手动设置 Content-Type,formData.getHeaders() 会自动设置正确的 multipart/form-data 和 boundary
|
|
639
|
+
...formData.getHeaders()
|
|
640
|
+
},
|
|
641
|
+
timeout: 120000, // 默认 60 秒
|
|
642
|
+
// 确保 axios 正确处理大文件和流
|
|
643
|
+
maxContentLength: Infinity, // 不限制响应内容长度
|
|
644
|
+
maxBodyLength: Infinity // 不限制请求体长度(适用于文件上传)
|
|
547
645
|
});
|
|
548
646
|
const { code, message } = response.data || {};
|
|
549
647
|
|
|
550
648
|
if (code && code !== 200) {
|
|
551
|
-
|
|
649
|
+
errorLog(`保存自定义组件信息失败: ${response.data.message || '未知错误'}`);
|
|
650
|
+
process.exit(1);
|
|
552
651
|
}
|
|
553
652
|
|
|
554
653
|
spinner.clear();
|
|
555
654
|
spinner.stop();
|
|
556
655
|
} catch (error) {
|
|
557
|
-
errorLog('更新组件失败。', spinner);
|
|
558
656
|
if (error.message) {
|
|
559
|
-
errorLog(
|
|
657
|
+
errorLog(`保存自定义组件信息失败: ${error.message}`, spinner);
|
|
560
658
|
} else {
|
|
561
|
-
errorLog(
|
|
659
|
+
errorLog(`保存自定义组件信息失败: ${JSON.stringify(error)}`, spinner);
|
|
562
660
|
}
|
|
563
661
|
process.exit(1);
|
|
564
662
|
}
|
|
@@ -581,12 +679,9 @@ class NeoService {
|
|
|
581
679
|
|
|
582
680
|
try {
|
|
583
681
|
let queryAllAPI = this.buildFullUrl(NeoCrmAPI.queryAll);
|
|
584
|
-
queryAllAPI +=
|
|
585
|
-
const response = await axios.
|
|
682
|
+
queryAllAPI += `&fields=${cmpFields.join(',')}`;
|
|
683
|
+
const response = await axios.get(
|
|
586
684
|
queryAllAPI,
|
|
587
|
-
{
|
|
588
|
-
data: {}
|
|
589
|
-
},
|
|
590
685
|
{
|
|
591
686
|
headers: {
|
|
592
687
|
Authorization: `Bearer ${token}`,
|
|
@@ -615,6 +710,20 @@ class NeoService {
|
|
|
615
710
|
return this.cmpList || [];
|
|
616
711
|
}
|
|
617
712
|
|
|
713
|
+
/**
|
|
714
|
+
* 获取自定义组件源码文件地址
|
|
715
|
+
* @param {string} cmpType 自定义组件名称
|
|
716
|
+
* @returns {string} 源码文件地址
|
|
717
|
+
*/
|
|
718
|
+
getCodeLibByCmpType(cmpType) {
|
|
719
|
+
if (!cmpType) {
|
|
720
|
+
return null;
|
|
721
|
+
};
|
|
722
|
+
return this.buildFullUrl(NeoCrmAPI.getCodeLibAPI(cmpType));
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
|
|
618
727
|
/**
|
|
619
728
|
* 删除自定义组件
|
|
620
729
|
* @param {*} cmpType 自定义组件类型
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"url": "https://github.com/wibetter/antd-custom-cmp-template/issues"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"neo-register": "^1.0.
|
|
41
|
+
"neo-register": "^1.0.7",
|
|
42
42
|
"antd": "4.9.4",
|
|
43
43
|
"react": "^16.9.0",
|
|
44
44
|
"react-dom": "^16.9.0"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@commitlint/config-conventional": "^9.1.1",
|
|
49
49
|
"@types/react": "^16.9.11",
|
|
50
50
|
"@types/react-dom": "^16.9.15",
|
|
51
|
-
"neo-cmp-cli": "^1.
|
|
51
|
+
"neo-cmp-cli": "^1.8.0",
|
|
52
52
|
"husky": "^4.2.5",
|
|
53
53
|
"lint-staged": "^10.2.9",
|
|
54
54
|
"prettier": "^2.0.5"
|
|
@@ -15,7 +15,21 @@ export class DataDashboardModel {
|
|
|
15
15
|
description: string = '酷炫的数据展示仪表板,支持动态数据更新和动画效果';
|
|
16
16
|
|
|
17
17
|
// 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
|
|
18
|
-
tags: string[] = ['仪表板'];
|
|
18
|
+
// tags: string[] = ['仪表板'];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 用于设置组件支持的页面类型
|
|
22
|
+
*
|
|
23
|
+
* 当前 NeoCRM 平台存在的页面类型:
|
|
24
|
+
* all: 1 全页面
|
|
25
|
+
* indexPage: 2 首页
|
|
26
|
+
* entityListPage: 3 实体列表页
|
|
27
|
+
* entityFormPage: 4 实体表单页
|
|
28
|
+
* entityDetailPage: 5 实体详情页
|
|
29
|
+
* customPage: 6 自定义页面
|
|
30
|
+
* bizPage: 7 业务页面
|
|
31
|
+
*/
|
|
32
|
+
// targetPage: string[] = ['customPage'];
|
|
19
33
|
|
|
20
34
|
// 组件图标,用于设置在编辑器左侧组件面板中展示的图标
|
|
21
35
|
iconSrc: string = 'https://neo-widgets.bj.bcebos.com/custom-widget.svg';
|
|
@@ -28,14 +42,6 @@ export class DataDashboardModel {
|
|
|
28
42
|
label: '数据仪表板',
|
|
29
43
|
};
|
|
30
44
|
|
|
31
|
-
// 设计器端预览时展示的默认数据
|
|
32
|
-
previewComProps = {
|
|
33
|
-
label: '数据仪表板',
|
|
34
|
-
title: '数据仪表板预览',
|
|
35
|
-
theme: 'light',
|
|
36
|
-
showAnimations: false,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
45
|
/**
|
|
40
46
|
* 组件面板配置,用于生成编辑器右侧属性配置面板内容
|
|
41
47
|
*/
|
|
@@ -64,13 +70,6 @@ export class DataDashboardModel {
|
|
|
64
70
|
value: true,
|
|
65
71
|
},
|
|
66
72
|
];
|
|
67
|
-
|
|
68
|
-
// 支持 函数式写法:propsSchemaCreator,com 为组件实例。优先级比 propsSchema 高
|
|
69
|
-
/*
|
|
70
|
-
propsSchemaCreator = (com: any) => {
|
|
71
|
-
return [];
|
|
72
|
-
};
|
|
73
|
-
*/
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
export default DataDashboardModel;
|
|
@@ -15,7 +15,21 @@ export class InfoCardModel {
|
|
|
15
15
|
description: string = '信息展示卡片';
|
|
16
16
|
|
|
17
17
|
// 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
|
|
18
|
-
tags: string[] = ['自定义组件'];
|
|
18
|
+
// tags: string[] = ['自定义组件'];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 用于设置组件支持的页面类型
|
|
22
|
+
*
|
|
23
|
+
* 当前 NeoCRM 平台存在的页面类型:
|
|
24
|
+
* all: 1 全页面
|
|
25
|
+
* indexPage: 2 首页
|
|
26
|
+
* entityListPage: 3 实体列表页
|
|
27
|
+
* entityFormPage: 4 实体表单页
|
|
28
|
+
* entityDetailPage: 5 实体详情页
|
|
29
|
+
* customPage: 6 自定义页面
|
|
30
|
+
* bizPage: 7 业务页面
|
|
31
|
+
*/
|
|
32
|
+
// targetPage: string[] = ['customPage'];
|
|
19
33
|
|
|
20
34
|
// 组件图标,用于设置在编辑器左侧组件面板中展示的图标
|
|
21
35
|
iconSrc: string = 'https://neo-widgets.bj.bcebos.com/custom-widget.svg';
|
|
@@ -31,11 +45,6 @@ export class InfoCardModel {
|
|
|
31
45
|
commentCount: 2025,
|
|
32
46
|
};
|
|
33
47
|
|
|
34
|
-
// 设计器端预览时展示的默认数据
|
|
35
|
-
previewComProps = {
|
|
36
|
-
label: '信息卡片',
|
|
37
|
-
};
|
|
38
|
-
|
|
39
48
|
/**
|
|
40
49
|
* 组件面板配置,用于生成编辑器右侧属性配置面板内容
|
|
41
50
|
*/
|
|
@@ -66,13 +75,6 @@ export class InfoCardModel {
|
|
|
66
75
|
value: 2025,
|
|
67
76
|
},
|
|
68
77
|
];
|
|
69
|
-
|
|
70
|
-
// 支持 函数式写法:propsSchemaCreator,com 为组件实例。优先级比 propsSchema 高
|
|
71
|
-
/*
|
|
72
|
-
propsSchemaCreator = (com: any) => {
|
|
73
|
-
return [];
|
|
74
|
-
};
|
|
75
|
-
*/
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
export default InfoCardModel;
|
package/src/template/develop/neo-custom-cmp-template/src/components/contactCardList/model.ts
CHANGED
|
@@ -15,7 +15,7 @@ export class ContactCardListModel {
|
|
|
15
15
|
description: string = '展示联系人信息的卡片列表组件,支持姓名和手机号展示';
|
|
16
16
|
|
|
17
17
|
// 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
|
|
18
|
-
tags: string[] = ['自定义组件'];
|
|
18
|
+
// tags: string[] = ['自定义组件'];
|
|
19
19
|
|
|
20
20
|
// 组件图标,用于设置在编辑器左侧组件面板中展示的图标
|
|
21
21
|
iconSrc: string = 'https://custom-widgets.bj.bcebos.com/card-list.svg';
|
|
@@ -26,12 +26,6 @@ export class ContactCardListModel {
|
|
|
26
26
|
label: '联系人卡片列表',
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
// 设计器端预览时展示的默认数据
|
|
30
|
-
previewComProps = {
|
|
31
|
-
label: '联系人卡片列表',
|
|
32
|
-
title: '联系人卡片列表',
|
|
33
|
-
};
|
|
34
|
-
|
|
35
29
|
/**
|
|
36
30
|
* 组件面板配置,用于生成编辑器右侧属性配置面板内容
|
|
37
31
|
*/
|
|
@@ -16,7 +16,7 @@ export class ContactFormModel {
|
|
|
16
16
|
'基于 Ant Design 的联系人表单组件,支持姓名、所有人、业务类型、所属部门、手机号等字段';
|
|
17
17
|
|
|
18
18
|
// 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
|
|
19
|
-
tags: string[] = ['自定义组件'];
|
|
19
|
+
// tags: string[] = ['自定义组件'];
|
|
20
20
|
|
|
21
21
|
// 组件图标,用于设置在编辑器左侧组件面板中展示的图标
|
|
22
22
|
iconSrc: string = 'https://custom-widgets.bj.bcebos.com/contact-form.svg';
|
|
@@ -15,7 +15,7 @@ export class NeoEntityGridModel {
|
|
|
15
15
|
description: string = 'Neo 实体表格组件';
|
|
16
16
|
|
|
17
17
|
// 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
|
|
18
|
-
tags: string[] = ['自定义组件'];
|
|
18
|
+
// tags: string[] = ['自定义组件'];
|
|
19
19
|
|
|
20
20
|
// 组件图标,用于设置在编辑器左侧组件面板中展示的图标
|
|
21
21
|
iconSrc: string = 'https://custom-widgets.bj.bcebos.com/table.svg';
|
|
@@ -44,7 +44,7 @@ module.exports = {
|
|
|
44
44
|
// exports: ['xxModule'], // 数组写法,用于导出当前自定义组件中的第三方依赖模块
|
|
45
45
|
exports: {
|
|
46
46
|
// 对象写法,可用于导出自定义组件中的某个内容模块(需要使用绝对路径导出)
|
|
47
|
-
chartWidget: path.resolve('./src/components/chartWidget'), //
|
|
47
|
+
// chartWidget: path.resolve('./src/components/chartWidget'), // 导出图表自定义组件(默认会导致当前自定义组件)
|
|
48
48
|
'neo-register': 'neo-register', // 导出 Neo 注册模块
|
|
49
49
|
},
|
|
50
50
|
// remoteDeps: ['xxCmpType'], // 远程依赖组件,表示当前自定义组件会用到的依赖组件,需要和 externals 配合使用
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"url": "https://github.com/wibetter/echarts-custom-cmp-template/issues"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"neo-register": "^1.0.
|
|
41
|
+
"neo-register": "^1.0.7",
|
|
42
42
|
"react": "^16.9.0",
|
|
43
43
|
"react-dom": "^16.9.0",
|
|
44
44
|
"echarts": "^5.5.1"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@commitlint/config-conventional": "^9.1.1",
|
|
49
49
|
"@types/react": "^16.9.11",
|
|
50
50
|
"@types/react-dom": "^16.9.15",
|
|
51
|
-
"neo-cmp-cli": "^1.
|
|
51
|
+
"neo-cmp-cli": "^1.8.0",
|
|
52
52
|
"husky": "^4.2.5",
|
|
53
53
|
"lint-staged": "^10.2.9",
|
|
54
54
|
"prettier": "^2.0.5",
|
|
@@ -16,7 +16,21 @@ export class ChartWidgetModel {
|
|
|
16
16
|
'支持多种图表类型切换的专业图表组件,支持丰富的配置选项';
|
|
17
17
|
|
|
18
18
|
// 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
|
|
19
|
-
tags: string[] = ['自定义组件'];
|
|
19
|
+
// tags: string[] = ['自定义组件'];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 用于设置组件支持的页面类型
|
|
23
|
+
*
|
|
24
|
+
* 当前 NeoCRM 平台存在的页面类型:
|
|
25
|
+
* all: 1 全页面
|
|
26
|
+
* indexPage: 2 首页
|
|
27
|
+
* entityListPage: 3 实体列表页
|
|
28
|
+
* entityFormPage: 4 实体表单页
|
|
29
|
+
* entityDetailPage: 5 实体详情页
|
|
30
|
+
* customPage: 6 自定义页面
|
|
31
|
+
* bizPage: 7 业务页面
|
|
32
|
+
*/
|
|
33
|
+
// targetPage: string[] = ['customPage'];
|
|
20
34
|
|
|
21
35
|
// 组件图标,用于设置在编辑器左侧组件面板中展示的图标
|
|
22
36
|
iconSrc: string = 'https://custom-widgets.bj.bcebos.com/chart.svg';
|
|
@@ -50,15 +64,6 @@ export class ChartWidgetModel {
|
|
|
50
64
|
},
|
|
51
65
|
};
|
|
52
66
|
|
|
53
|
-
// 设计器端预览时展示的默认数据
|
|
54
|
-
previewComProps = {
|
|
55
|
-
label: '酷炫图表组件',
|
|
56
|
-
chartType: 'bar',
|
|
57
|
-
title: '预览图表',
|
|
58
|
-
width: 400,
|
|
59
|
-
height: 300,
|
|
60
|
-
};
|
|
61
|
-
|
|
62
67
|
/**
|
|
63
68
|
* 组件面板配置,用于生成编辑器右侧属性配置面板内容
|
|
64
69
|
* 使用 JSON AMIS 表单配置
|
|
@@ -141,13 +146,6 @@ export class ChartWidgetModel {
|
|
|
141
146
|
value: true,
|
|
142
147
|
}
|
|
143
148
|
];
|
|
144
|
-
|
|
145
|
-
// 支持 函数式写法:propsSchemaCreator,com 为组件实例。优先级比 propsSchema 高
|
|
146
|
-
/*
|
|
147
|
-
propsSchemaCreator = (com: any) => {
|
|
148
|
-
return [];
|
|
149
|
-
};
|
|
150
|
-
*/
|
|
151
149
|
}
|
|
152
150
|
|
|
153
151
|
export default ChartWidgetModel;
|
|
@@ -15,7 +15,21 @@ export class MapWidgetModel {
|
|
|
15
15
|
description: string = '地图展示组件,支持传入经纬度或地址名称';
|
|
16
16
|
|
|
17
17
|
// 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
|
|
18
|
-
tags: string[] = ['自定义组件'];
|
|
18
|
+
// tags: string[] = ['自定义组件'];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 用于设置组件支持的页面类型
|
|
22
|
+
*
|
|
23
|
+
* 当前 NeoCRM 平台存在的页面类型:
|
|
24
|
+
* all: 1 全页面
|
|
25
|
+
* indexPage: 2 首页
|
|
26
|
+
* entityListPage: 3 实体列表页
|
|
27
|
+
* entityFormPage: 4 实体表单页
|
|
28
|
+
* entityDetailPage: 5 实体详情页
|
|
29
|
+
* customPage: 6 自定义页面
|
|
30
|
+
* bizPage: 7 业务页面
|
|
31
|
+
*/
|
|
32
|
+
// targetPage: string[] = ['customPage'];
|
|
19
33
|
|
|
20
34
|
// 组件图标,用于设置在编辑器左侧组件面板中展示的图标
|
|
21
35
|
iconSrc: string = 'https://custom-widgets.bj.bcebos.com/map.svg';
|
|
@@ -31,11 +45,6 @@ export class MapWidgetModel {
|
|
|
31
45
|
height: 400, // 地图高度
|
|
32
46
|
};
|
|
33
47
|
|
|
34
|
-
// 设计器端预览时展示的默认数据
|
|
35
|
-
previewComProps = {
|
|
36
|
-
label: '地图组件',
|
|
37
|
-
};
|
|
38
|
-
|
|
39
48
|
/**
|
|
40
49
|
* 组件面板配置,用于生成编辑器右侧属性配置面板内容
|
|
41
50
|
*/
|
|
@@ -93,13 +102,6 @@ export class MapWidgetModel {
|
|
|
93
102
|
description: '地图容器的高度(像素)',
|
|
94
103
|
},
|
|
95
104
|
];
|
|
96
|
-
|
|
97
|
-
// 支持 函数式写法:propsSchemaCreator,com 为组件实例。优先级比 propsSchema 高
|
|
98
|
-
/*
|
|
99
|
-
propsSchemaCreator = (com: any) => {
|
|
100
|
-
return [];
|
|
101
|
-
};
|
|
102
|
-
*/
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
export default MapWidgetModel;
|
|
@@ -15,7 +15,21 @@ export class CmpModel {
|
|
|
15
15
|
description: string = 'xx组件详细描述';
|
|
16
16
|
|
|
17
17
|
// 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
|
|
18
|
-
tags: string[] = ['自定义组件'];
|
|
18
|
+
// tags: string[] = ['自定义组件'];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 用于设置组件支持的页面类型
|
|
22
|
+
*
|
|
23
|
+
* 当前 NeoCRM 平台存在的页面类型:
|
|
24
|
+
* all: 1 全页面
|
|
25
|
+
* indexPage: 2 首页
|
|
26
|
+
* entityListPage: 3 实体列表页
|
|
27
|
+
* entityFormPage: 4 实体表单页
|
|
28
|
+
* entityDetailPage: 5 实体详情页
|
|
29
|
+
* customPage: 6 自定义页面
|
|
30
|
+
* bizPage: 7 业务页面
|
|
31
|
+
*/
|
|
32
|
+
// targetPage: string[] = ['customPage'];
|
|
19
33
|
|
|
20
34
|
// 组件图标,用于设置在编辑器左侧组件面板中展示的图标
|
|
21
35
|
iconSrc: string = 'https://neo-widgets.bj.bcebos.com/custom-widget.svg';
|
|
@@ -30,11 +44,6 @@ export class CmpModel {
|
|
|
30
44
|
commentCount: 2025,
|
|
31
45
|
};
|
|
32
46
|
|
|
33
|
-
// 设计器端预览时展示的默认数据
|
|
34
|
-
previewComProps = {
|
|
35
|
-
label: '信息卡片',
|
|
36
|
-
};
|
|
37
|
-
|
|
38
47
|
/**
|
|
39
48
|
* 组件面板配置,用于生成编辑器右侧属性配置面板内容
|
|
40
49
|
*/
|
|
@@ -65,13 +74,6 @@ export class CmpModel {
|
|
|
65
74
|
value: 2025,
|
|
66
75
|
},
|
|
67
76
|
];
|
|
68
|
-
|
|
69
|
-
// 支持 函数式写法:propsSchemaCreator,com 为组件实例。优先级比 propsSchema 高
|
|
70
|
-
/*
|
|
71
|
-
propsSchemaCreator = (com: any) => {
|
|
72
|
-
return [];
|
|
73
|
-
};
|
|
74
|
-
*/
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
export default CmpModel;
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"url": "https://github.com/wibetter/empty-custom-cmp-template/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"neo-register": "^1.0.
|
|
40
|
+
"neo-register": "^1.0.7",
|
|
41
41
|
"react": "^16.9.0",
|
|
42
42
|
"react-dom": "^16.9.0"
|
|
43
43
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@commitlint/config-conventional": "^9.1.1",
|
|
47
47
|
"@types/react": "^16.9.11",
|
|
48
48
|
"@types/react-dom": "^16.9.15",
|
|
49
|
-
"neo-cmp-cli": "^1.
|
|
49
|
+
"neo-cmp-cli": "^1.8.0",
|
|
50
50
|
"husky": "^4.2.5",
|
|
51
51
|
"lint-staged": "^10.2.9",
|
|
52
52
|
"prettier": "^2.0.5"
|