neo-cmp-cli 1.7.13 → 1.7.15-beta.1
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/neoService.js +75 -7
- package/src/template/antd-custom-cmp-template/package.json +1 -1
- package/src/template/antd-custom-cmp-template/src/components/dataDashboard/model.ts +15 -1
- package/src/template/antd-custom-cmp-template/src/components/infoCard/model.ts +15 -1
- package/src/template/develop/neo-custom-cmp-template/src/components/contactCardList/model.ts +1 -1
- 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/package.json +2 -2
- package/src/template/echarts-custom-cmp-template/src/components/chartWidget/model.ts +15 -1
- package/src/template/echarts-custom-cmp-template/src/components/mapWidget/model.ts +15 -1
- package/src/template/empty-cmp/model.ts +15 -1
- package/src/template/empty-custom-cmp-template/package.json +1 -1
- package/src/template/neo-custom-cmp-template/package.json +3 -3
- package/src/template/neo-custom-cmp-template/src/components/entityCardList/model.ts +15 -1
- package/src/template/neo-custom-cmp-template/src/components/entityDetail/model.ts +15 -1
- package/src/template/neo-custom-cmp-template/src/components/entityForm/model.ts +15 -1
- package/src/template/neo-custom-cmp-template/src/components/entityTable/model.ts +15 -1
- package/src/template/react-custom-cmp-template/package.json +1 -1
- package/src/template/react-custom-cmp-template/src/components/infoCard/model.js +15 -1
- package/src/template/react-ts-custom-cmp-template/package.json +1 -1
- package/src/template/react-ts-custom-cmp-template/src/components/listWidget/model.ts +15 -1
- package/src/template/vue2-custom-cmp-template/package.json +1 -1
- package/src/template/vue2-custom-cmp-template/src/components/vueInfoCard/model.js +15 -1
- package/src/utils/cmpUtils/pushCmp.js +22 -5
- package/src/utils/configureNeoBuild.js +1 -0
- package/src/utils/projectUtils/getEntriesWithAutoRegister.js +1 -1
- package/test/deprecate-versions.js +1 -1
package/package.json
CHANGED
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=false', // 不带分页
|
|
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 = [
|
|
@@ -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,69 @@ 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
|
+
if (file.indexOf('Model') > -1) {
|
|
577
|
+
// 使用文件流而不是读取整个文件到内存(对大文件更友好)
|
|
578
|
+
curCmpInfo.modelAssetFile = fileContent;
|
|
579
|
+
} else if (file.endsWith('.css')) {
|
|
580
|
+
curCmpInfo.cssAssetFile = fileContent;
|
|
581
|
+
} else if (file.endsWith('.zip')) {
|
|
582
|
+
curCmpInfo.codeLibFile = fileContent;
|
|
583
|
+
} else {
|
|
584
|
+
curCmpInfo.assetFile = fileContent;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
return curCmpInfo;
|
|
590
|
+
}
|
|
591
|
+
|
|
524
592
|
/**
|
|
525
593
|
* 更新自定义组件
|
|
526
594
|
* @param {object} componentData 组件数据
|
|
@@ -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';
|
|
@@ -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';
|
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';
|
|
@@ -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';
|
|
@@ -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.7.
|
|
51
|
+
"neo-cmp-cli": "^1.7.13",
|
|
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';
|
|
@@ -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';
|
|
@@ -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';
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"url": "https://github.com/wibetter/neo-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
|
"axios": "^0.27.2",
|
|
45
45
|
"antd": "^4.9.4",
|
|
46
46
|
"lodash": "^4.17.21",
|
|
47
|
-
"neo-open-api": "^1.0
|
|
47
|
+
"neo-open-api": "^1.1.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@commitlint/cli": "^8.3.5",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@types/react": "^16.9.11",
|
|
53
53
|
"@types/react-dom": "^16.9.15",
|
|
54
54
|
"@types/axios": "^0.14.0",
|
|
55
|
-
"neo-cmp-cli": "^1.7.
|
|
55
|
+
"neo-cmp-cli": "^1.7.15",
|
|
56
56
|
"husky": "^4.2.5",
|
|
57
57
|
"lint-staged": "^10.2.9",
|
|
58
58
|
"prettier": "^2.0.5"
|
|
@@ -15,7 +15,21 @@ export class EntityCardListModel {
|
|
|
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/data-list.svg';
|
|
@@ -17,7 +17,21 @@ export class EntityDetailModel {
|
|
|
17
17
|
description: string = '展示实体数据详情信息,支持多列布局和字段类型识别';
|
|
18
18
|
|
|
19
19
|
/** 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签) */
|
|
20
|
-
tags: string[] = ['自定义组件'];
|
|
20
|
+
// tags: string[] = ['自定义组件'];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 用于设置组件支持的页面类型
|
|
24
|
+
*
|
|
25
|
+
* 当前 NeoCRM 平台存在的页面类型:
|
|
26
|
+
* all: 1 全页面
|
|
27
|
+
* indexPage: 2 首页
|
|
28
|
+
* entityListPage: 3 实体列表页
|
|
29
|
+
* entityFormPage: 4 实体表单页
|
|
30
|
+
* entityDetailPage: 5 实体详情页
|
|
31
|
+
* customPage: 6 自定义页面
|
|
32
|
+
* bizPage: 7 业务页面
|
|
33
|
+
*/
|
|
34
|
+
// targetPage: string[] = ['customPage'];
|
|
21
35
|
|
|
22
36
|
/** 组件图标,用于设置在编辑器左侧组件面板中展示的图标 */
|
|
23
37
|
iconSrc: string = 'https://custom-widgets.bj.bcebos.com/detail.svg';
|
|
@@ -19,7 +19,21 @@ export class EntityFormModel {
|
|
|
19
19
|
description: string = '基于 XObject 的对象表单组件,用于新增数据';
|
|
20
20
|
|
|
21
21
|
/** 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签) */
|
|
22
|
-
tags: string[] = ['自定义组件'];
|
|
22
|
+
// tags: string[] = ['自定义组件'];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 用于设置组件支持的页面类型
|
|
26
|
+
*
|
|
27
|
+
* 当前 NeoCRM 平台存在的页面类型:
|
|
28
|
+
* all: 1 全页面
|
|
29
|
+
* indexPage: 2 首页
|
|
30
|
+
* entityListPage: 3 实体列表页
|
|
31
|
+
* entityFormPage: 4 实体表单页
|
|
32
|
+
* entityDetailPage: 5 实体详情页
|
|
33
|
+
* customPage: 6 自定义页面
|
|
34
|
+
* bizPage: 7 业务页面
|
|
35
|
+
*/
|
|
36
|
+
// targetPage: string[] = ['customPage'];
|
|
23
37
|
|
|
24
38
|
/** 组件图标,用于设置在编辑器左侧组件面板中展示的图标 */
|
|
25
39
|
iconSrc: string = 'https://custom-widgets.bj.bcebos.com/custom-form.svg';
|
|
@@ -19,11 +19,25 @@ export class EntityTableModel {
|
|
|
19
19
|
description: string = '基于 XObject 的数据表格组件,支持增删改查操作';
|
|
20
20
|
|
|
21
21
|
/** 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签) */
|
|
22
|
-
tags: string[] = ['自定义组件'];
|
|
22
|
+
// tags: string[] = ['自定义组件'];
|
|
23
23
|
|
|
24
24
|
/** 组件图标,用于设置在编辑器左侧组件面板中展示的图标 */
|
|
25
25
|
iconSrc: string = 'https://custom-widgets.bj.bcebos.com/table.svg';
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* 用于设置组件支持的页面类型
|
|
29
|
+
*
|
|
30
|
+
* 当前 NeoCRM 平台存在的页面类型:
|
|
31
|
+
* all: 1 全页面
|
|
32
|
+
* indexPage: 2 首页
|
|
33
|
+
* entityListPage: 3 实体列表页
|
|
34
|
+
* entityFormPage: 4 实体表单页
|
|
35
|
+
* entityDetailPage: 5 实体详情页
|
|
36
|
+
* customPage: 6 自定义页面
|
|
37
|
+
* bizPage: 7 业务页面
|
|
38
|
+
*/
|
|
39
|
+
// targetPage: string[] = ['customPage'];
|
|
40
|
+
|
|
27
41
|
/** 初次插入页面的默认属性数据 */
|
|
28
42
|
defaultComProps = {
|
|
29
43
|
title: '实体数据表格',
|
|
@@ -15,7 +15,21 @@ export class InfoCardModel {
|
|
|
15
15
|
description = '信息展示卡片';
|
|
16
16
|
|
|
17
17
|
// 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
|
|
18
|
-
tags = ['自定义组件'];
|
|
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 = 'https://neo-widgets.bj.bcebos.com/custom-widget.svg';
|
|
@@ -15,7 +15,21 @@ export class ListWidgetModel {
|
|
|
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/favicon.png';
|
|
@@ -15,7 +15,21 @@ export class InfoCardModel {
|
|
|
15
15
|
description = '信息展示卡片';
|
|
16
16
|
|
|
17
17
|
// 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
|
|
18
|
-
tags = ['自定义组件'];
|
|
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 = 'https://neo-widgets.bj.bcebos.com/custom-widget.svg';
|
|
@@ -12,6 +12,18 @@ const createCmpProjectZip = require('../projectUtils/createCmpProjectZip');
|
|
|
12
12
|
const currentPackageJsonDir = catchCurPackageJson();
|
|
13
13
|
const currentPackageJson = getConfigObj(currentPackageJsonDir);
|
|
14
14
|
|
|
15
|
+
|
|
16
|
+
// 获取属性 propsSchema 数据结构
|
|
17
|
+
const getPropsSchema = (propsSchema = []) => {
|
|
18
|
+
return propsSchema.map((item) => {
|
|
19
|
+
return {
|
|
20
|
+
label: item.label,
|
|
21
|
+
description: item.description,
|
|
22
|
+
propSchema: item
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
15
27
|
/**
|
|
16
28
|
* 构建组件数据映射
|
|
17
29
|
* @param {string} assetsRoot 构建产物的目录
|
|
@@ -86,13 +98,14 @@ const buildComponentData = async (assetsRoot, cmpInfo) => {
|
|
|
86
98
|
// 从模型实例中提取并设置组件信息
|
|
87
99
|
label: modelInstance.label || cmpType,
|
|
88
100
|
description: modelInstance.description || '',
|
|
89
|
-
componentCategory: (modelInstance.tags || []).join(','),
|
|
90
|
-
|
|
101
|
+
componentCategory: (modelInstance.tags || ['自定义组件']).join(','),
|
|
102
|
+
targetPage: (modelInstance.targetPage || ['customPage']).join(','),
|
|
103
|
+
iconUrl: modelInstance.iconSrc,
|
|
91
104
|
defaultProps: JSON.stringify(modelInstance.defaultComProps || {}),
|
|
92
105
|
previewProps: JSON.stringify(modelInstance.previewComProps || {}),
|
|
93
|
-
|
|
106
|
+
props: JSON.stringify(getPropsSchema(modelInstance.propsSchema || [])),
|
|
94
107
|
events: modelInstance.events || [],
|
|
95
|
-
|
|
108
|
+
functions: modelInstance.functions || modelInstance.actions || [],
|
|
96
109
|
// 如果模型实例中有其他属性,也可以添加
|
|
97
110
|
exposedToDesigner:
|
|
98
111
|
modelInstance.exposedToDesigner !== undefined ? modelInstance.exposedToDesigner : true,
|
|
@@ -151,7 +164,8 @@ const pushCmp = async (config, cmpType) => {
|
|
|
151
164
|
errorLog(`[1/4] 源码文件打包失败。`, spinner);
|
|
152
165
|
}
|
|
153
166
|
|
|
154
|
-
|
|
167
|
+
/*
|
|
168
|
+
// 步骤 3: 上传构建后资源文件(改放在保存时直接上传组件资源文件)
|
|
155
169
|
spinner.start(`[2/4] 上传自定义组件构建产物到 OSS...`);
|
|
156
170
|
let cmpInfo;
|
|
157
171
|
try {
|
|
@@ -164,6 +178,9 @@ const pushCmp = async (config, cmpType) => {
|
|
|
164
178
|
} catch (error) {
|
|
165
179
|
errorLog(`[2/4] 构建产物上传失败。`, spinner);
|
|
166
180
|
}
|
|
181
|
+
*/
|
|
182
|
+
spinner.start(`[2/4] 获取自定义组件构建产物...`);
|
|
183
|
+
const cmpInfo = await neoService.getCmpAssets(cmpType);
|
|
167
184
|
|
|
168
185
|
// 步骤 4: 构建组件数据
|
|
169
186
|
spinner.start(`[3/4] 构建组件数据...`);
|
|
@@ -45,7 +45,7 @@ module.exports = (defaultComponentsDir = './src/components', cmpType) => {
|
|
|
45
45
|
// 当前自定义组件目录
|
|
46
46
|
const widgetPath = path.join(componentsBaseDir, dir);
|
|
47
47
|
// 获取文件状态
|
|
48
|
-
const stat = fs.statSync(
|
|
48
|
+
const stat = fs.statSync(widgetPath);
|
|
49
49
|
// 如果文件是目录,则递归处理子目录
|
|
50
50
|
if (stat.isDirectory() && !dir.startsWith('.') && dir !== 'node_modules') {
|
|
51
51
|
// 当前自定义组件名称
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { execSync } = require('child_process');
|
|
2
2
|
|
|
3
3
|
// 所有需要废弃的版本(1.6.2 之前的所有版本)
|
|
4
|
-
const versionsToDeprecate = ["1.7.10", "1.7.11"];
|
|
4
|
+
const versionsToDeprecate = ["1.7.10", "1.7.11", "1.7.12", "1.7.13"];
|
|
5
5
|
|
|
6
6
|
const packageName = 'neo-cmp-cli';
|
|
7
7
|
const deprecateMessage = '此版本为开发中版本(存在 bug),请升级到最新版本。';
|