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,87 @@
1
+ import * as React from 'react';
2
+ import './style.scss'; // 组件内容样式
3
+ // @ts-ignore
4
+ // import ChartWidget from 'chartWidget'; // 另一个自定义组件导出的模块
5
+
6
+ interface InfoCardProps {
7
+ title: string;
8
+ backgroundImage: string;
9
+ imgCount: number;
10
+ commentCount: number;
11
+ data?: any;
12
+ }
13
+
14
+ export default class InfoCard extends React.PureComponent<InfoCardProps> {
15
+ constructor(props: InfoCardProps) {
16
+ super(props);
17
+ this.agreeDataFormat = this.agreeDataFormat.bind(this);
18
+ }
19
+
20
+ agreeDataFormat(agreeData: number) {
21
+ if (agreeData && agreeData <= 9999) {
22
+ return agreeData;
23
+ }
24
+ if (agreeData && agreeData > 9999) {
25
+ return `${Math.floor(agreeData / 1000) / 10}w`;
26
+ }
27
+ return '';
28
+ }
29
+
30
+ render() {
31
+ const { title, backgroundImage, imgCount, commentCount } = this.props;
32
+ console.log('当前自定义组件:', this.props, this);
33
+ const curAmisData = this.props.data || {};
34
+
35
+ const userInfo = curAmisData.__NeoCurrentUser;
36
+ const systemInfo = curAmisData.__NeoSystemInfo || {};
37
+
38
+ const curBackgroundImage =
39
+ backgroundImage || 'https://neo-widgets.bj.bcebos.com/NeoCRM.jpg';
40
+ return (
41
+ <div className="info-card-container">
42
+ <div className="news-title">
43
+ {title ||
44
+ '营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。'}
45
+ {systemInfo.tenantName ? `【${systemInfo.tenantName}】` : ''}
46
+ </div>
47
+ <div className="item-imgbox">
48
+ {userInfo && userInfo.icon && (
49
+ <div className="user-info-box">
50
+ <img src={userInfo.icon} className="user-icon" />
51
+ <span className="user-name">{userInfo.name}</span>
52
+ </div>
53
+ )}
54
+ <div
55
+ className="news-img"
56
+ style={{ backgroundImage: `url(${curBackgroundImage})` }}
57
+ ></div>
58
+ {imgCount > 0 && <div className="img-count">{imgCount}</div>}
59
+ </div>
60
+ <div className="news-info">
61
+ <div className="left media-mark">NeoCRM · 低代码平台</div>
62
+ {commentCount && commentCount > 0 && (
63
+ <div className="cmt-num right">
64
+ {this.agreeDataFormat(commentCount)}评
65
+ </div>
66
+ )}
67
+ </div>
68
+ {/* <ChartWidget
69
+ chartType="line"
70
+ title="销售趋势"
71
+ subtitle="2025年数据"
72
+ width={800}
73
+ height={400}
74
+ mockData={{
75
+ xAxis: ['1月', '2月', '3月', '4月', '5月', '6月'],
76
+ series: [
77
+ {
78
+ name: '销售额',
79
+ data: [120, 200, 150, 80, 70, 110],
80
+ },
81
+ ],
82
+ }}
83
+ /> */}
84
+ </div>
85
+ );
86
+ }
87
+ }
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @file 自定义组件对接编辑器的描述文件
3
+ */
4
+ export class InfoCardModel {
5
+ /**
6
+ * cmpType 为自定义组件名称,用于标识组件的唯一性
7
+ * 在构建时根据当前组件目录名称自动生成
8
+ */
9
+ // cmpType: string = 'infoCard';
10
+
11
+ // 组件名称,用于设置在编辑器左侧组件面板中展示的名称
12
+ label: string = '信息卡片';
13
+
14
+ // 组件描述,用于设置在编辑器左侧组件面板中展示的描述
15
+ description: string = '信息展示卡片';
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
+ // iconSrc = 'https://neo-widgets.bj.bcebos.com/favicon.png';
37
+
38
+ // 初次插入页面的默认属性数据
39
+ defaultComProps = {
40
+ title:
41
+ '营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。',
42
+ label: '信息卡片',
43
+ backgroundImage: 'https://neo-widgets.bj.bcebos.com/NeoCRM.jpg',
44
+ imgCount: 3,
45
+ commentCount: 2025,
46
+ };
47
+
48
+ /**
49
+ * 组件面板配置,用于生成编辑器右侧属性配置面板内容
50
+ */
51
+ propsSchema = [
52
+ {
53
+ type: 'textarea',
54
+ name: 'title',
55
+ label: '卡片title',
56
+ value:
57
+ '营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。',
58
+ },
59
+ {
60
+ type: 'text',
61
+ name: 'backgroundImage',
62
+ label: '展示图片',
63
+ value: 'https://neo-widgets.bj.bcebos.com/NeoCRM.jpg',
64
+ },
65
+ {
66
+ type: 'number',
67
+ name: 'imgCount',
68
+ label: '图片数量',
69
+ value: 3,
70
+ },
71
+ {
72
+ type: 'number',
73
+ name: 'commentCount',
74
+ label: '评论数',
75
+ value: 2025,
76
+ },
77
+ ];
78
+ }
79
+
80
+ export default InfoCardModel;
@@ -0,0 +1,105 @@
1
+ :root {
2
+ --padding-bottom: 12px;
3
+ }
4
+
5
+ .info-card-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
+ .user-info-box {
54
+ position: absolute;
55
+ top: 10px;
56
+ left: 10px;
57
+ width: 100px;
58
+ min-height: 100px;
59
+ padding: 6px 8px;
60
+ color: #fff;
61
+ min-width: 60px;
62
+ text-align: center;
63
+ line-height: 1.2;
64
+ background: rgb(0 0 0 / 40%);
65
+ font-size: 25px;
66
+ box-sizing: border-box;
67
+ overflow: hidden;
68
+ display: flex;
69
+ flex-direction: column;
70
+ align-items: center;
71
+ justify-content: center;
72
+
73
+ .user-icon {
74
+ width: 64px;
75
+ height: 64px;
76
+ border-radius: 50%;
77
+ }
78
+
79
+ .user-name {
80
+ font-size: 16px;
81
+ font-weight: 600;
82
+ margin-top: 10px;
83
+ }
84
+ }
85
+ }
86
+
87
+ .news-info {
88
+ font-family: PingFangSC-Light;
89
+ height: 28px;
90
+ box-sizing: border-box;
91
+ display: flex;
92
+ justify-content: space-between;
93
+ align-items: center;
94
+ }
95
+
96
+ .media-mark,
97
+ .cmt-num {
98
+ display: inline-block;
99
+ height: 28px;
100
+ line-height: 28px;
101
+ font-family: PingFangSC-Light;
102
+ font-size: 18px;
103
+ color: #828282;
104
+ }
105
+ }
@@ -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,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,48 @@
1
+ ### 目录说明
2
+ - src: 自定义组件源码;
3
+ - src/assets: 存放组件静态资源,比如 css、img等;
4
+ - src/components: 存放自定义组件代码,每个自定义组件以自身名称(cmpType 数值)作为目录进行存放;
5
+ - src/components/contact-form/index.tsx: 自定义组件的内容文件;
6
+ - src/components/contact-form/model.ts: 自定义组件的模型文件,用于对接页面设计器;
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
+ - 支持在自定义组件中使用 Open API,详细见[使用说明](./docs/README.md)。
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. **preview: 组件预览模式(带热更新)**
30
+ > preview模式:用于预览自定义组件内容。
31
+ ```bash
32
+ $ npm run preview
33
+ ```
34
+
35
+ 3. **linkDebug: 外链调试(在线上页面设计器端预览自定义组件)**
36
+ > linkDebug模式:用于在线上页面设计器中预览和调试自定义组件。
37
+ ```bash
38
+ $ npm run linkDebug
39
+ ```
40
+
41
+ 4. **发布到对象存储服务中**
42
+ > 需要确保 package.json 中的 name 值唯一,version 值不重复。
43
+ ```bash
44
+ $ npm run publish2oss
45
+ ```
46
+
47
+ ### 配置项说明(neo-cmp-cli)
48
+ [请查看neo-cmp-cli](https://github.com/wibetter/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,13 @@
1
+ ## Open api 文档
2
+ - [Open API 简介](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_apiIntroduction.html&id=1405&dir=output_1757929564205)。
3
+
4
+ ## Neo 自定义组件中可用的 open api 接口
5
+ - [查询对象列表](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2FpaasQueryObjectList.html&id=1405&dir=output_1757929564205&time=1758780224026): /rest/metadata/v2.0/xobjects/filter;
6
+ - 查询标准对象列表: /rest/metadata/v2.0/xobjects/filter?custom=false&active=true;
7
+ - 查询自定义对象列表: /rest/metadata/v2.0/xobjects/filter?custom=true&active=true;
8
+ - [创建业务数据](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_paas_customObject_create.html&id=1405&dir=output_1757929564205&time=1758782257815): /rest/data/v2.0/xobjects/{xObjectApiKey};
9
+ - [更新业务数据](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_paas_customObject_update.html&id=1405&dir=output_1757929564205&time=1758782321910): /rest/data/v2.0/xobjects/{xObjectApiKey}/{id};
10
+ - [获取业务数据信息(单个数据)](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_paas_customObject_getBusinessDataInformation.html&id=1405&dir=output_1757929564205&time=1758781533725): /rest/data/v2.0/xobjects/{xObjectApiKey}/{id};
11
+ - [查询接口(通用查询接口)](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_queryInterfaceDescription.html&id=1405&dir=output_1757929564205&time=1758784491846): /rest/data/v2/query;
12
+ - [获取业务类型描述](https://doc.xiaoshouyi.com/?sso-domain=login-cd.xiaoshouyi.com#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_paas_customObject_getBusinessTypeDescription.html&id=1405&dir=output_1757929564205&time=1758798530511): /rest/data/v2.0/xobjects/{xObjectApiKey}/busiType;
13
+ - 更多可用接口见[文档](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_apiIntroduction.html&id=1405&dir=output_1757929564205)。
@@ -0,0 +1,121 @@
1
+ 'use strict';
2
+ const path = require('path');
3
+
4
+ // 统一路径解析
5
+ function resolve(dir) {
6
+ return path.resolve(__dirname, dir);
7
+ }
8
+
9
+ // 包括生产和开发的环境配置信息
10
+ module.exports = {
11
+ settings: {
12
+ enableESLint: true, // 调试模式是否开启ESLint,默认开启ESLint检测代码格式
13
+ enableESLintFix: true, // 是否自动修正代码格式,默认不自动修正
14
+ enableStyleLint: false, // 是否开启StyleLint,默认开启ESLint检测代码格式
15
+ enableStyleLintFix: false, // 是否需要StyleLint自动修正代码格式
16
+ },
17
+ webpack: {
18
+ target: ['web', 'es5'], // 指定目标环境为 web 和 es5,确保兼容性
19
+ resolve: {
20
+ // webpack的resolve配置
21
+ extensions: ['.js', '.jsx', '.ts', '.tsx', '.umd.js', '.min.js', '.json'], // 用于配置webpack在尝试过程中用到的后缀列表
22
+ alias: {
23
+ '@': resolve('src'),
24
+ $assets: resolve('src/assets'),
25
+ $public: resolve('public'),
26
+ },
27
+ },
28
+ // sassResources中的sass文件会自动注入每一个sass文件中
29
+ sassResources: [
30
+ resolve('./src/assets/css/common.scss'),
31
+ resolve('./src/assets/css/mixin.scss'),
32
+ ],
33
+ // createDeclaration: true, // 打包时是否创建ts声明文件
34
+ ignoreNodeModules: false, // 打包时是否忽略 node_modules
35
+ // allowList: [], // ignoreNodeModules为true时生效
36
+ // projectDir: ['src'],
37
+ // template: resolve('./public/template.html'), // 自定义html模板
38
+ // plugins: [],
39
+ // babelPlugins: [],
40
+ },
41
+ // 用于添加 Neo 共享依赖模块的配置信息
42
+ /*
43
+ neoCommonModule: {
44
+ // exports: ['xxModule'], // 数组写法,用于导出当前自定义组件中的第三方依赖模块
45
+ exports: { // 对象写法,可用于导出自定义组件中的某个内容模块(需要使用绝对路径导出)
46
+ 'chart-widget': path.resolve('./src/components/chart-widget'), // 导出图表自定义组件
47
+ 'neo-register': 'neo-register', // 导出 Neo 注册模块
48
+ },
49
+ // remoteDeps: ['xxModule'], // 远程依赖组件,表示当前自定义组件会用到的远程依赖组件,需要和 externals 配合使用
50
+ // externals: ['xxModule'], // 自定义组件中需要剔除的模块,仅支持数组写法
51
+ },
52
+ */
53
+ preview: {
54
+ // 用于开启本地预览模式的相关配置信息
55
+ /*
56
+ 【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
57
+ entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
58
+ // 本地预览自定义组件内容
59
+ index: './src/preview.jsx',
60
+ },
61
+ NODE_ENV: 'development',
62
+ port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
63
+ assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
64
+ assetsSubDirectory: '',
65
+ hostname: 'localhost',
66
+ proxyTable: {
67
+ '/apiTest': {
68
+ target: 'http://api-test.com.cn', // 不支持跨域的接口根地址
69
+ ws: true,
70
+ changeOrigin: true,
71
+ },
72
+ },
73
+ */
74
+ },
75
+ linkDebug: {
76
+ // 用于开启本地调试模式的相关配置信息
77
+ /*
78
+ 【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
79
+ entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
80
+ // 外链调试(在线上页面设计器端预览自定义组件)
81
+ index: [
82
+ './src/components/info-card/register.ts',
83
+ './src/components/info-card/model.ts',
84
+ ],
85
+ },
86
+ NODE_ENV: 'development',
87
+ port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
88
+ closeHotReload: true, // 是否关闭热更新
89
+ assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
90
+ assetsSubDirectory: '',
91
+ hostname: 'localhost',
92
+ proxyTable: {
93
+ '/apiTest': {
94
+ target: 'http://api-test.com.cn', // 不支持跨域的接口根地址
95
+ ws: true,
96
+ changeOrigin: true,
97
+ },
98
+ }
99
+ */
100
+ },
101
+ publish2oss: {
102
+ // 用于构建并发布至 OSS 的相关配置
103
+ /*
104
+ 【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
105
+ NODE_ENV: 'production',
106
+ entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
107
+ InfoCardModel: './src/components/info-card/model.ts',
108
+ infoCard: './src/components/info-card/register.ts'
109
+ },
110
+ cssExtract: false, // 不额外提取css文件
111
+ ossType: 'ali', // oss类型:ali、baidu
112
+ ossConfig: {
113
+ endpoint: 'https://oss-cn-beijing.aliyuncs.com',
114
+ AccessKeyId: 'xxx',
115
+ AccessKeySecret: 'xx',
116
+ bucket: 'neo-widgets' // 存储桶名称
117
+ },
118
+ assetsRoot: resolve('dist') // 上传指定目录下的脚本文件
119
+ */
120
+ },
121
+ };
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "neo-custom-cmp-template",
3
+ "version": "1.1.0",
4
+ "description": "neo自定义组件模板(react&ts技术栈)",
5
+ "keywords": [
6
+ "自定义组件模板",
7
+ "react&ts技术栈",
8
+ "neo自定义组件"
9
+ ],
10
+ "author": "wibetter",
11
+ "license": "MIT",
12
+ "scripts": {
13
+ "preview": "neo preview --cmpType=contact-form",
14
+ "preview2": "neo preview --cmpType=contact-card-list",
15
+ "linkDebug": "neo linkDebug",
16
+ "publish2oss": "neo publish2oss",
17
+ "format": "prettier --write \"src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}\""
18
+ },
19
+ "files": [
20
+ "dist/*"
21
+ ],
22
+ "husky": {
23
+ "hooks": {
24
+ "pre-commit": "lint-staged",
25
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
26
+ }
27
+ },
28
+ "lint-staged": {
29
+ "src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}": [
30
+ "prettier --write"
31
+ ]
32
+ },
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://git@github.com:wibetter/neo-custom-cmp-template.git"
36
+ },
37
+ "bugs": {
38
+ "url": "https://github.com/wibetter/neo-custom-cmp-template/issues"
39
+ },
40
+ "dependencies": {
41
+ "neo-register": "^1.0.3",
42
+ "react": "^16.9.0",
43
+ "react-dom": "^16.9.0",
44
+ "axios": "^0.27.2",
45
+ "antd": "^4.9.4",
46
+ "lodash": "^4.17.21"
47
+ },
48
+ "devDependencies": {
49
+ "@commitlint/cli": "^8.3.5",
50
+ "@commitlint/config-conventional": "^9.1.1",
51
+ "@types/react": "^16.9.11",
52
+ "@types/react-dom": "^16.9.15",
53
+ "@types/axios": "^0.14.0",
54
+ "neo-cmp-cli": "^1.2.23",
55
+ "husky": "^4.2.5",
56
+ "lint-staged": "^10.2.9",
57
+ "prettier": "^2.0.5"
58
+ },
59
+ "engines": {
60
+ "node": ">= 10.13.0",
61
+ "npm": ">= 6.4.1"
62
+ }
63
+ }