neo-cmp-cli 1.8.3 → 1.8.6

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 (189) hide show
  1. package/package.json +3 -3
  2. package/src/utils/cmpUtils/createCmpByTemplate.js +1 -1
  3. package/src/utils/projectUtils/createCmpProjectByTemplate.js +1 -1
  4. package/template/antd-custom-cmp-template/.prettierrc.js +12 -0
  5. package/template/antd-custom-cmp-template/README.md +153 -0
  6. package/template/antd-custom-cmp-template/commitlint.config.js +59 -0
  7. package/template/antd-custom-cmp-template/neo.config.js +144 -0
  8. package/template/antd-custom-cmp-template/package.json +60 -0
  9. package/template/antd-custom-cmp-template/public/css/base.css +283 -0
  10. package/template/antd-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  11. package/template/antd-custom-cmp-template/public/template.html +13 -0
  12. package/template/antd-custom-cmp-template/src/assets/css/common.scss +127 -0
  13. package/template/antd-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  14. package/template/antd-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  15. package/template/antd-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
  16. package/template/antd-custom-cmp-template/src/assets/img/favicon.png +0 -0
  17. package/template/antd-custom-cmp-template/src/components/dataDashboard/README.md +39 -0
  18. package/template/antd-custom-cmp-template/src/components/dataDashboard/index.tsx +462 -0
  19. package/template/antd-custom-cmp-template/src/components/dataDashboard/model.ts +75 -0
  20. package/template/antd-custom-cmp-template/src/components/dataDashboard/style.scss +1667 -0
  21. package/template/antd-custom-cmp-template/src/components/infoCard/index.tsx +87 -0
  22. package/template/antd-custom-cmp-template/src/components/infoCard/model.ts +80 -0
  23. package/template/antd-custom-cmp-template/src/components/infoCard/style.scss +105 -0
  24. package/template/antd-custom-cmp-template/tsconfig.json +68 -0
  25. package/template/develop/neo-custom-cmp-template/.prettierrc.js +12 -0
  26. package/template/develop/neo-custom-cmp-template/README.md +48 -0
  27. package/template/develop/neo-custom-cmp-template/commitlint.config.js +59 -0
  28. package/template/develop/neo-custom-cmp-template/docs/README.md +13 -0
  29. package/template/develop/neo-custom-cmp-template/neo.config.js +121 -0
  30. package/template/develop/neo-custom-cmp-template/package.json +63 -0
  31. package/template/develop/neo-custom-cmp-template/public/css/base.css +283 -0
  32. package/template/develop/neo-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  33. package/template/develop/neo-custom-cmp-template/public/template.html +13 -0
  34. package/template/develop/neo-custom-cmp-template/src/assets/css/common.scss +127 -0
  35. package/template/develop/neo-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  36. package/template/develop/neo-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  37. package/template/develop/neo-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
  38. package/template/develop/neo-custom-cmp-template/src/assets/img/favicon.png +0 -0
  39. package/template/develop/neo-custom-cmp-template/src/assets/img/table.svg +1 -0
  40. package/template/develop/neo-custom-cmp-template/src/components/contactCardList/README.md +65 -0
  41. package/template/develop/neo-custom-cmp-template/src/components/contactCardList/index.tsx +180 -0
  42. package/template/develop/neo-custom-cmp-template/src/components/contactCardList/model.ts +50 -0
  43. package/template/develop/neo-custom-cmp-template/src/components/contactCardList/style.scss +260 -0
  44. package/template/develop/neo-custom-cmp-template/src/components/contactForm/README.md +94 -0
  45. package/template/develop/neo-custom-cmp-template/src/components/contactForm/index.tsx +251 -0
  46. package/template/develop/neo-custom-cmp-template/src/components/contactForm/model.ts +56 -0
  47. package/template/develop/neo-custom-cmp-template/src/components/contactForm/style.scss +120 -0
  48. package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/README.md +115 -0
  49. package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/index.tsx +304 -0
  50. package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/model.ts +87 -0
  51. package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/style.scss +127 -0
  52. package/template/develop/neo-custom-cmp-template/src/utils/axiosFetcher.ts +29 -0
  53. package/template/develop/neo-custom-cmp-template/src/utils/queryObjectData.ts +39 -0
  54. package/template/develop/neo-custom-cmp-template/src/utils/xobjects.ts +203 -0
  55. package/template/develop/neo-custom-cmp-template/tsconfig.json +68 -0
  56. package/template/echarts-custom-cmp-template/.prettierrc.js +12 -0
  57. package/template/echarts-custom-cmp-template/README.md +198 -0
  58. package/template/echarts-custom-cmp-template/commitlint.config.js +59 -0
  59. package/template/echarts-custom-cmp-template/neo.config.js +140 -0
  60. package/template/echarts-custom-cmp-template/package.json +61 -0
  61. package/template/echarts-custom-cmp-template/public/css/base.css +283 -0
  62. package/template/echarts-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  63. package/template/echarts-custom-cmp-template/public/template.html +13 -0
  64. package/template/echarts-custom-cmp-template/src/assets/css/common.scss +127 -0
  65. package/template/echarts-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  66. package/template/echarts-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  67. package/template/echarts-custom-cmp-template/src/assets/img/chart.svg +1 -0
  68. package/template/echarts-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
  69. package/template/echarts-custom-cmp-template/src/assets/img/favicon.png +0 -0
  70. package/template/echarts-custom-cmp-template/src/components/chartWidget/README.md +186 -0
  71. package/template/echarts-custom-cmp-template/src/components/chartWidget/index.tsx +724 -0
  72. package/template/echarts-custom-cmp-template/src/components/chartWidget/model.ts +151 -0
  73. package/template/echarts-custom-cmp-template/src/components/chartWidget/style.scss +209 -0
  74. package/template/echarts-custom-cmp-template/src/components/mapWidget/README.md +125 -0
  75. package/template/echarts-custom-cmp-template/src/components/mapWidget/USAGE.md +190 -0
  76. package/template/echarts-custom-cmp-template/src/components/mapWidget/index.tsx +385 -0
  77. package/template/echarts-custom-cmp-template/src/components/mapWidget/model.ts +107 -0
  78. package/template/echarts-custom-cmp-template/src/components/mapWidget/style.scss +192 -0
  79. package/template/echarts-custom-cmp-template/src/utils/url.ts +82 -0
  80. package/template/echarts-custom-cmp-template/tsconfig.json +68 -0
  81. package/template/empty-cmp/index.tsx +58 -0
  82. package/template/empty-cmp/model.ts +79 -0
  83. package/template/empty-cmp/style.scss +72 -0
  84. package/template/empty-custom-cmp-template/.prettierrc.js +12 -0
  85. package/template/empty-custom-cmp-template/README.md +154 -0
  86. package/template/empty-custom-cmp-template/commitlint.config.js +59 -0
  87. package/template/empty-custom-cmp-template/neo.config.js +138 -0
  88. package/template/empty-custom-cmp-template/package.json +58 -0
  89. package/template/empty-custom-cmp-template/public/css/base.css +283 -0
  90. package/template/empty-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  91. package/template/empty-custom-cmp-template/public/template.html +13 -0
  92. package/template/empty-custom-cmp-template/src/assets/css/common.scss +127 -0
  93. package/template/empty-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  94. package/template/empty-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  95. package/template/empty-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
  96. package/template/empty-custom-cmp-template/src/assets/img/favicon.png +0 -0
  97. package/template/empty-custom-cmp-template/src/assets/img/map.svg +1 -0
  98. package/template/empty-custom-cmp-template/src/components/README.md +3 -0
  99. package/template/empty-custom-cmp-template/tsconfig.json +68 -0
  100. package/template/neo-custom-cmp-template/.prettierrc.js +12 -0
  101. package/template/neo-custom-cmp-template/README.md +155 -0
  102. package/template/neo-custom-cmp-template/commitlint.config.js +59 -0
  103. package/template/neo-custom-cmp-template/docs/README.md +244 -0
  104. package/template/neo-custom-cmp-template/neo.config.js +140 -0
  105. package/template/neo-custom-cmp-template/package.json +66 -0
  106. package/template/neo-custom-cmp-template/public/css/base.css +283 -0
  107. package/template/neo-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  108. package/template/neo-custom-cmp-template/public/template.html +13 -0
  109. package/template/neo-custom-cmp-template/src/assets/css/common.scss +127 -0
  110. package/template/neo-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  111. package/template/neo-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  112. package/template/neo-custom-cmp-template/src/assets/img/card-list.svg +1 -0
  113. package/template/neo-custom-cmp-template/src/assets/img/contact-form.svg +1 -0
  114. package/template/neo-custom-cmp-template/src/assets/img/custom-form.svg +1 -0
  115. package/template/neo-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
  116. package/template/neo-custom-cmp-template/src/assets/img/data-list.svg +1 -0
  117. package/template/neo-custom-cmp-template/src/assets/img/detail.svg +1 -0
  118. package/template/neo-custom-cmp-template/src/assets/img/table.svg +1 -0
  119. package/template/neo-custom-cmp-template/src/components/entityCardList/README.md +61 -0
  120. package/template/neo-custom-cmp-template/src/components/entityCardList/index.tsx +202 -0
  121. package/template/neo-custom-cmp-template/src/components/entityCardList/model.ts +74 -0
  122. package/template/neo-custom-cmp-template/src/components/entityCardList/style.scss +260 -0
  123. package/template/neo-custom-cmp-template/src/components/entityDetail/README.md +176 -0
  124. package/template/neo-custom-cmp-template/src/components/entityDetail/index.tsx +334 -0
  125. package/template/neo-custom-cmp-template/src/components/entityDetail/model.ts +123 -0
  126. package/template/neo-custom-cmp-template/src/components/entityDetail/style.scss +292 -0
  127. package/template/neo-custom-cmp-template/src/components/entityForm/README.md +176 -0
  128. package/template/neo-custom-cmp-template/src/components/entityForm/index.tsx +615 -0
  129. package/template/neo-custom-cmp-template/src/components/entityForm/model.ts +107 -0
  130. package/template/neo-custom-cmp-template/src/components/entityForm/style.scss +370 -0
  131. package/template/neo-custom-cmp-template/src/components/entityTable/README.md +92 -0
  132. package/template/neo-custom-cmp-template/src/components/entityTable/index.tsx +784 -0
  133. package/template/neo-custom-cmp-template/src/components/entityTable/model.ts +134 -0
  134. package/template/neo-custom-cmp-template/src/components/entityTable/style.scss +304 -0
  135. package/template/neo-custom-cmp-template/src/utils/axiosFetcher.ts +37 -0
  136. package/template/neo-custom-cmp-template/src/utils/queryObjectData.ts +76 -0
  137. package/template/neo-custom-cmp-template/src/utils/xobjects.ts +162 -0
  138. package/template/neo-custom-cmp-template/tsconfig.json +49 -0
  139. package/template/react-custom-cmp-template/.prettierrc.js +12 -0
  140. package/template/react-custom-cmp-template/README.md +154 -0
  141. package/template/react-custom-cmp-template/commitlint.config.js +59 -0
  142. package/template/react-custom-cmp-template/neo.config.js +137 -0
  143. package/template/react-custom-cmp-template/package.json +57 -0
  144. package/template/react-custom-cmp-template/public/css/base.css +283 -0
  145. package/template/react-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  146. package/template/react-custom-cmp-template/public/template.html +13 -0
  147. package/template/react-custom-cmp-template/src/assets/css/common.scss +127 -0
  148. package/template/react-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  149. package/template/react-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  150. package/template/react-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
  151. package/template/react-custom-cmp-template/src/assets/img/favicon.png +0 -0
  152. package/template/react-custom-cmp-template/src/components/infoCard/index.jsx +45 -0
  153. package/template/react-custom-cmp-template/src/components/infoCard/model.js +81 -0
  154. package/template/react-custom-cmp-template/src/components/infoCard/style.scss +67 -0
  155. package/template/react-ts-custom-cmp-template/.prettierrc.js +12 -0
  156. package/template/react-ts-custom-cmp-template/README.md +154 -0
  157. package/template/react-ts-custom-cmp-template/commitlint.config.js +59 -0
  158. package/template/react-ts-custom-cmp-template/neo.config.js +138 -0
  159. package/template/react-ts-custom-cmp-template/package.json +59 -0
  160. package/template/react-ts-custom-cmp-template/public/css/base.css +283 -0
  161. package/template/react-ts-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  162. package/template/react-ts-custom-cmp-template/public/template.html +13 -0
  163. package/template/react-ts-custom-cmp-template/src/assets/css/common.scss +127 -0
  164. package/template/react-ts-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  165. package/template/react-ts-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  166. package/template/react-ts-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
  167. package/template/react-ts-custom-cmp-template/src/assets/img/favicon.png +0 -0
  168. package/template/react-ts-custom-cmp-template/src/assets/img/map.svg +1 -0
  169. package/template/react-ts-custom-cmp-template/src/components/listWidget/README.md +2 -0
  170. package/template/react-ts-custom-cmp-template/src/components/listWidget/index.tsx +208 -0
  171. package/template/react-ts-custom-cmp-template/src/components/listWidget/model.ts +92 -0
  172. package/template/react-ts-custom-cmp-template/src/components/listWidget/style.scss +350 -0
  173. package/template/react-ts-custom-cmp-template/tsconfig.json +68 -0
  174. package/template/vue2-custom-cmp-template/.prettierrc.js +12 -0
  175. package/template/vue2-custom-cmp-template/README.md +154 -0
  176. package/template/vue2-custom-cmp-template/commitlint.config.js +59 -0
  177. package/template/vue2-custom-cmp-template/neo.config.js +146 -0
  178. package/template/vue2-custom-cmp-template/package.json +59 -0
  179. package/template/vue2-custom-cmp-template/public/css/base.css +283 -0
  180. package/template/vue2-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  181. package/template/vue2-custom-cmp-template/public/template.html +13 -0
  182. package/template/vue2-custom-cmp-template/src/assets/css/common.scss +126 -0
  183. package/template/vue2-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  184. package/template/vue2-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  185. package/template/vue2-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
  186. package/template/vue2-custom-cmp-template/src/assets/img/favicon.png +0 -0
  187. package/template/vue2-custom-cmp-template/src/components/vueInfoCard/index.vue +131 -0
  188. package/template/vue2-custom-cmp-template/src/components/vueInfoCard/model.js +81 -0
  189. package/test/deprecate-versions.js +1 -1
@@ -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": "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. */,
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,58 @@
1
+ import * as React from 'react';
2
+ import './style.scss'; // 组件内容样式
3
+
4
+ interface CustomCmpProps {
5
+ title: string;
6
+ backgroundImage: string;
7
+ imgCount: number;
8
+ commentCount: number;
9
+ data?: any;
10
+ }
11
+
12
+ export default class CustomCmp extends React.PureComponent<CustomCmpProps> {
13
+ constructor(props: CustomCmpProps) {
14
+ super(props);
15
+ this.agreeDataFormat = this.agreeDataFormat.bind(this);
16
+ }
17
+
18
+ agreeDataFormat(agreeData: number) {
19
+ if (agreeData && agreeData <= 9999) {
20
+ return agreeData;
21
+ }
22
+ if (agreeData && agreeData > 9999) {
23
+ return `${Math.floor(agreeData / 1000) / 10}w`;
24
+ }
25
+ return '';
26
+ }
27
+
28
+ render() {
29
+ const { title, backgroundImage, imgCount, commentCount } = this.props;
30
+ console.log('当前自定义组件:', this.props, this);
31
+
32
+ const curBackgroundImage =
33
+ backgroundImage || 'https://neo-widgets.bj.bcebos.com/NeoCRM.jpg';
34
+ return (
35
+ <div className="custom-cmp-container">
36
+ <div className="news-title">
37
+ {title ||
38
+ '营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。'}
39
+ </div>
40
+ <div className="item-imgbox">
41
+ <div
42
+ className="news-img"
43
+ style={{ backgroundImage: `url(${curBackgroundImage})` }}
44
+ ></div>
45
+ {imgCount > 0 && <div className="img-count">{imgCount}</div>}
46
+ </div>
47
+ <div className="news-info">
48
+ <div className="left media-mark">NeoCRM · 低代码平台</div>
49
+ {commentCount && commentCount > 0 && (
50
+ <div className="cmt-num right">
51
+ {this.agreeDataFormat(commentCount)}评
52
+ </div>
53
+ )}
54
+ </div>
55
+ </div>
56
+ );
57
+ }
58
+ }
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @file 自定义组件对接编辑器的描述文件
3
+ */
4
+ export class CmpModel {
5
+ /**
6
+ * cmpType 为自定义组件名称,用于标识组件的唯一性
7
+ * 在构建时根据当前组件目录名称自动生成
8
+ */
9
+ // cmpType: string = 'xx-custom-cmp';
10
+
11
+ // 组件名称,用于设置在编辑器左侧组件面板中展示的名称
12
+ label: string = 'xx组件';
13
+
14
+ // 组件描述,用于设置在编辑器左侧组件面板中展示的描述
15
+ description: string = 'xx组件详细描述';
16
+
17
+ // 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
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'];
33
+
34
+ // 组件图标,用于设置在编辑器左侧组件面板中展示的图标
35
+ iconSrc: string = 'https://neo-widgets.bj.bcebos.com/custom-widget.svg';
36
+
37
+ // 初次插入页面的默认属性数据
38
+ defaultComProps = {
39
+ title:
40
+ '营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。',
41
+ label: '信息卡片',
42
+ backgroundImage: 'https://neo-widgets.bj.bcebos.com/NeoCRM.jpg',
43
+ imgCount: 3,
44
+ commentCount: 2025,
45
+ };
46
+
47
+ /**
48
+ * 组件面板配置,用于生成编辑器右侧属性配置面板内容
49
+ */
50
+ propsSchema = [
51
+ {
52
+ type: 'textarea',
53
+ name: 'title',
54
+ label: '卡片title',
55
+ value:
56
+ '营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。',
57
+ },
58
+ {
59
+ type: 'text',
60
+ name: 'backgroundImage',
61
+ label: '展示图片',
62
+ value: 'https://neo-widgets.bj.bcebos.com/NeoCRM.jpg',
63
+ },
64
+ {
65
+ type: 'number',
66
+ name: 'imgCount',
67
+ label: '图片数量',
68
+ value: 3,
69
+ },
70
+ {
71
+ type: 'number',
72
+ name: 'commentCount',
73
+ label: '评论数',
74
+ value: 2025,
75
+ },
76
+ ];
77
+ }
78
+
79
+ export default CmpModel;
@@ -0,0 +1,72 @@
1
+ :root {
2
+ --padding-bottom: 12px;
3
+ }
4
+
5
+ .custom-cmp-container {
6
+ position: relative;
7
+ box-sizing: border-box;
8
+
9
+ /* border-bottom: 1px solid #ececec; */
10
+ margin: 6px 12px;
11
+ padding: 6px var(--padding-bottom);
12
+ background-color: #fff;
13
+
14
+ .news-title {
15
+ padding: 6px 0;
16
+ font-family: PingFangSC-Regular;
17
+ font-size: 16px;
18
+ line-height: 22px;
19
+ color: #5f5e5e;
20
+ }
21
+
22
+ .item-imgbox {
23
+ position: relative;
24
+ height: 395px;
25
+ background: #f0f0f0;
26
+ cursor: pointer;
27
+ box-sizing: border-box;
28
+ text-align: center;
29
+ overflow: hidden;
30
+
31
+ .news-img {
32
+ width: 100%;
33
+ height: 100%;
34
+ box-sizing: border-box;
35
+ background-size: contain;
36
+ }
37
+
38
+ .img-count {
39
+ position: absolute;
40
+ top: 0;
41
+ right: 0;
42
+ padding: 6px 8px;
43
+ color: #fff;
44
+ min-width: 60px;
45
+ text-align: center;
46
+ line-height: 1.2;
47
+ background: rgb(0 0 0 / 40%);
48
+ font-size: 25px;
49
+ box-sizing: border-box;
50
+ overflow: hidden;
51
+ }
52
+ }
53
+
54
+ .news-info {
55
+ font-family: PingFangSC-Light;
56
+ height: 28px;
57
+ box-sizing: border-box;
58
+ display: flex;
59
+ justify-content: space-between;
60
+ align-items: center;
61
+ }
62
+
63
+ .media-mark,
64
+ .cmt-num {
65
+ display: inline-block;
66
+ height: 28px;
67
+ line-height: 28px;
68
+ font-family: PingFangSC-Light;
69
+ font-size: 18px;
70
+ color: #828282;
71
+ }
72
+ }
@@ -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,154 @@
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 为自定义组件源码入口文件,register.[tj]s 为注册 自定义组件的脚本文件,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
+
17
+ ### 自定义组件注册器使用说明
18
+ - [neo-register 使用说明](https://www.npmjs.com/package/neo-register?activeTab=readme)
19
+ 备注:预览、调试(linkDebug)和构建发布时 cli 会自动创建对应的注册文件(含 neo-register 的使用),用户无需关注 neo-register。
20
+
21
+ ### 开发说明
22
+
23
+ 1. **安装依赖**
24
+ ```bash
25
+ $ npm i 或者 yarn
26
+ ```
27
+
28
+ 2. **preview: 组件预览模式(带热更新)**
29
+ > preview模式:用于预览自定义组件内容。
30
+ ```bash
31
+ $ npm run preview
32
+ ```
33
+
34
+ 3. **linkDebug: 外链调试(在线上页面设计器端预览自定义组件)**
35
+ > linkDebug模式:用于在线上页面设计器中预览和调试自定义组件。
36
+ ```bash
37
+ $ npm run linkDebug
38
+ ```
39
+
40
+ 4. **发布到 NeoCRM 中**
41
+ > 需要确保 package.json 中的 name 值唯一,version 值不重复。
42
+ ```bash
43
+ $ npm run pushCmp
44
+ ```
45
+
46
+
47
+ ### 🔐 授权配置
48
+
49
+ 使用 `neo push cmp`、`neo pull cmp`、`neo delete cmp` 等命令与 NeoCRM 平台交互时,需要配置授权信息。
50
+
51
+ #### 方式一:OAuth2 登录授权(推荐)
52
+
53
+ OAuth2 授权码模式更加安全可靠,无需用户配置账户名和密码。
54
+
55
+ ##### 使用步骤
56
+
57
+ 1. **登录 NeoCRM 平台**
58
+ ```bash
59
+ neo login
60
+ ```
61
+
62
+ 执行流程:
63
+ - 自动打开浏览器访问授权页面
64
+ - 在浏览器中输入 NeoCRM 账号密码进行登录(需选择对应的租户)
65
+ - 授权成功后自动跳转回本地(附带 code)
66
+ - cli 端 通过 code 获取 Token,并自动保存到项目的 `.neo-cli/token.json` 文件中
67
+
68
+ 2. **登出 NeoCRM 平台**
69
+ ```bash
70
+ neo logout
71
+ ```
72
+
73
+ 功能:清除本地保存的 token 文件,下次使用需要重新登录。
74
+
75
+ ##### 配置示例
76
+
77
+ ```javascript
78
+ // neo.config.js
79
+ module.exports = {
80
+ neoConfig: {
81
+ neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
82
+ // 登录授权 URL(用于获取 code)
83
+ loginURL: 'https://login-cd.xiaoshouyi.com/auc/oauth2/auth',
84
+ tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址
85
+ },
86
+ }
87
+ ```
88
+
89
+ ##### Token 有效期
90
+
91
+ - **access_token**:默认有效期 2 小时
92
+ - **refresh_token**:默认有效期 30 天
93
+ - 系统会在 access_token 过期前 5 分钟自动刷新
94
+ - 如果 refresh_token 也过期,需要重新执行 `neo login`
95
+
96
+ ##### 常见问题
97
+
98
+ **Q1: 浏览器无法自动打开怎么办?**
99
+ A: 命令行会输出授权 URL,手动复制到浏览器中打开即可。
100
+
101
+ **Q2: Token 刷新失败怎么办?**
102
+ A: 如果 refresh_token 也过期(默认 30 天),需要重新执行 `neo login`。同时检查网络连接是否正常。
103
+
104
+ **Q3: 授权登录后没有正常跳回 redirect_uri**
105
+ A: 可能被浏览器安装的插件影响,目前已知会影响授权登录的浏览器插件有:Neo UI Extension,请关闭插件后重试。
106
+
107
+ #### 方式二:密码授权配置
108
+
109
+ 在项目根目录的 `neo.config.js` 文件中添加 NeoCRM 平台授权配置:
110
+
111
+ ```javascript
112
+ module.exports = {
113
+ neoConfig: {
114
+ neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
115
+ tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址
116
+ // NeoCRM 授权配置
117
+ auth: {
118
+ client_id: 'xx', // 客户端 ID,从创建连接器的客户端信息中获取(Client_Id)
119
+ client_secret: 'xxx', // 客户端秘钥,从创建连接器的客户端信息中获取(Client_Secret)
120
+ username: 'xx', // 用户在销售易系统中的用户名
121
+ /**
122
+ * password 为 用户在销售易系统中的账号密码加上 8 位安全令牌。
123
+ * 例如,用户密码为 123456,安全令牌为 ABCDEFGH,则 password 的值应为 123456ABCDEFGH。
124
+ */
125
+ password: 'xx xx' // 用户账户密码 + 8 位安全令牌
126
+ },
127
+ },
128
+ }
129
+ ```
130
+
131
+ ##### 授权配置获取方式
132
+
133
+ 1. **客户端 ID 和客户端秘钥**:需通过创建连接器获取
134
+ - 访问 [销售易文档中心](https://doc.xiaoshouyi.com) / 创建连接器
135
+ - 创建连接器后,从客户端信息中获取 `Client_Id` 和 `Client_Secret`
136
+
137
+ 2. **安全令牌**:如何获取安全令牌
138
+ - 访问 [销售易文档中心](https://doc.xiaoshouyi.com) / OAuth安全认证 / 密码模式 / 获取令牌
139
+ - 按照文档说明获取 8 位安全令牌
140
+ - `password` 字段 = 用户账户密码 + 8 位安全令牌(直接拼接,无空格或分隔符)
141
+
142
+ #### OAuth2 模式 vs 密码模式
143
+
144
+ | 特性 | OAuth2 授权码模式 | 密码模式 |
145
+ |------|------------------|---------|
146
+ | 安全性 | ✅ 高(无需在配置文件中存储密码) | ⚠️ 较低(需要配置密码和安全令牌) |
147
+ | Token 刷新 | ✅ 自动刷新 | ✅ 自动刷新 |
148
+ | 有效期 | 2 小时(可自动刷新) | 永不过期 |
149
+ | 推荐程度 | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ |
150
+
151
+ ---
152
+
153
+ ### 配置项说明(neo-cmp-cli)
154
+ [请查看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
+ };