neo-cmp-cli 1.12.11 → 1.13.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/README.md +28 -13
- package/dist/index2.js +1 -1
- package/dist/module/neoInitByCopy.js +1 -1
- package/dist/package.json.js +1 -1
- package/docs/H5/347/253/257 NeoEntityList /344/275/277/347/224/250/350/257/264/346/230/216.md" +293 -0
- package/package.json +1 -1
- package/template/antd-custom-cmp-template/package.json +3 -3
- package/template/asset-manage-template/package.json +1 -1
- package/template/echarts-custom-cmp-template/package.json +3 -3
- package/template/empty-custom-cmp-template/package.json +1 -1
- package/template/map-custom-cmp-template/.prettierrc.js +12 -0
- package/template/map-custom-cmp-template/README.md +99 -0
- package/template/map-custom-cmp-template/commitlint.config.js +59 -0
- package/template/map-custom-cmp-template/neo.config.js +115 -0
- package/template/map-custom-cmp-template/package.json +59 -0
- package/template/map-custom-cmp-template/public/css/base.css +283 -0
- package/template/map-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/map-custom-cmp-template/public/template.html +13 -0
- package/template/map-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/template/map-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/map-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/map-custom-cmp-template/src/assets/img/chart.svg +1 -0
- package/template/map-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/map-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/template/map-custom-cmp-template/src/utils/url.ts +82 -0
- package/template/map-custom-cmp-template/tsconfig.json +68 -0
- package/template/neo-bi-cmps/.prettierrc.js +12 -0
- package/template/neo-bi-cmps/@types/neo-ui-common.d.ts +36 -0
- package/template/neo-bi-cmps/README.md +99 -0
- package/template/neo-bi-cmps/commitlint.config.js +59 -0
- package/template/neo-bi-cmps/neo.config.js +124 -0
- package/template/neo-bi-cmps/package.json +62 -0
- package/template/neo-bi-cmps/public/css/base.css +283 -0
- package/template/neo-bi-cmps/public/scripts/app/bluebird.js +6679 -0
- package/template/neo-bi-cmps/public/template.html +13 -0
- package/template/neo-bi-cmps/src/assets/css/common.scss +127 -0
- package/template/neo-bi-cmps/src/assets/css/mixin.scss +47 -0
- package/template/neo-bi-cmps/src/assets/img/AIBtn.gif +0 -0
- package/template/neo-bi-cmps/src/assets/img/NeoCRM.jpg +0 -0
- package/template/neo-bi-cmps/src/assets/img/aiLogo.png +0 -0
- package/template/neo-bi-cmps/src/assets/img/card-list.svg +1 -0
- package/template/neo-bi-cmps/src/assets/img/contact-form.svg +1 -0
- package/template/neo-bi-cmps/src/assets/img/custom-form.svg +1 -0
- package/template/neo-bi-cmps/src/assets/img/custom-widget.svg +1 -0
- package/template/neo-bi-cmps/src/assets/img/data-list.svg +1 -0
- package/template/neo-bi-cmps/src/assets/img/detail.svg +1 -0
- package/template/neo-bi-cmps/src/assets/img/favicon.png +0 -0
- package/template/neo-bi-cmps/src/assets/img/map.svg +1 -0
- package/template/neo-bi-cmps/src/assets/img/search.svg +1 -0
- package/template/neo-bi-cmps/src/assets/img/table.svg +1 -0
- package/template/neo-bi-cmps/src/components/targetNumber__c/README.md +100 -0
- package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/configSchema.ts +253 -0
- package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/index.scss +76 -0
- package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/index.tsx +148 -0
- package/template/neo-bi-cmps/src/components/targetNumber__c/index.tsx +440 -0
- package/template/neo-bi-cmps/src/components/targetNumber__c/model.ts +128 -0
- package/template/neo-bi-cmps/src/components/targetNumber__c/style.scss +173 -0
- package/template/neo-bi-cmps/src/utils/axiosFetcher.ts +37 -0
- package/template/neo-bi-cmps/src/utils/queryObjectData.ts +76 -0
- package/template/neo-bi-cmps/src/utils/xobjects.ts +162 -0
- package/template/neo-bi-cmps/tsconfig.json +40 -0
- package/template/neo-custom-cmp-template/package.json +3 -3
- package/template/neo-h5-cmps/package.json +2 -2
- package/template/neo-h5-cmps/src/components/entityList__c/index.tsx +2 -2
- package/template/neo-order-cmps/package.json +1 -1
- package/template/neo-web-cmps/package.json +3 -3
- package/template/neo-web-cmps/src/components/entityGrid2__c/index.tsx +16 -4
- package/template/neo-web-cmps/src/components/entityGrid2__c/style.scss +1 -3
- package/template/neo-web-cmps/src/components/entityGrid3__c/index.tsx +1 -1
- package/template/neo-web-cmps/src/components/entityGrid3__c/style.scss +2 -4
- package/template/neo-web-cmps/src/components/entityGrid4__c/index.tsx +8 -6
- package/template/neo-web-cmps/src/components/entityGrid__c/model.ts +2 -1
- 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 +3 -3
- package/template/echarts-custom-cmp-template/src/components/mapWidget__c/README.md +0 -125
- /package/docs/{NeoEntityGrid → Web/347/253/257 NeoEntityGrid }/344/275/277/347/224/250/350/257/264/346/230/216.md" +0 -0
- /package/template/{echarts-custom-cmp-template → map-custom-cmp-template}/src/components/mapWidget__c/index.tsx +0 -0
- /package/template/{echarts-custom-cmp-template → map-custom-cmp-template}/src/components/mapWidget__c/model.ts +0 -0
- /package/template/{echarts-custom-cmp-template → map-custom-cmp-template}/src/components/mapWidget__c/style.scss +0 -0
- /package/template/{echarts-custom-cmp-template/src/components/mapWidget__c/USAGE.md → map-custom-cmp-template/src/components/mapWidget__c//345/234/260/345/233/276/347/273/204/344/273/266/345/277/253/351/200/237/344/275/277/347/224/250/346/214/207/345/215/227.md"} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<html lang="en">
|
|
2
|
+
<head>
|
|
3
|
+
<meta charset="UTF-8">
|
|
4
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
5
|
+
<meta name="format-detection" content="telephone=no"/>
|
|
6
|
+
<meta name="viewport" content="initial-scale=1.0,user-scalable=no,width=device-width,viewport-fit=cover">
|
|
7
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
8
|
+
<title>自定义组件预览页</title>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="root"></div>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/* 公共的自定义函数 */
|
|
2
|
+
|
|
3
|
+
@function px2vw($px, $screen-width: 750) {
|
|
4
|
+
@return ($px / $screen-width) * 100vw;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
@function px2rem($px, $remRate: 100) {
|
|
8
|
+
@return ($px / $remRate) + rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@function px2vmin($px, $screen-width: 750) {
|
|
12
|
+
@return ($px / $screen-width) * 100vmin;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@mixin fillBox {
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* 头部细线 */
|
|
21
|
+
@mixin borderTop {
|
|
22
|
+
content: '';
|
|
23
|
+
position: absolute;
|
|
24
|
+
left: 0;
|
|
25
|
+
right: 0;
|
|
26
|
+
top: 0;
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: 1px;
|
|
29
|
+
background: #ddd;
|
|
30
|
+
transform: scaleY(0.5);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* 底部细线 */
|
|
34
|
+
@mixin borderBtm {
|
|
35
|
+
content: '';
|
|
36
|
+
position: absolute;
|
|
37
|
+
left: 0;
|
|
38
|
+
right: 0;
|
|
39
|
+
bottom: 0;
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 1px;
|
|
42
|
+
background: #ddd;
|
|
43
|
+
transform: scaleY(0.5);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* 统一的内边距 */
|
|
47
|
+
@mixin unifiedPadding($value: 40) {
|
|
48
|
+
padding: 0 px2rem($value) 0 px2rem($value);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* 统一的左内边距 */
|
|
52
|
+
@mixin unifiedLeftPadding($value: 40) {
|
|
53
|
+
padding-left: px2rem($value);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* 统一的右内边距 */
|
|
57
|
+
@mixin unifiedRightPadding($value: 40) {
|
|
58
|
+
padding-right: px2rem($value);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* 统一的底部边框样式 */
|
|
62
|
+
@mixin unifiedBottomBorder {
|
|
63
|
+
border-bottom: 1px solid #ddd;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* 统一的上边框样式 */
|
|
67
|
+
@mixin unifiedTopBorder {
|
|
68
|
+
border-top: 1px solid #ddd;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* 统一的Item高度 */
|
|
72
|
+
@mixin unifiedItemHeight {
|
|
73
|
+
line-height: px2rem(120);
|
|
74
|
+
height: px2rem(120);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* 设置行高样式 */
|
|
78
|
+
@mixin setItemHeight($value: 120) {
|
|
79
|
+
line-height: px2rem($value);
|
|
80
|
+
height: px2rem($value);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* 统一的Item样式 */
|
|
84
|
+
@mixin unifiedItemStyle {
|
|
85
|
+
font-family: PingFangSC-Regular;
|
|
86
|
+
font-size: px2rem(28);
|
|
87
|
+
color: #828282;
|
|
88
|
+
letter-spacing: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* 统一的弹性盒子样式 */
|
|
92
|
+
@mixin unifiedFlexBoxStyle {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-wrap: nowrap;
|
|
95
|
+
justify-content: center;
|
|
96
|
+
align-items: center;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* 统一的Title样式 */
|
|
100
|
+
@mixin unifiedTitleStyle {
|
|
101
|
+
font-family: PingFangSC-Regular;
|
|
102
|
+
font-size: px2rem(40);
|
|
103
|
+
color: #1e1e1e;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* 统一的内容样式 */
|
|
107
|
+
@mixin unifiedContentStyle {
|
|
108
|
+
font-family: PingFangSC-Regular;
|
|
109
|
+
font-size: px2rem(28);
|
|
110
|
+
color: #1e1e1e;
|
|
111
|
+
letter-spacing: 0;
|
|
112
|
+
text-align: right;
|
|
113
|
+
line-height: px2rem(28);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* 底部导航盒子样式 */
|
|
117
|
+
@mixin fixedBottomBox {
|
|
118
|
+
position: fixed;
|
|
119
|
+
left: 0;
|
|
120
|
+
bottom: 0;
|
|
121
|
+
width: 100%;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// 常用的变量
|
|
125
|
+
$background-color: #fafafa;
|
|
126
|
+
$border-color: #f7f7f7;
|
|
127
|
+
$page-padding-top: px2rem(20);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// 通用mixin
|
|
2
|
+
$borderColor: #ddd;
|
|
3
|
+
|
|
4
|
+
// type 为top 或者 bottom
|
|
5
|
+
@mixin borderTopOrBtm($type) {
|
|
6
|
+
&::after {
|
|
7
|
+
content: '';
|
|
8
|
+
position: absolute;
|
|
9
|
+
left: 0;
|
|
10
|
+
right: 0;
|
|
11
|
+
#{$type}: 0;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 1px;
|
|
14
|
+
background: $borderColor;
|
|
15
|
+
transform: scaleY(0.5);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// type为 right 或者 left
|
|
20
|
+
@mixin borderRtOrLt($type) {
|
|
21
|
+
&::after {
|
|
22
|
+
content: '';
|
|
23
|
+
position: absolute;
|
|
24
|
+
top: 0;
|
|
25
|
+
bottom: 0;
|
|
26
|
+
#{$type}: 0;
|
|
27
|
+
height: 100%;
|
|
28
|
+
width: 1px;
|
|
29
|
+
background: $borderColor;
|
|
30
|
+
transform: scaleX(0.5);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//超出1行显示...
|
|
35
|
+
@mixin ellipsis1 {
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
text-overflow: ellipsis;
|
|
38
|
+
white-space: nowrap;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 超出多行显示...
|
|
42
|
+
@mixin ellipsis($num) {
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
display: -webkit-box;
|
|
45
|
+
-webkit-line-clamp: $num;
|
|
46
|
+
-webkit-box-orient: vertical;
|
|
47
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1757492173072" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2395" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M929.295093 873.474968 119.673029 873.474968 63.904067 873.474968 63.904067 817.603677l0-586.341561c0-15.451584 12.484061-27.935645 27.935645-27.935645 15.451584 0 27.935645 12.484061 27.935645 27.935645l0 586.341561 809.622065 0c15.451584 0 27.935645 12.484061 27.935645 27.935645C957.230738 860.990906 944.746677 873.474968 929.295093 873.474968L929.295093 873.474968zM845.590487 761.732387l-55.87129 0c-30.800839 0-55.87129-24.968122-55.87129-55.87129L733.847906 370.940342c0-30.800839 24.968122-55.87129 55.87129-55.87129l55.87129 0c30.800839 0 55.87129 24.968122 55.87129 55.87129l0 335.023084C901.461777 736.764265 876.391326 761.732387 845.590487 761.732387L845.590487 761.732387zM566.438693 761.732387l-55.87129 0c-30.800839 0-55.87129-24.968122-55.87129-55.87129L454.696113 203.4288c0-30.800839 24.968122-55.87129 55.87129-55.87129l55.87129 0c30.800839 0 55.87129 24.968122 55.87129 55.87129l0 502.534626C622.207655 736.764265 597.239532 761.732387 566.438693 761.732387L566.438693 761.732387zM287.184571 761.732387l-55.87129 0c-30.800839 0-55.87129-24.968122-55.87129-55.87129L175.441991 482.580594c0-30.800839 24.968122-55.87129 55.87129-55.87129l55.87129 0c30.800839 0 55.87129 24.968122 55.87129 55.87129l0 223.382832C343.055861 736.764265 318.087739 761.732387 287.184571 761.732387L287.184571 761.732387z" p-id="2396" fill="#0764f5"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1756957113315" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5395" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M288 768v115.2c0 25.6 19.2 44.8 44.8 44.8h556.8c25.6 0 44.8-19.2 44.8-44.8v-198.4s0-6.4-6.4-6.4h-83.2c-38.4 0-70.4-32-70.4-70.4 0-38.4 32-70.4 70.4-70.4h83.2s6.4 0 6.4-6.4V332.8c0-25.6-19.2-44.8-44.8-44.8H768C768 198.4 697.6 128 608 128S448 198.4 448 288H332.8c-25.6 0-44.8 19.2-44.8 44.8V448C198.4 448 128 518.4 128 608S198.4 768 288 768z m0-249.6h70.4V358.4h160V288c0-51.2 38.4-89.6 89.6-89.6 51.2 0 89.6 38.4 89.6 89.6v70.4h160v108.8h-19.2c-76.8 0-140.8 64-140.8 140.8 0 76.8 64 140.8 140.8 140.8h19.2v108.8H358.4v-160H288c-51.2 0-89.6-38.4-89.6-89.6 0-51.2 38.4-89.6 89.6-89.6z" p-id="5396" fill="#0764f5"></path></svg>
|
|
Binary file
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取URL参数
|
|
3
|
+
* @returns
|
|
4
|
+
*/
|
|
5
|
+
export function getUrlParams() {
|
|
6
|
+
const urlParams: { [key: string]: string } = {};
|
|
7
|
+
let url = window.location.href;
|
|
8
|
+
if (url.indexOf('?') !== -1) {
|
|
9
|
+
url = url.substring(url.indexOf('?') + 1, url.length);
|
|
10
|
+
const urlArr = url.split('&');
|
|
11
|
+
for (let i = 0, size = urlArr.length; i < size; i++) {
|
|
12
|
+
const urlArrItem = urlArr[i].split('=');
|
|
13
|
+
// 对参数值进行 URL 解码,避免中文字符串乱码
|
|
14
|
+
urlParams[urlArrItem[0]] = urlArrItem[1]
|
|
15
|
+
? decodeURIComponent(urlArrItem[1])
|
|
16
|
+
: '';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return urlParams;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 从URL参数中提取指定的字段数值
|
|
24
|
+
* @param paramName 参数名称
|
|
25
|
+
* @param defaultValue 默认值
|
|
26
|
+
* @returns 参数值或默认值
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // 从当前页面URL提取debug参数
|
|
30
|
+
* const debug = getUrlParam('debug', false)
|
|
31
|
+
*
|
|
32
|
+
* // 提取数字参数
|
|
33
|
+
* const page = getUrlParam('page', 1)
|
|
34
|
+
*
|
|
35
|
+
* // 提取字符串参数
|
|
36
|
+
* const mode = getUrlParam('mode', 'production')
|
|
37
|
+
*/
|
|
38
|
+
export function getUrlParam(paramName: string, defaultValue: any = null): any {
|
|
39
|
+
const urlParams = getUrlParams();
|
|
40
|
+
const paramValue = urlParams[paramName];
|
|
41
|
+
|
|
42
|
+
// 尝试转换数据类型
|
|
43
|
+
if (paramValue === 'true') return true;
|
|
44
|
+
if (paramValue === 'false') return false;
|
|
45
|
+
if (paramValue === 'null') return null;
|
|
46
|
+
if (paramValue === 'undefined') return undefined;
|
|
47
|
+
|
|
48
|
+
// 尝试转换为数字
|
|
49
|
+
const numValue = Number(paramValue);
|
|
50
|
+
if (!isNaN(numValue) && isFinite(numValue)) {
|
|
51
|
+
return numValue;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return paramValue ?? defaultValue;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 从URL参数中提取多个字段数值
|
|
59
|
+
* @param params 参数配置对象,键为参数名,值为默认值
|
|
60
|
+
* @param url 可选的URL字符串,默认使用当前页面URL
|
|
61
|
+
* @returns 包含所有参数值的对象
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* const params = getUrlParams({
|
|
65
|
+
* debug: false,
|
|
66
|
+
* mode: 'production',
|
|
67
|
+
* page: 1,
|
|
68
|
+
* theme: 'light'
|
|
69
|
+
* })
|
|
70
|
+
*/
|
|
71
|
+
export function getUrlParamsByKeys(
|
|
72
|
+
params: Record<string, any>,
|
|
73
|
+
url?: string,
|
|
74
|
+
): Record<string, any> {
|
|
75
|
+
const result: Record<string, any> = {};
|
|
76
|
+
|
|
77
|
+
for (const [paramName, defaultValue] of Object.entries(params)) {
|
|
78
|
+
result[paramName] = getUrlParam(paramName, defaultValue);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"experimentalDecorators": true,
|
|
4
|
+
/* Basic Options */
|
|
5
|
+
"target": "esnext",
|
|
6
|
+
/* 指定编译之后的版本: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
|
|
7
|
+
"module": "esnext" /* 指定要使用的模板标准: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
|
|
8
|
+
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
9
|
+
"allowJs": false /* 指定是否允许编译JS文件,默认false,即不编译JS文件. */,
|
|
10
|
+
// "checkJs": true, /* 指定是否检查和报告JS文件中的错误,默认false */
|
|
11
|
+
"jsx": "preserve" /* 保留 JSX 交由 Babel(含 data-scope 插件)处理,确保作用域属性可注入 */,
|
|
12
|
+
"declaration": false /* 指定是否在编译的时候生成相的d.ts声明文件 */,
|
|
13
|
+
// "declarationMap": true, /* 指定编译时是否生成.map文件 */
|
|
14
|
+
// "sourceMap": true, /* 指定编译时是否生成.map文件 */
|
|
15
|
+
// "outFile": "./", /* 指定输出文件合并为一个文件 */
|
|
16
|
+
// "outDir": "dist", /* 指定输出文件夹,值为一个文件夹路径字符串,输出的文件都将放置在这个文件夹*/
|
|
17
|
+
// "rootDir": "src", /* 指定编译文件的根目录,编译器会在根目录查找入口文件 */
|
|
18
|
+
// "composite": true, /* 是否编译构建引用项目 */
|
|
19
|
+
// "removeComments": true, /* 指定是否将编译后的文件注释删掉,设为true的话即删除注释,默认为false */
|
|
20
|
+
"noEmit": false /* 不生成编译文件 */,
|
|
21
|
+
"importHelpers": true /* 指定是否引入tslib里的复制工具函数,默认为false */,
|
|
22
|
+
// "downlevelIteration": true, /* 当target为"ES5"或"ES3"时,为"for-of" "spread"和"destructuring"中的迭代器提供完全支持 */
|
|
23
|
+
"isolatedModules": false /* 指定是否将每个文件作为单独的模块,默认为true */,
|
|
24
|
+
|
|
25
|
+
/* Strict Type-Checking Options */
|
|
26
|
+
"strict": false /* 指定是否启动所有类型检查 */,
|
|
27
|
+
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
|
|
28
|
+
"strictNullChecks": true /* Enable strict null checks. */,
|
|
29
|
+
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
30
|
+
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
31
|
+
"noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
|
|
32
|
+
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
33
|
+
|
|
34
|
+
/* Additional Checks */
|
|
35
|
+
"noUnusedLocals": false /* Report errors on unused locals. */,
|
|
36
|
+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
37
|
+
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
|
|
38
|
+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
39
|
+
|
|
40
|
+
/* Module Resolution Options */
|
|
41
|
+
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
|
|
42
|
+
"baseUrl": "./" /* Base directory to resolve non-absolute module names. */,
|
|
43
|
+
"paths": {
|
|
44
|
+
"@": ["./src"]
|
|
45
|
+
} /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
|
|
46
|
+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
47
|
+
/* 指定声明文件或文件夹的路径列表,如果指定了此项,则只有在这里列出的声明文件才会被加载 */
|
|
48
|
+
"typeRoots": ["./@types", "./node_modules/@types"],
|
|
49
|
+
// "types": [], /* 指定需要包含的模块,只有在这里列出的模块的声明文件才会被加载 */
|
|
50
|
+
"allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
|
|
51
|
+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
|
52
|
+
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
53
|
+
|
|
54
|
+
/* Source Map Options */
|
|
55
|
+
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
56
|
+
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
57
|
+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
58
|
+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
59
|
+
|
|
60
|
+
/* Experimental Options */
|
|
61
|
+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
62
|
+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
63
|
+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
|
64
|
+
// "suppressImplicitAnyIndexErrors": true /* Suppress --noImplicitAny errors for indexing objects lacking index signatures. See issue #1232 for more details. */
|
|
65
|
+
},
|
|
66
|
+
"include": ["src", "test"],
|
|
67
|
+
"exclude": ["node_modules"]
|
|
68
|
+
}
|
|
@@ -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
|
+
};
|