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.
Files changed (32) hide show
  1. package/package.json +1 -1
  2. package/src/neo/neoLogin.js +6 -6
  3. package/src/neo/neoService.js +131 -22
  4. package/src/template/antd-custom-cmp-template/package.json +2 -2
  5. package/src/template/antd-custom-cmp-template/src/components/dataDashboard/model.ts +15 -16
  6. package/src/template/antd-custom-cmp-template/src/components/infoCard/model.ts +15 -13
  7. package/src/template/develop/neo-custom-cmp-template/src/components/contactCardList/model.ts +1 -7
  8. package/src/template/develop/neo-custom-cmp-template/src/components/contactForm/model.ts +1 -1
  9. package/src/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/model.ts +1 -1
  10. package/src/template/echarts-custom-cmp-template/neo.config.js +1 -1
  11. package/src/template/echarts-custom-cmp-template/package.json +2 -2
  12. package/src/template/echarts-custom-cmp-template/src/components/chartWidget/model.ts +15 -17
  13. package/src/template/echarts-custom-cmp-template/src/components/mapWidget/model.ts +15 -13
  14. package/src/template/empty-cmp/model.ts +15 -13
  15. package/src/template/empty-custom-cmp-template/package.json +2 -2
  16. package/src/template/neo-custom-cmp-template/neo.config.js +4 -10
  17. package/src/template/neo-custom-cmp-template/package.json +5 -3
  18. package/src/template/neo-custom-cmp-template/src/components/entityCardList/model.ts +15 -14
  19. package/src/template/neo-custom-cmp-template/src/components/entityDetail/model.ts +15 -19
  20. package/src/template/neo-custom-cmp-template/src/components/entityForm/model.ts +15 -17
  21. package/src/template/neo-custom-cmp-template/src/components/entityTable/model.ts +15 -17
  22. package/src/template/neo-custom-cmp-template/tsconfig.json +42 -64
  23. package/src/template/react-custom-cmp-template/package.json +2 -2
  24. package/src/template/react-custom-cmp-template/src/components/infoCard/model.js +15 -13
  25. package/src/template/react-ts-custom-cmp-template/package.json +2 -2
  26. package/src/template/react-ts-custom-cmp-template/src/components/listWidget/model.ts +15 -13
  27. package/src/template/vue2-custom-cmp-template/package.json +2 -2
  28. package/src/template/vue2-custom-cmp-template/src/components/vueInfoCard/model.js +15 -13
  29. package/src/utils/cmpUtils/createCmpByZip.js +17 -6
  30. package/src/utils/cmpUtils/pullCmp.js +10 -9
  31. package/src/utils/cmpUtils/pushCmp.js +30 -11
  32. package/test/deprecate-versions.js +2 -2
@@ -7,12 +7,6 @@ function resolve(dir) {
7
7
  return path.resolve(__dirname, dir);
8
8
  }
9
9
 
10
- let auth = {}; // NeoCRM 授权配置
11
- if (fs.existsSync('./auth.config.js')) {
12
- // 加载 NeoCRM 授权配置
13
- auth = require('./auth.config');
14
- }
15
-
16
10
  // 包括生产和开发的环境配置信息
17
11
  module.exports = {
18
12
  settings: {
@@ -121,12 +115,12 @@ module.exports = {
121
115
  tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
122
116
  // 当 authType 为 password 时,auth 配置项必填
123
117
  auth: {
124
- client_id: auth.client_id || 'xx', // 客户端 ID,从创建连接器的客户端信息中获取(Client_Id)
125
- client_secret: auth.client_secret || 'xxx', // 客户端秘钥,从创建连接器的客户端信息中获取(Client_Secret)
126
- username: auth.username || 'xx', // 用户在销售易系统中的用户名
118
+ client_id: 'xx', // 客户端 ID,从创建连接器的客户端信息中获取(Client_Id)
119
+ client_secret: 'xxx', // 客户端秘钥,从创建连接器的客户端信息中获取(Client_Secret)
120
+ username: 'xx', // 用户在销售易系统中的用户名
127
121
  // password 为 用户在销售易系统中的账号密码加上 8 位安全令牌。
128
122
  // 例如,用户密码为 123456,安全令牌为 ABCDEFGH,则 password 的值应为 123456ABCDEFGH。
129
- password: auth.password || 'xx xx', // 用户账户密码 + 8 位安全令牌
123
+ password: 'xx xx', // 用户账户密码 + 8 位安全令牌
130
124
  },
131
125
  },
132
126
  */
@@ -14,6 +14,8 @@
14
14
  "preview": "neo preview",
15
15
  "linkDebug": "neo linkDebug",
16
16
  "pushCmp": "neo push cmp",
17
+ "pullCmp": "neo pull cmp",
18
+ "deleteCmp": "neo delete cmp",
17
19
  "format": "prettier --write \"src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}\""
18
20
  },
19
21
  "files": [
@@ -38,13 +40,13 @@
38
40
  "url": "https://github.com/wibetter/neo-custom-cmp-template/issues"
39
41
  },
40
42
  "dependencies": {
41
- "neo-register": "^1.0.6",
43
+ "neo-register": "^1.0.8",
42
44
  "react": "^16.9.0",
43
45
  "react-dom": "^16.9.0",
44
46
  "axios": "^0.27.2",
45
47
  "antd": "^4.9.4",
46
48
  "lodash": "^4.17.21",
47
- "neo-open-api": "^1.0.11"
49
+ "neo-open-api": "^1.1.0"
48
50
  },
49
51
  "devDependencies": {
50
52
  "@commitlint/cli": "^8.3.5",
@@ -52,7 +54,7 @@
52
54
  "@types/react": "^16.9.11",
53
55
  "@types/react-dom": "^16.9.15",
54
56
  "@types/axios": "^0.14.0",
55
- "neo-cmp-cli": "^1.7.5",
57
+ "neo-cmp-cli": "^1.8.0",
56
58
  "husky": "^4.2.5",
57
59
  "lint-staged": "^10.2.9",
58
60
  "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';
@@ -30,12 +44,6 @@ export class EntityCardListModel {
30
44
  },
31
45
  };
32
46
 
33
- // 设计器端预览时展示的默认数据
34
- previewComProps = {
35
- label: '数据卡片列表',
36
- title: '数据卡片列表',
37
- };
38
-
39
47
  /**
40
48
  * 组件面板配置,用于生成编辑器右侧属性配置面板内容
41
49
  */
@@ -61,13 +69,6 @@ export class EntityCardListModel {
61
69
  */
62
70
  },
63
71
  ];
64
-
65
- // 支持 函数式写法:propsSchemaCreator,com 为组件实例。优先级比 propsSchema 高
66
- /*
67
- propsSchemaCreator = (com: any) => {
68
- return [];
69
- };
70
- */
71
72
  }
72
73
 
73
74
  export default EntityCardListModel;
@@ -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';
@@ -33,13 +47,6 @@ export class EntityDetailModel {
33
47
  showTitle: true,
34
48
  };
35
49
 
36
- /** 设计器端预览时展示的默认数据 */
37
- previewComProps = {
38
- title: '实体数据详情',
39
- columnCount: 3,
40
- showTitle: true,
41
- };
42
-
43
50
  /**
44
51
  * 组件属性配置模式
45
52
  * 定义组件在编辑器中可配置的属性
@@ -111,17 +118,6 @@ export class EntityDetailModel {
111
118
  description: '详情页面的列数布局',
112
119
  },
113
120
  ];
114
-
115
- /**
116
- * 支持函数式写法:propsSchemaCreator
117
- * com 为组件实例,优先级比 propsSchema 高
118
- * 可以根据组件实例动态生成属性配置
119
- */
120
- /*
121
- propsSchemaCreator = (com: any) => {
122
- return [];
123
- };
124
- */
125
121
  }
126
122
 
127
123
  export default EntityDetailModel;
@@ -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';
@@ -35,11 +49,6 @@ export class EntityFormModel {
35
49
  },
36
50
  };
37
51
 
38
- /** 设计器端预览时展示的默认数据 */
39
- previewComProps = {
40
- formTitle: '新增数据表单',
41
- };
42
-
43
52
  /**
44
53
  * 组件属性配置模式
45
54
  * 支持静态配置:propsSchema,优先级比 propsSchemaCreator 低
@@ -93,17 +102,6 @@ export class EntityFormModel {
93
102
  value: true,
94
103
  },
95
104
  ];
96
-
97
- /**
98
- * 支持函数式写法:propsSchemaCreator
99
- * com 为组件实例,优先级比 propsSchema 高
100
- * 可以根据组件实例动态生成属性配置
101
- */
102
- /*
103
- propsSchemaCreator = (com: any) => {
104
- return [];
105
- };
106
- */
107
105
  }
108
106
 
109
107
  export default EntityFormModel;
@@ -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: '实体数据表格',
@@ -36,11 +50,6 @@ export class EntityTableModel {
36
50
  },
37
51
  };
38
52
 
39
- /** 设计器端预览时展示的默认数据 */
40
- previewComProps = {
41
- title: '实体数据表格',
42
- };
43
-
44
53
  /**
45
54
  * 组件属性配置模式
46
55
  * 支持静态配置:propsSchema,优先级比 propsSchemaCreator 低
@@ -120,17 +129,6 @@ export class EntityTableModel {
120
129
  value: true,
121
130
  },
122
131
  ];
123
-
124
- /**
125
- * 支持函数式写法:propsSchemaCreator
126
- * com 为组件实例,优先级比 propsSchema 高
127
- * 可以根据组件实例动态生成属性配置
128
- */
129
- /*
130
- propsSchemaCreator = (com: any) => {
131
- return [];
132
- };
133
- */
134
132
  }
135
133
 
136
134
  export default EntityTableModel;
@@ -1,71 +1,49 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "experimentalDecorators": true,
4
- /* Basic Options */
5
4
  "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. */,
5
+ "module": "esnext",
6
+ "allowJs": false,
7
+ "jsx": "react",
8
+ "declaration": false,
9
+ "noEmit": false,
10
+ "importHelpers": true,
11
+ "isolatedModules": false,
12
+ "strict": false,
13
+ "noImplicitAny": true,
14
+ "strictNullChecks": true,
15
+ "noImplicitThis": true,
16
+ "noUnusedLocals": false,
17
+ "noImplicitReturns": true,
18
+ "moduleResolution": "node",
19
+ "baseUrl": "./",
43
20
  "paths": {
44
- "@": ["./src"],
45
- "@assets/*": ["src/assets/*"],
46
- "@components/*": ["src/components/*"],
47
- "$utils/*": ["src/utils/*"]
48
- } /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
49
- // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
50
- /* 指定声明文件或文件夹的路径列表,如果指定了此项,则只有在这里列出的声明文件才会被加载 */
51
- "typeRoots": ["./@types", "./node_modules/@types"],
52
- // "types": [], /* 指定需要包含的模块,只有在这里列出的模块的声明文件才会被加载 */
53
- "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
54
- "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
55
- // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
56
-
57
- /* Source Map Options */
58
- // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
59
- // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
60
- // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
61
- // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
62
-
63
- /* Experimental Options */
64
- // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
65
- // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
66
- "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
67
- // "suppressImplicitAnyIndexErrors": true /* Suppress --noImplicitAny errors for indexing objects lacking index signatures. See issue #1232 for more details. */
21
+ "@": [
22
+ "./src"
23
+ ],
24
+ "@assets/*": [
25
+ "src/assets/*"
26
+ ],
27
+ "@components/*": [
28
+ "src/components/*"
29
+ ],
30
+ "$utils/*": [
31
+ "src/utils/*"
32
+ ]
33
+ },
34
+ "typeRoots": [
35
+ "./@types",
36
+ "./node_modules/@types"
37
+ ],
38
+ "allowSyntheticDefaultImports": true,
39
+ "esModuleInterop": true,
40
+ "forceConsistentCasingInFileNames": true
68
41
  },
69
- "include": ["src", "test"],
70
- "exclude": ["node_modules"]
42
+ "include": [
43
+ "src",
44
+ "test"
45
+ ],
46
+ "exclude": [
47
+ "node_modules"
48
+ ]
71
49
  }
@@ -38,14 +38,14 @@
38
38
  "url": "https://github.com/wibetter/react-custom-cmp-template/issues"
39
39
  },
40
40
  "dependencies": {
41
- "neo-register": "^1.0.6",
41
+ "neo-register": "^1.0.7",
42
42
  "react": "^16.9.0",
43
43
  "react-dom": "^16.9.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@commitlint/cli": "^8.3.5",
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
- "neo-cmp-cli": "^1.7.5",
48
+ "neo-cmp-cli": "^1.8.0",
49
49
  "husky": "^4.2.5",
50
50
  "lint-staged": "^10.2.9",
51
51
  "prettier": "^2.0.5"
@@ -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';
@@ -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
  * 备注:自定义组件中可用的配置项类型 请见 [当前可用表单项](https://github.com/wibetter/neo-register/blob/master/docs/FormItemType.md
@@ -67,13 +76,6 @@ export class InfoCardModel {
67
76
  value: 2025,
68
77
  },
69
78
  ];
70
-
71
- // 支持 函数式写法:propsSchemaCreator,com 为页面设计器中的组件实例。优先级比 propsSchema 高
72
- /*
73
- propsSchemaCreator = (com: any, data: any) => {
74
- return [];
75
- };
76
- */
77
79
  }
78
80
 
79
81
  export default InfoCardModel;
@@ -38,7 +38,7 @@
38
38
  "url": "https://github.com/wibetter/react-ts-custom-cmp-template/issues"
39
39
  },
40
40
  "dependencies": {
41
- "neo-register": "^1.0.6",
41
+ "neo-register": "^1.0.7",
42
42
  "react": "^16.9.0",
43
43
  "react-dom": "^16.9.0"
44
44
  },
@@ -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.7.5",
50
+ "neo-cmp-cli": "^1.8.0",
51
51
  "husky": "^4.2.5",
52
52
  "lint-staged": "^10.2.9",
53
53
  "prettier": "^2.0.5"
@@ -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';
@@ -31,11 +45,6 @@ export class ListWidgetModel {
31
45
  listType: 'default',
32
46
  };
33
47
 
34
- // 设计器端预览时展示的默认数据
35
- previewComProps = {
36
- label: '列表组件',
37
- };
38
-
39
48
  /**
40
49
  * 组件面板配置,用于生成编辑器右侧属性配置面板内容
41
50
  */
@@ -78,13 +87,6 @@ export class ListWidgetModel {
78
87
  ],
79
88
  },
80
89
  ];
81
-
82
- // 支持 函数式写法:propsSchemaCreator,com 为组件实例。优先级比 propsSchema 高
83
- /*
84
- propsSchemaCreator = (com: any) => {
85
- return [];
86
- };
87
- */
88
90
  }
89
91
 
90
92
  export default ListWidgetModel;
@@ -38,14 +38,14 @@
38
38
  "url": "https://github.com/wibetter/vue2-custom-cmp-template/issues"
39
39
  },
40
40
  "dependencies": {
41
- "neo-register": "^1.0.6",
41
+ "neo-register": "^1.0.7",
42
42
  "vue": "^2.6.14",
43
43
  "element-ui": "^2.15.12"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@commitlint/cli": "^8.3.5",
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
- "neo-cmp-cli": "^1.7.5",
48
+ "neo-cmp-cli": "^1.8.0",
49
49
  "husky": "^4.2.5",
50
50
  "lint-staged": "^10.2.9",
51
51
  "prettier": "^2.0.5",
@@ -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';
@@ -31,11 +45,6 @@ export class InfoCardModel {
31
45
  comment_count: 2025,
32
46
  };
33
47
 
34
- // 设计器端预览时展示的默认数据
35
- previewComProps = {
36
- label: 'vue 信息卡片',
37
- };
38
-
39
48
  /**
40
49
  * 组件面板配置,用于生成编辑器右侧属性配置面板内容
41
50
  * 备注:自定义组件中可用的配置项类型 请见 [当前可用表单项](https://github.com/wibetter/neo-register/blob/master/docs/FormItemType.md
@@ -67,13 +76,6 @@ export class InfoCardModel {
67
76
  value: 2025,
68
77
  },
69
78
  ];
70
-
71
- // 支持 函数式写法:propsSchemaCreator,com 为页面设计器中的组件实例。优先级比 propsSchema 高
72
- /*
73
- propsSchemaCreator = (com: any) => {
74
- return [];
75
- };
76
- */
77
79
  }
78
80
 
79
81
  export default InfoCardModel;
@@ -120,7 +120,8 @@ function formatConfigObject(obj, indent = 0, fileDir = '') {
120
120
  * 3、对于 组件源码中的 tsconfig.json 文件内容 和 当前项目 tsconfig  进行 非覆盖式 merge 处理;
121
121
  * 4、对于 组件源码中的 package.json 文件内容 和 当前项目 package.json  进行 非覆盖式 merge 处理,并识别新增 依赖,提示用户 重新安装依赖
122
122
  */
123
- module.exports = async function (cmpZipUrl, cmpName, componentBaseDir = './src/components') {
123
+ module.exports = async function (cmpZipUrl, option = {}) {
124
+ const { token, cmpName, componentBaseDir = './src/components' } = option || {};
124
125
  const finalCmpName = cmpName;
125
126
 
126
127
  if (!hasNeoProject()) {
@@ -154,16 +155,26 @@ module.exports = async function (cmpZipUrl, cmpName, componentBaseDir = './src/c
154
155
  // 下载 zip 文件
155
156
  let response;
156
157
  try {
157
- response = await axios({
158
- url: cmpZipUrl,
159
- method: 'GET',
158
+ response = await axios.get(cmpZipUrl, {
159
+ headers: {
160
+ Authorization: `Bearer ${token}`,
161
+ 'xsy-inner-source': 'bff',
162
+ },
160
163
  responseType: 'arraybuffer',
161
164
  timeout: 60000, // 60秒超时
162
165
  maxContentLength: Infinity,
163
- maxBodyLength: Infinity
166
+ maxBodyLength: Infinity,
167
+ maxRedirects: 5, // 支持重定向
168
+ validateStatus: function (status) {
169
+ // 接受 2xx 和 3xx 状态码(重定向)
170
+ return status >= 200 && status < 400;
171
+ }
164
172
  });
165
173
  } catch (axiosError) {
166
- errorLog(`下载文件失败: ${axiosError.message}`, spinner);
174
+ const errorMessage = axiosError.response
175
+ ? `下载文件失败: HTTP ${axiosError.response.status} - ${axiosError.message}`
176
+ : `下载文件失败: ${axiosError.message}`;
177
+ errorLog(errorMessage, spinner);
167
178
  throw axiosError;
168
179
  }
169
180