neo-cmp-cli 1.12.9 → 1.12.11
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/dist/index2.js +1 -1
- package/dist/module/neoInitByCopy.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/utils/projectUtils/createCmpProjectByTemplate.js +1 -1
- package/docs/NeoEntityGrid /344/275/277/347/224/250/350/257/264/346/230/216.md" +1202 -0
- package/docs//345/217/257/347/224/250/345/261/236/346/200/247/351/205/215/347/275/256/351/241/271.md +801 -0
- package/package.json +5 -1
- package/template/antd-custom-cmp-template/package.json +1 -1
- package/template/asset-manage-template/package.json +1 -2
- package/template/asset-manage-template/src/utils/queryObjectData.ts +36 -0
- package/template/echarts-custom-cmp-template/package.json +1 -1
- package/template/empty-custom-cmp-template/package.json +1 -1
- package/template/neo-custom-cmp-template/package.json +4 -1
- package/template/neo-custom-cmp-template/src/utils/queryObjectData.ts +36 -0
- package/template/neo-custom-cmp-template/tsconfig.json +1 -2
- package/template/neo-h5-cmps/neo.config.js +1 -6
- package/template/neo-h5-cmps/package.json +6 -4
- package/template/neo-h5-cmps/src/utils/queryObjectData.ts +36 -0
- package/template/neo-h5-cmps/tsconfig.json +3 -4
- package/template/neo-order-cmps/package.json +1 -1
- package/template/neo-order-cmps/src/utils/queryObjectData.ts +36 -0
- package/template/neo-web-cmps/.prettierrc.js +12 -0
- package/template/neo-web-cmps/@types/neo-ui-common.d.ts +36 -0
- package/template/neo-web-cmps/README.md +99 -0
- package/template/neo-web-cmps/commitlint.config.js +59 -0
- package/template/neo-web-cmps/neo.config.js +53 -0
- package/template/neo-web-cmps/package.json +65 -0
- package/template/neo-web-cmps/public/css/base.css +283 -0
- package/template/neo-web-cmps/public/scripts/app/bluebird.js +6679 -0
- package/template/neo-web-cmps/public/template.html +13 -0
- package/template/neo-web-cmps/src/assets/css/common.scss +127 -0
- package/template/neo-web-cmps/src/assets/css/mixin.scss +47 -0
- package/template/neo-web-cmps/src/assets/img/AIBtn.gif +0 -0
- package/template/neo-web-cmps/src/assets/img/NeoCRM.jpg +0 -0
- package/template/neo-web-cmps/src/assets/img/aiLogo.png +0 -0
- package/template/neo-web-cmps/src/assets/img/card-list.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/contact-form.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/custom-form.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/custom-widget.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/data-list.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/detail.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/favicon.png +0 -0
- package/template/neo-web-cmps/src/assets/img/map.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/search.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/table.svg +1 -0
- package/template/neo-web-cmps/src/components/entityGrid2__c/index.tsx +119 -0
- package/template/neo-web-cmps/src/components/entityGrid2__c/model.ts +180 -0
- package/template/neo-web-cmps/src/components/entityGrid2__c/style.scss +69 -0
- package/template/neo-web-cmps/src/components/entityGrid3__c/index.tsx +79 -0
- package/template/neo-web-cmps/src/components/entityGrid3__c/model.ts +121 -0
- package/template/neo-web-cmps/src/components/entityGrid3__c/style.scss +60 -0
- package/template/neo-web-cmps/src/components/entityGrid4__c/index.tsx +80 -0
- package/template/neo-web-cmps/src/components/entityGrid4__c/model.ts +180 -0
- package/template/neo-web-cmps/src/components/entityGrid4__c/style.scss +13 -0
- package/template/neo-web-cmps/src/components/entityGrid__c/index.tsx +77 -0
- package/template/neo-web-cmps/src/components/entityGrid__c/model.ts +180 -0
- package/template/neo-web-cmps/src/components/entityGrid__c/style.scss +13 -0
- package/template/neo-web-cmps/src/utils/axiosFetcher.ts +37 -0
- package/template/neo-web-cmps/src/utils/queryObjectData.ts +112 -0
- package/template/neo-web-cmps/src/utils/xobjects.ts +167 -0
- package/template/neo-web-cmps/tsconfig.json +39 -0
- package/template/react-custom-cmp-template/package.json +1 -1
- package/template/react-ts-custom-cmp-template/package.json +1 -1
- package/template/vue2-custom-cmp-template/package.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neo-cmp-cli",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.11",
|
|
4
4
|
"description": "Neo 自定义组件开发工具,支持react 和 vue2.0技术栈。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neo-cli",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"files": [
|
|
20
20
|
"bin/*",
|
|
21
21
|
"dist/*",
|
|
22
|
+
"docs/*",
|
|
22
23
|
"template/*"
|
|
23
24
|
],
|
|
24
25
|
"husky": {
|
|
@@ -66,6 +67,9 @@
|
|
|
66
67
|
"lint-staged": "^10.2.9",
|
|
67
68
|
"prettier": "^2.0.5"
|
|
68
69
|
},
|
|
70
|
+
"overrides": {
|
|
71
|
+
"typescript": "<6"
|
|
72
|
+
},
|
|
69
73
|
"engines": {
|
|
70
74
|
"node": ">= 16.0.0",
|
|
71
75
|
"npm": ">= 8.0.0"
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"antd": "4.9.4",
|
|
43
43
|
"lodash": "^4.17.21",
|
|
44
44
|
"neo-open-api": "^1.2.3",
|
|
45
|
-
"@wibetter/json-editor": "^6.0.5",
|
|
46
45
|
"tslib": "2.3.0",
|
|
47
46
|
"echarts": "^5.5.1",
|
|
48
47
|
"moment": "^2.30.1"
|
|
@@ -53,7 +52,7 @@
|
|
|
53
52
|
"@types/react": "^16.9.11",
|
|
54
53
|
"@types/react-dom": "^16.9.15",
|
|
55
54
|
"@types/axios": "^0.14.0",
|
|
56
|
-
"neo-cmp-cli": "^1.12.
|
|
55
|
+
"neo-cmp-cli": "^1.12.11",
|
|
57
56
|
"husky": "^4.2.5",
|
|
58
57
|
"lint-staged": "^10.2.9",
|
|
59
58
|
"prettier": "^2.0.5",
|
|
@@ -4,6 +4,23 @@ import axiosFetcher from '$utils/axiosFetcher';
|
|
|
4
4
|
* 这里存放通用查询类 Open API
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
/** 将 where 规范为 SQL 片段:字符串直接使用;数组用 and 拼接各条件 */
|
|
8
|
+
function normalizeWhere(where: unknown): string {
|
|
9
|
+
if (where == null || where === '') {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
if (typeof where === 'string') {
|
|
13
|
+
return where.trim();
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(where)) {
|
|
16
|
+
return where
|
|
17
|
+
.map((part) => (part == null ? '' : String(part).trim()))
|
|
18
|
+
.filter(Boolean)
|
|
19
|
+
.join(' and ');
|
|
20
|
+
}
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
|
|
7
24
|
// 获取业务对象数据列表
|
|
8
25
|
export const queryXObjectData = async (options?: any) => {
|
|
9
26
|
const apiUrl = '/rest/data/v2/query';
|
|
@@ -29,6 +46,25 @@ export const queryXObjectData = async (options?: any) => {
|
|
|
29
46
|
querySql += ` order by ${curOptions.orderBy}`;
|
|
30
47
|
}
|
|
31
48
|
|
|
49
|
+
/**
|
|
50
|
+
* 添加过滤条件(如果有的话)
|
|
51
|
+
* 支持的操作符包括:=、!=、like、not like、not in、is not null、is null、>、<、<>、>=、<=、in、between ... and ...。
|
|
52
|
+
* 对于 =、like 和 in 有以下说明:
|
|
53
|
+
* “=” 作为字符串的条件时,表示精确匹配。例如,查询条件 city = '北京',将返回 city 字段值严格等于 "北京" 的所有记录。
|
|
54
|
+
* "like" 作为字符串的条件时,需要使用"%" 通配符进行模糊匹配。例如,city like‘北京%',将返回 city 字段值以 "北京" 开头的所有记录。
|
|
55
|
+
* 目前仅支持将通配符“%” 放到已知内容之后的查询方式,例如,不支持 city like ‘% 北京'的查询方式。
|
|
56
|
+
* 当 SQL 查询中包含“%”等特殊字符时,需要对 SQL 进行 URL 编码处理。
|
|
57
|
+
* 支持"in",但不包括子查询。
|
|
58
|
+
* 支持的逻辑运算符包括:and、or。
|
|
59
|
+
*
|
|
60
|
+
* `where` 可为字符串,或字符串数组(多项默认以 and 连接,等价于手写 `a and b`)。
|
|
61
|
+
*/
|
|
62
|
+
const whereClause = normalizeWhere(curOptions.where);
|
|
63
|
+
console.log('whereClause:', whereClause);
|
|
64
|
+
if (whereClause) {
|
|
65
|
+
querySql += ` where ${whereClause}`;
|
|
66
|
+
}
|
|
67
|
+
|
|
32
68
|
if (curOptions.page || curOptions.pageSize) {
|
|
33
69
|
// 添加分页限制
|
|
34
70
|
querySql += ` limit ${pageSize} offset ${offset}`;
|
|
@@ -55,11 +55,14 @@
|
|
|
55
55
|
"@types/react": "^16.9.11",
|
|
56
56
|
"@types/react-dom": "^16.9.15",
|
|
57
57
|
"@types/axios": "^0.14.0",
|
|
58
|
-
"neo-cmp-cli": "^1.12.
|
|
58
|
+
"neo-cmp-cli": "^1.12.11",
|
|
59
59
|
"husky": "^4.2.5",
|
|
60
60
|
"lint-staged": "^10.2.9",
|
|
61
61
|
"prettier": "^2.0.5"
|
|
62
62
|
},
|
|
63
|
+
"overrides": {
|
|
64
|
+
"typescript": "<6"
|
|
65
|
+
},
|
|
63
66
|
"engines": {
|
|
64
67
|
"node": ">= 16.0.0",
|
|
65
68
|
"npm": ">= 8.0.0"
|
|
@@ -4,6 +4,23 @@ import axiosFetcher from '$utils/axiosFetcher';
|
|
|
4
4
|
* 这里存放通用查询类 Open API
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
/** 将 where 规范为 SQL 片段:字符串直接使用;数组用 and 拼接各条件 */
|
|
8
|
+
function normalizeWhere(where: unknown): string {
|
|
9
|
+
if (where == null || where === '') {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
if (typeof where === 'string') {
|
|
13
|
+
return where.trim();
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(where)) {
|
|
16
|
+
return where
|
|
17
|
+
.map((part) => (part == null ? '' : String(part).trim()))
|
|
18
|
+
.filter(Boolean)
|
|
19
|
+
.join(' and ');
|
|
20
|
+
}
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
|
|
7
24
|
// 获取业务对象数据列表
|
|
8
25
|
export const queryXObjectData = async (options?: any) => {
|
|
9
26
|
const apiUrl = '/rest/data/v2/query';
|
|
@@ -29,6 +46,25 @@ export const queryXObjectData = async (options?: any) => {
|
|
|
29
46
|
querySql += ` order by ${curOptions.orderBy}`;
|
|
30
47
|
}
|
|
31
48
|
|
|
49
|
+
/**
|
|
50
|
+
* 添加过滤条件(如果有的话)
|
|
51
|
+
* 支持的操作符包括:=、!=、like、not like、not in、is not null、is null、>、<、<>、>=、<=、in、between ... and ...。
|
|
52
|
+
* 对于 =、like 和 in 有以下说明:
|
|
53
|
+
* “=” 作为字符串的条件时,表示精确匹配。例如,查询条件 city = '北京',将返回 city 字段值严格等于 "北京" 的所有记录。
|
|
54
|
+
* "like" 作为字符串的条件时,需要使用"%" 通配符进行模糊匹配。例如,city like‘北京%',将返回 city 字段值以 "北京" 开头的所有记录。
|
|
55
|
+
* 目前仅支持将通配符“%” 放到已知内容之后的查询方式,例如,不支持 city like ‘% 北京'的查询方式。
|
|
56
|
+
* 当 SQL 查询中包含“%”等特殊字符时,需要对 SQL 进行 URL 编码处理。
|
|
57
|
+
* 支持"in",但不包括子查询。
|
|
58
|
+
* 支持的逻辑运算符包括:and、or。
|
|
59
|
+
*
|
|
60
|
+
* `where` 可为字符串,或字符串数组(多项默认以 and 连接,等价于手写 `a and b`)。
|
|
61
|
+
*/
|
|
62
|
+
const whereClause = normalizeWhere(curOptions.where);
|
|
63
|
+
console.log('whereClause:', whereClause);
|
|
64
|
+
if (whereClause) {
|
|
65
|
+
querySql += ` where ${whereClause}`;
|
|
66
|
+
}
|
|
67
|
+
|
|
32
68
|
if (curOptions.page || curOptions.pageSize) {
|
|
33
69
|
// 添加分页限制
|
|
34
70
|
querySql += ` limit ${pageSize} offset ${offset}`;
|
|
@@ -44,15 +44,10 @@ module.exports = {
|
|
|
44
44
|
ignoreNodeModules: false
|
|
45
45
|
},
|
|
46
46
|
linkDebug: {},
|
|
47
|
-
|
|
47
|
+
neoConfig: {
|
|
48
48
|
neoBaseURL: "https://crm-test.xiaoshouyi.com",
|
|
49
49
|
loginURL: "https://login-test.xiaoshouyi.com/auc/oauth2/auth",
|
|
50
50
|
tokenURL: "https://login-test.xiaoshouyi.com/auc/oauth2/token"
|
|
51
51
|
},
|
|
52
|
-
neoConfig: {
|
|
53
|
-
neoBaseURL: "https://crm-tencentuat.xiaoshouyi.com",
|
|
54
|
-
loginURL: "https://login-tencentuat.xiaoshouyi.com/auc/oauth2/auth",
|
|
55
|
-
tokenURL: "https://login-tencentuat.xiaoshouyi.com/auc/oauth2/token"
|
|
56
|
-
},
|
|
57
52
|
pushCmp: {}
|
|
58
53
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neo-h5-cmps",
|
|
3
3
|
"version": "1.1.0",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "Neo Web 核心业务组件使用示例(react&ts技术栈)",
|
|
5
5
|
"framework": "react-ts",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"react&ts技术栈",
|
|
8
|
-
"
|
|
8
|
+
"neoh5 核心业务组件"
|
|
9
9
|
],
|
|
10
10
|
"author": "wibetter",
|
|
11
11
|
"license": "MIT",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"antd-mobile": "^2.3.3",
|
|
41
41
|
"lodash": "^4.17.23",
|
|
42
42
|
"neo-open-api": "^1.2.3",
|
|
43
|
-
"@wibetter/json-editor": "^6.0.5",
|
|
44
43
|
"tslib": "2.3.0"
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
@@ -50,11 +49,14 @@
|
|
|
50
49
|
"@types/react": "^16.9.11",
|
|
51
50
|
"@types/react-dom": "^16.9.15",
|
|
52
51
|
"@types/axios": "^0.14.0",
|
|
53
|
-
"neo-cmp-cli": "^1.12.
|
|
52
|
+
"neo-cmp-cli": "^1.12.11",
|
|
54
53
|
"husky": "^4.2.5",
|
|
55
54
|
"lint-staged": "^10.2.9",
|
|
56
55
|
"prettier": "^2.0.5"
|
|
57
56
|
},
|
|
57
|
+
"overrides": {
|
|
58
|
+
"typescript": "<6"
|
|
59
|
+
},
|
|
58
60
|
"engines": {
|
|
59
61
|
"node": ">= 16.0.0",
|
|
60
62
|
"npm": ">= 8.0.0"
|
|
@@ -4,6 +4,23 @@ import axiosFetcher from '$utils/axiosFetcher';
|
|
|
4
4
|
* 这里存放通用查询类 Open API
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
/** 将 where 规范为 SQL 片段:字符串直接使用;数组用 and 拼接各条件 */
|
|
8
|
+
function normalizeWhere(where: unknown): string {
|
|
9
|
+
if (where == null || where === '') {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
if (typeof where === 'string') {
|
|
13
|
+
return where.trim();
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(where)) {
|
|
16
|
+
return where
|
|
17
|
+
.map((part) => (part == null ? '' : String(part).trim()))
|
|
18
|
+
.filter(Boolean)
|
|
19
|
+
.join(' and ');
|
|
20
|
+
}
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
|
|
7
24
|
// 获取业务对象数据列表
|
|
8
25
|
export const queryXObjectData = async (options?: any) => {
|
|
9
26
|
const apiUrl = '/rest/data/v2/query';
|
|
@@ -29,6 +46,25 @@ export const queryXObjectData = async (options?: any) => {
|
|
|
29
46
|
querySql += ` order by ${curOptions.orderBy}`;
|
|
30
47
|
}
|
|
31
48
|
|
|
49
|
+
/**
|
|
50
|
+
* 添加过滤条件(如果有的话)
|
|
51
|
+
* 支持的操作符包括:=、!=、like、not like、not in、is not null、is null、>、<、<>、>=、<=、in、between ... and ...。
|
|
52
|
+
* 对于 =、like 和 in 有以下说明:
|
|
53
|
+
* “=” 作为字符串的条件时,表示精确匹配。例如,查询条件 city = '北京',将返回 city 字段值严格等于 "北京" 的所有记录。
|
|
54
|
+
* "like" 作为字符串的条件时,需要使用"%" 通配符进行模糊匹配。例如,city like‘北京%',将返回 city 字段值以 "北京" 开头的所有记录。
|
|
55
|
+
* 目前仅支持将通配符“%” 放到已知内容之后的查询方式,例如,不支持 city like ‘% 北京'的查询方式。
|
|
56
|
+
* 当 SQL 查询中包含“%”等特殊字符时,需要对 SQL 进行 URL 编码处理。
|
|
57
|
+
* 支持"in",但不包括子查询。
|
|
58
|
+
* 支持的逻辑运算符包括:and、or。
|
|
59
|
+
*
|
|
60
|
+
* `where` 可为字符串,或字符串数组(多项默认以 and 连接,等价于手写 `a and b`)。
|
|
61
|
+
*/
|
|
62
|
+
const whereClause = normalizeWhere(curOptions.where);
|
|
63
|
+
console.log('whereClause:', whereClause);
|
|
64
|
+
if (whereClause) {
|
|
65
|
+
querySql += ` where ${whereClause}`;
|
|
66
|
+
}
|
|
67
|
+
|
|
32
68
|
if (curOptions.page || curOptions.pageSize) {
|
|
33
69
|
// 添加分页限制
|
|
34
70
|
querySql += ` limit ${pageSize} offset ${offset}`;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"target": "esnext",
|
|
5
5
|
"module": "esnext",
|
|
6
6
|
"allowJs": false,
|
|
7
|
-
"jsx": "react",
|
|
7
|
+
"jsx": "react", // preserve
|
|
8
8
|
"declaration": false,
|
|
9
9
|
"noEmit": false,
|
|
10
10
|
"importHelpers": true,
|
|
@@ -31,10 +31,9 @@
|
|
|
31
31
|
"forceConsistentCasingInFileNames": true
|
|
32
32
|
},
|
|
33
33
|
"include": [
|
|
34
|
-
"src"
|
|
35
|
-
"test"
|
|
34
|
+
"src"
|
|
36
35
|
],
|
|
37
36
|
"exclude": [
|
|
38
37
|
"node_modules"
|
|
39
38
|
]
|
|
40
|
-
}
|
|
39
|
+
}
|
|
@@ -4,6 +4,23 @@ import axiosFetcher from '$utils/axiosFetcher';
|
|
|
4
4
|
* 这里存放通用查询类 Open API
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
/** 将 where 规范为 SQL 片段:字符串直接使用;数组用 and 拼接各条件 */
|
|
8
|
+
function normalizeWhere(where: unknown): string {
|
|
9
|
+
if (where == null || where === '') {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
if (typeof where === 'string') {
|
|
13
|
+
return where.trim();
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(where)) {
|
|
16
|
+
return where
|
|
17
|
+
.map((part) => (part == null ? '' : String(part).trim()))
|
|
18
|
+
.filter(Boolean)
|
|
19
|
+
.join(' and ');
|
|
20
|
+
}
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
|
|
7
24
|
// 获取业务对象数据列表
|
|
8
25
|
export const queryXObjectData = async (options?: any) => {
|
|
9
26
|
const apiUrl = '/rest/data/v2/query';
|
|
@@ -29,6 +46,25 @@ export const queryXObjectData = async (options?: any) => {
|
|
|
29
46
|
querySql += ` order by ${curOptions.orderBy}`;
|
|
30
47
|
}
|
|
31
48
|
|
|
49
|
+
/**
|
|
50
|
+
* 添加过滤条件(如果有的话)
|
|
51
|
+
* 支持的操作符包括:=、!=、like、not like、not in、is not null、is null、>、<、<>、>=、<=、in、between ... and ...。
|
|
52
|
+
* 对于 =、like 和 in 有以下说明:
|
|
53
|
+
* “=” 作为字符串的条件时,表示精确匹配。例如,查询条件 city = '北京',将返回 city 字段值严格等于 "北京" 的所有记录。
|
|
54
|
+
* "like" 作为字符串的条件时,需要使用"%" 通配符进行模糊匹配。例如,city like‘北京%',将返回 city 字段值以 "北京" 开头的所有记录。
|
|
55
|
+
* 目前仅支持将通配符“%” 放到已知内容之后的查询方式,例如,不支持 city like ‘% 北京'的查询方式。
|
|
56
|
+
* 当 SQL 查询中包含“%”等特殊字符时,需要对 SQL 进行 URL 编码处理。
|
|
57
|
+
* 支持"in",但不包括子查询。
|
|
58
|
+
* 支持的逻辑运算符包括:and、or。
|
|
59
|
+
*
|
|
60
|
+
* `where` 可为字符串,或字符串数组(多项默认以 and 连接,等价于手写 `a and b`)。
|
|
61
|
+
*/
|
|
62
|
+
const whereClause = normalizeWhere(curOptions.where);
|
|
63
|
+
console.log('whereClause:', whereClause);
|
|
64
|
+
if (whereClause) {
|
|
65
|
+
querySql += ` where ${whereClause}`;
|
|
66
|
+
}
|
|
67
|
+
|
|
32
68
|
if (curOptions.page || curOptions.pageSize) {
|
|
33
69
|
// 添加分页限制
|
|
34
70
|
querySql += ` limit ${pageSize} offset ${offset}`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
prettier 配置文件
|
|
3
|
+
更多配置信息:https://prettier.io/docs/en/options.html
|
|
4
|
+
*/
|
|
5
|
+
module.exports = {
|
|
6
|
+
semi: true, // Semicolons 分号,默认需要分号
|
|
7
|
+
tabWidth: 2, // 空格,默认 2,
|
|
8
|
+
useTabs: false,
|
|
9
|
+
singleQuote: true, // 单引号还是双引号,默认为false 双引号
|
|
10
|
+
trailingComma: 'all', // 逗号
|
|
11
|
+
jsxBracketSameLine: false, // 默认为false,Put the > of a multi-line JSX element at the end of the last line instead of being alone on the next line (does not apply to self closing elements).
|
|
12
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* BaseCmpProps 基础组件属性接口
|
|
5
|
+
*/
|
|
6
|
+
export interface BaseCmpProps {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* ScopedComponentType 作用域组件类型接口
|
|
12
|
+
*/
|
|
13
|
+
export interface ScopedComponentType {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* BaseCmp 基础组件类
|
|
19
|
+
* 继承自 React.PureComponent,提供基础组件功能
|
|
20
|
+
*/
|
|
21
|
+
export declare class BaseCmp<
|
|
22
|
+
T extends BaseCmpProps = BaseCmpProps,
|
|
23
|
+
S = any
|
|
24
|
+
> extends React.PureComponent<T, S> implements ScopedComponentType {
|
|
25
|
+
props: Readonly<T> & Readonly<{ children?: React.ReactNode }>;
|
|
26
|
+
state: Readonly<S>;
|
|
27
|
+
setState<K extends keyof S>(
|
|
28
|
+
state:
|
|
29
|
+
| ((prevState: Readonly<S>, props: Readonly<T>) => Pick<S, K> | S | null)
|
|
30
|
+
| (Pick<S, K> | S | null),
|
|
31
|
+
callback?: () => void
|
|
32
|
+
): void;
|
|
33
|
+
forceUpdate(callback?: () => void): void;
|
|
34
|
+
render(): React.ReactNode;
|
|
35
|
+
}
|
|
36
|
+
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
### 目录说明
|
|
2
|
+
- src: 自定义组件源码;
|
|
3
|
+
- src/assets: 存放组件静态资源,比如 css、img等;
|
|
4
|
+
- src/components: 存放自定义组件代码,每个自定义组件以自身名称(cmpType 数值)作为目录进行存放;
|
|
5
|
+
- src/components/xxCmp/index: 自定义组件的内容文件;
|
|
6
|
+
- src/components/xxCmp/model: 自定义组件的模型文件,用于对接页面设计器;
|
|
7
|
+
- neo.config.js: neo-cmp-cli 配置文件。
|
|
8
|
+
|
|
9
|
+
### 组件开发规范
|
|
10
|
+
- 存放在 src/components 目录下的自定义组件,默认 index 为自定义组件源码入口文件,model.[tj]s 为自定义组件的模型文件(对接页面设计器需要);
|
|
11
|
+
- 当 neo.config.js 中的 entry 为空或者不存在时,cli 将根据 src/components 目录下的自定义组件结构生成对应的 entry 配置(可在命令控制台查看生成的 entry 配置);
|
|
12
|
+
- 自定义组件中可用的配置项类型 请见 [当前可用表单项](https://github.com/wibetter/neo-register/blob/master/docs/FormItemType.md);
|
|
13
|
+
- 自定义组件最外层请设置一个唯一的 ClassName(比如 xx-cmpType-container),所有内容样式请放在该 ClassName 中,避免自定义组件样式相互干扰;
|
|
14
|
+
- 默认开启代码规范检测(含样式内容),如需关闭,请调整 neo.config.js 相关配置;
|
|
15
|
+
- 请使用 react 16 版本;
|
|
16
|
+
- 支持在自定义组件中使用 Open API,详细见[使用说明](https://www.npmjs.com/package/neo-open-api)。
|
|
17
|
+
|
|
18
|
+
### 自定义组件注册器使用说明
|
|
19
|
+
- [neo-register 使用说明](https://www.npmjs.com/package/neo-register?activeTab=readme)
|
|
20
|
+
备注:预览、调试(linkDebug)和构建发布时 cli 会自动创建对应的注册文件(含 neo-register 的使用),用户无需关注 neo-register。
|
|
21
|
+
|
|
22
|
+
### 开发说明
|
|
23
|
+
|
|
24
|
+
1. **安装依赖**
|
|
25
|
+
```bash
|
|
26
|
+
$ npm i 或者 yarn
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
2. **linkDebug: 外链调试(在线上页面设计器端预览自定义组件)**
|
|
30
|
+
> linkDebug模式:用于在线上页面设计器中预览和调试自定义组件。
|
|
31
|
+
```bash
|
|
32
|
+
$ npm run linkDebug
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
3. **发布到 NeoCRM 平台**
|
|
36
|
+
> 需要确保 package.json 中的 name 值唯一,version 值不重复。
|
|
37
|
+
```bash
|
|
38
|
+
$ npm run pushCmp
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### OAuth2 登录授权
|
|
42
|
+
使用 `neo push cmp`、`neo pull cmp`、`neo delete cmp` 等命令与 NeoCRM 平台交互时,需要进行授权登录。
|
|
43
|
+
|
|
44
|
+
#### 使用步骤
|
|
45
|
+
|
|
46
|
+
1. **登录 NeoCRM 平台**
|
|
47
|
+
```bash
|
|
48
|
+
neo login
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
执行流程:
|
|
52
|
+
- 自动打开浏览器访问授权页面
|
|
53
|
+
- 在浏览器中输入 NeoCRM 账号密码进行登录(需选择对应的租户)
|
|
54
|
+
- 授权成功后自动跳转回本地(附带 code)
|
|
55
|
+
- cli 端 通过 code 获取 Token,并自动保存到项目的 `.neo-cli/token.json` 文件中
|
|
56
|
+
|
|
57
|
+
2. **登出 NeoCRM 平台**
|
|
58
|
+
```bash
|
|
59
|
+
neo logout
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
功能:清除本地保存的 token 文件,下次使用需要重新登录。
|
|
63
|
+
|
|
64
|
+
#### neo login 选择「自定义环境」时的授权配置示例
|
|
65
|
+
|
|
66
|
+
```javascript
|
|
67
|
+
// neo.config.js
|
|
68
|
+
module.exports = {
|
|
69
|
+
neoConfig: {
|
|
70
|
+
neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
|
|
71
|
+
// 登录授权 URL(用于获取 code)
|
|
72
|
+
loginURL: 'https://login-cd.xiaoshouyi.com/auc/oauth2/auth',
|
|
73
|
+
tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
#### Token 有效期
|
|
79
|
+
|
|
80
|
+
- **access_token**:默认有效期 2 小时
|
|
81
|
+
- **refresh_token**:默认有效期 30 天
|
|
82
|
+
- 系统会在 access_token 过期前 5 分钟自动刷新
|
|
83
|
+
- 如果 refresh_token 也过期,需要重新执行 `neo login`
|
|
84
|
+
|
|
85
|
+
#### 常见问题
|
|
86
|
+
|
|
87
|
+
**Q1: 浏览器无法自动打开怎么办?**
|
|
88
|
+
A: 命令行会输出授权 URL,手动复制到浏览器中打开即可。
|
|
89
|
+
|
|
90
|
+
**Q2: Token 刷新失败怎么办?**
|
|
91
|
+
A: 如果 refresh_token 也过期(默认 30 天),需要重新执行 `neo login`。同时检查网络连接是否正常。
|
|
92
|
+
|
|
93
|
+
**Q3: 授权登录后没有正常跳回 redirect_uri**
|
|
94
|
+
A: 可能被浏览器安装的插件影响,目前已知会影响授权登录的浏览器插件有:Neo UI Extension,请关闭插件后重试。
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### 配置项说明(neo-cmp-cli)
|
|
99
|
+
[请查看neo-cmp-cli](https://www.npmjs.com/package/neo-cmp-cli)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://www.npmjs.com/package/@commitlint/config-conventional\
|
|
3
|
+
*
|
|
4
|
+
* Git提交规范-配置文件
|
|
5
|
+
* Commit message 由Header、Body 和 Footer三个部分组成,其格式如下:
|
|
6
|
+
* <type>(<scope>): <subject>
|
|
7
|
+
* <BLANK LINE>
|
|
8
|
+
* <body>
|
|
9
|
+
* <BLANK LINE>
|
|
10
|
+
* <footer>
|
|
11
|
+
*
|
|
12
|
+
*【备注】
|
|
13
|
+
* type 用于说明 commit 的类别,常用下面 7 个标识:
|
|
14
|
+
* scope 用于说明当前功能点作用于哪个页面或者哪个功能模块;
|
|
15
|
+
* subject 用于简短的描述当前commit,不超过50个字符;
|
|
16
|
+
* body 用于填写对本次 commit 的详细描述,可以分成多行;
|
|
17
|
+
* footer 不兼容变动声明,或者关闭 Issue。
|
|
18
|
+
*
|
|
19
|
+
* 【type类型取值类型】
|
|
20
|
+
* feat:新功能(feature)
|
|
21
|
+
* fix:功能优化
|
|
22
|
+
* bug:修补bug
|
|
23
|
+
* docs:文档(documentation)
|
|
24
|
+
* style:格式(不影响代码运行的变动)
|
|
25
|
+
* refactor:重构(即不是新增功能,也不是修改bug的代码变动)
|
|
26
|
+
* test:增加测试
|
|
27
|
+
* chore:构建过程或辅助工具的变动
|
|
28
|
+
* build:影响构建系统或外部依赖项的更改(示例范围:gulp,broccoli,npm)
|
|
29
|
+
* ci:对 CI 配置文件和脚本的更改(示例范围:Travis,Circle,BrowserStack,SauceLabs)
|
|
30
|
+
* perf:改进性能的代码更改
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
module.exports = {
|
|
35
|
+
extends: ['@commitlint/config-conventional'],
|
|
36
|
+
rules: {
|
|
37
|
+
'type-enum': [
|
|
38
|
+
2,
|
|
39
|
+
'always',
|
|
40
|
+
[
|
|
41
|
+
'feat',
|
|
42
|
+
'fix',
|
|
43
|
+
'bug',
|
|
44
|
+
'docs',
|
|
45
|
+
'style',
|
|
46
|
+
'refactor',
|
|
47
|
+
'test',
|
|
48
|
+
'chore',
|
|
49
|
+
'perf',
|
|
50
|
+
'build',
|
|
51
|
+
'ci',
|
|
52
|
+
],
|
|
53
|
+
],
|
|
54
|
+
'type-empty': [2, 'never'],
|
|
55
|
+
'scope-empty': [1, 'never'],
|
|
56
|
+
'subject-full-stop': [0, 'never'],
|
|
57
|
+
'subject-case': [0, 'never'],
|
|
58
|
+
},
|
|
59
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
5
|
+
// 统一路径解析
|
|
6
|
+
function resolve(dir) {
|
|
7
|
+
return path.resolve(__dirname, dir);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// 包括生产和开发的环境配置信息
|
|
11
|
+
module.exports = {
|
|
12
|
+
settings: {
|
|
13
|
+
enableESLint: false,
|
|
14
|
+
enableESLintFix: false,
|
|
15
|
+
enableStyleLint: false,
|
|
16
|
+
enableStyleLintFix: false
|
|
17
|
+
},
|
|
18
|
+
webpack: {
|
|
19
|
+
target: [
|
|
20
|
+
"web",
|
|
21
|
+
"es5"
|
|
22
|
+
],
|
|
23
|
+
resolve: {
|
|
24
|
+
extensions: [
|
|
25
|
+
".js",
|
|
26
|
+
".jsx",
|
|
27
|
+
".ts",
|
|
28
|
+
".tsx",
|
|
29
|
+
".umd.js",
|
|
30
|
+
".min.js",
|
|
31
|
+
".json"
|
|
32
|
+
],
|
|
33
|
+
alias: {
|
|
34
|
+
"@": resolve("./src"),
|
|
35
|
+
$assets: resolve("./src/assets"),
|
|
36
|
+
$public: resolve("./public"),
|
|
37
|
+
$utils: resolve("./src/utils")
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
sassResources: [
|
|
41
|
+
resolve("./src/assets/css/common.scss"),
|
|
42
|
+
resolve("./src/assets/css/mixin.scss")
|
|
43
|
+
],
|
|
44
|
+
ignoreNodeModules: false
|
|
45
|
+
},
|
|
46
|
+
linkDebug: {},
|
|
47
|
+
neoConfig: {
|
|
48
|
+
neoBaseURL: "https://crm-test.xiaoshouyi.com",
|
|
49
|
+
loginURL: "https://login-test.xiaoshouyi.com/auc/oauth2/auth",
|
|
50
|
+
tokenURL: "https://login-test.xiaoshouyi.com/auc/oauth2/token"
|
|
51
|
+
},
|
|
52
|
+
pushCmp: {}
|
|
53
|
+
};
|