neo-cmp-cli 1.1.8 → 1.1.10

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 (50) hide show
  1. package/package.json +1 -1
  2. package/src/cmpUtils/createCommonModulesCode.js +73 -0
  3. package/src/cmpUtils/getCmpPreview.js +3 -1
  4. package/src/module/index.js +10 -0
  5. package/src/module/main.js +45 -10
  6. package/src/module/neoInitByCopy.js +8 -0
  7. package/src/neo/neoRequire.js +14 -2
  8. package/src/template/antd-custom-cmp-template/neo.config.js +6 -0
  9. package/src/template/antd-custom-cmp-template/src/components/data-dashboard/model.ts +2 -2
  10. package/src/template/antd-custom-cmp-template/src/components/data-dashboard/style.scss +377 -119
  11. package/src/template/echarts-custom-cmp-template/README.md +91 -0
  12. package/src/template/echarts-custom-cmp-template/neo.config.js +117 -0
  13. package/src/template/echarts-custom-cmp-template/package.json +60 -0
  14. package/src/template/echarts-custom-cmp-template/src/components/chart-widget/README.md +186 -0
  15. package/src/template/echarts-custom-cmp-template/src/components/chart-widget/index.tsx +724 -0
  16. package/src/template/echarts-custom-cmp-template/src/components/chart-widget/model.ts +153 -0
  17. package/src/template/echarts-custom-cmp-template/src/components/chart-widget/style.scss +209 -0
  18. package/src/template/neo-custom-cmp-template/.prettierrc.js +12 -0
  19. package/src/template/neo-custom-cmp-template/commitlint.config.js +59 -0
  20. package/src/template/{echart-custom-cmp-template → neo-custom-cmp-template}/package.json +7 -5
  21. package/src/template/neo-custom-cmp-template/public/css/base.css +283 -0
  22. package/src/template/neo-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  23. package/src/template/neo-custom-cmp-template/public/template.html +13 -0
  24. package/src/template/neo-custom-cmp-template/src/assets/css/common.scss +127 -0
  25. package/src/template/neo-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  26. package/src/template/neo-custom-cmp-template/src/components/info-card/index.tsx +69 -0
  27. package/src/template/neo-custom-cmp-template/src/components/info-card/model.ts +78 -0
  28. package/src/template/neo-custom-cmp-template/src/components/info-card/style.scss +105 -0
  29. package/src/template/neo-custom-cmp-template/src/components/neo-entity-grid/README.md +128 -0
  30. package/src/template/neo-custom-cmp-template/src/components/neo-entity-grid/index.tsx +295 -0
  31. package/src/template/neo-custom-cmp-template/src/components/neo-entity-grid/model.ts +94 -0
  32. package/src/template/neo-custom-cmp-template/src/components/neo-entity-grid/style.scss +127 -0
  33. package/src/template/neo-custom-cmp-template/tsconfig.json +68 -0
  34. package/src/template/echart-custom-cmp-template/src/components/list-widget/README.md +0 -2
  35. package/src/template/echart-custom-cmp-template/src/components/list-widget/index.tsx +0 -208
  36. package/src/template/echart-custom-cmp-template/src/components/list-widget/model.ts +0 -90
  37. package/src/template/echart-custom-cmp-template/src/components/list-widget/style.scss +0 -350
  38. /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/.prettierrc.js +0 -0
  39. /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/commitlint.config.js +0 -0
  40. /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/public/css/base.css +0 -0
  41. /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/public/scripts/app/bluebird.js +0 -0
  42. /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/public/template.html +0 -0
  43. /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/src/assets/css/common.scss +0 -0
  44. /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/src/assets/css/mixin.scss +0 -0
  45. /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/src/components/info-card/index.tsx +0 -0
  46. /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/src/components/info-card/model.ts +0 -0
  47. /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/src/components/info-card/style.scss +0 -0
  48. /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/tsconfig.json +0 -0
  49. /package/src/template/{echart-custom-cmp-template → neo-custom-cmp-template}/README.md +0 -0
  50. /package/src/template/{echart-custom-cmp-template → neo-custom-cmp-template}/neo.config.js +0 -0
@@ -1,208 +0,0 @@
1
- import * as React from 'react';
2
- import './style.scss';
3
-
4
- interface ListItem {
5
- id: string;
6
- title: string;
7
- description: string;
8
- image: string;
9
- author: string;
10
- createTime: string;
11
- views: number;
12
- likes: number;
13
- comments: number;
14
- tags: string[];
15
- status: 'published' | 'draft' | 'archived';
16
- }
17
-
18
- interface ListWidgetProps {
19
- title: string;
20
- showImage: boolean;
21
- showTags: boolean;
22
- itemCount: number;
23
- listType: 'default' | 'card' | 'simple';
24
- data?: any;
25
- }
26
-
27
- /**
28
- * 通过 Cursor 生成的一个自定义组件示例
29
- * 组件名:ListWidget
30
- * 组件描述:支持配置的列表展示组件,内置模拟数据
31
- */
32
- export default class ListWidget extends React.PureComponent<ListWidgetProps> {
33
- constructor(props: ListWidgetProps) {
34
- super(props);
35
- this.generateMockData = this.generateMockData.bind(this);
36
- this.formatNumber = this.formatNumber.bind(this);
37
- this.renderListItem = this.renderListItem.bind(this);
38
- }
39
-
40
- // 生成模拟数据
41
- generateMockData(count: number): ListItem[] {
42
- const mockTitles = [
43
- '营销服全场景智能CRM解决方案',
44
- '企业数字化转型最佳实践',
45
- '客户关系管理新趋势分析',
46
- '数字化营销策略深度解析',
47
- '智能客服系统优化方案',
48
- '数据驱动的客户洞察',
49
- '全渠道客户体验提升',
50
- 'AI赋能销售管理创新',
51
- ];
52
-
53
- const mockDescriptions = [
54
- '帮助企业搭建数字化客户经营平台,实现业绩高质量增长,提升客户满意度和忠诚度。',
55
- '通过数据分析和智能算法,为企业提供精准的客户画像和个性化服务方案。',
56
- '整合多渠道客户触点,打造无缝的客户体验,提升品牌价值和市场竞争力。',
57
- '运用人工智能技术,优化销售流程,提高转化率,降低获客成本。',
58
- '建立完善的客户数据体系,实现精准营销和个性化推荐,提升客户价值。',
59
- '通过智能分析客户行为,预测客户需求,提前制定营销策略。',
60
- '构建全生命周期客户管理体系,从获客到留存的全流程优化。',
61
- '利用大数据和机器学习技术,实现客户价值的最大化挖掘。',
62
- ];
63
-
64
- const mockAuthors = [
65
- '张三',
66
- '李四',
67
- '王五',
68
- '赵六',
69
- '钱七',
70
- '孙八',
71
- '周九',
72
- '吴十',
73
- ];
74
- const mockTags = [
75
- 'CRM',
76
- '营销',
77
- '数字化',
78
- 'AI',
79
- '数据分析',
80
- '客户管理',
81
- '智能客服',
82
- '企业服务',
83
- ];
84
- const mockImages = [
85
- 'https://picsum.photos/400/200?random=1',
86
- 'https://picsum.photos/400/200?random=2',
87
- 'https://picsum.photos/400/200?random=3',
88
- 'https://picsum.photos/400/200?random=4',
89
- 'https://picsum.photos/400/200?random=5',
90
- 'https://picsum.photos/400/200?random=6',
91
- 'https://picsum.photos/400/200?random=7',
92
- 'https://picsum.photos/400/200?random=8',
93
- ];
94
-
95
- return Array.from({ length: count }, (_, index) => ({
96
- id: `item-${index + 1}`,
97
- title: mockTitles[index % mockTitles.length],
98
- description: mockDescriptions[index % mockDescriptions.length],
99
- image: mockImages[index % mockImages.length],
100
- author: mockAuthors[index % mockAuthors.length],
101
- createTime: new Date(
102
- Date.now() - Math.random() * 30 * 24 * 60 * 60 * 1000,
103
- ).toLocaleDateString(),
104
- views: Math.floor(Math.random() * 1000) + 100,
105
- likes: Math.floor(Math.random() * 500) + 50,
106
- comments: Math.floor(Math.random() * 200) + 10,
107
- tags: mockTags.slice(0, Math.floor(Math.random() * 3) + 1),
108
- status: ['published', 'draft', 'archived'][
109
- Math.floor(Math.random() * 3)
110
- ] as 'published' | 'draft' | 'archived',
111
- }));
112
- }
113
-
114
- // 格式化数字显示
115
- formatNumber(num: number): string {
116
- if (num < 1000) return num.toString();
117
- if (num < 10000) return `${(num / 1000).toFixed(1)}k`;
118
- return `${(num / 10000).toFixed(1)}w`;
119
- }
120
-
121
- // 获取状态标签颜色
122
- getStatusColor(status: string): string {
123
- const statusMap: { [key: string]: string } = {
124
- published: 'green',
125
- draft: 'orange',
126
- archived: 'gray',
127
- };
128
- return statusMap[status] || 'default';
129
- }
130
-
131
- // 获取状态文本
132
- getStatusText(status: string): string {
133
- const statusMap: { [key: string]: string } = {
134
- published: '已发布',
135
- draft: '草稿',
136
- archived: '已归档',
137
- };
138
- return statusMap[status] || '未知';
139
- }
140
-
141
- // 渲染列表项内容
142
- renderListItem(item: ListItem) {
143
- const { showImage, showTags } = this.props;
144
-
145
- return (
146
- <div key={item.id} className="list-item">
147
- {showImage && (
148
- <div className="item-image">
149
- <img src={item.image} alt={item.title} />
150
- </div>
151
- )}
152
- <div className="item-content">
153
- <div className="item-header">
154
- <h3 className="item-title">{item.title}</h3>
155
- <span
156
- className={`item-status status-${this.getStatusColor(
157
- item.status,
158
- )}`}
159
- >
160
- {this.getStatusText(item.status)}
161
- </span>
162
- </div>
163
- <div className="item-description">{item.description}</div>
164
- <div className="item-meta">
165
- <div className="item-meta-info">
166
- <span className="meta-item">作者:{item.author}</span>
167
- <span className="meta-separator">·</span>
168
- <span className="meta-item">发布时间:{item.createTime}</span>
169
- </div>
170
- {showTags && item.tags.length > 0 && (
171
- <div className="item-tags">
172
- {item.tags.map((tag, index) => (
173
- <span key={index} className="tag">
174
- {tag}
175
- </span>
176
- ))}
177
- </div>
178
- )}
179
- </div>
180
- </div>
181
- </div>
182
- );
183
- }
184
-
185
- render() {
186
- const { title, itemCount, listType, data } = this.props;
187
-
188
- const curAmisData = data || {};
189
- const systemInfo = curAmisData.__NeoSystemInfo || {};
190
-
191
- const mockData = this.generateMockData(itemCount);
192
-
193
- return (
194
- <div className="list-widget-container">
195
- <div className="list-header">
196
- <h2 className="list-title">
197
- {title || '内容列表'}
198
- {systemInfo.tenantName ? `【${systemInfo.tenantName}】` : ''}
199
- </h2>
200
- </div>
201
-
202
- <div className={`list-content list-${listType}`}>
203
- {mockData.map((item) => this.renderListItem(item))}
204
- </div>
205
- </div>
206
- );
207
- }
208
- }
@@ -1,90 +0,0 @@
1
- /**
2
- * @file 列表组件对接编辑器的描述文件
3
- */
4
- export class ListWidgetModel {
5
- /**
6
- * cmpType 为自定义组件名称,用于标识组件的唯一性
7
- * 在构建时根据当前组件目录名称自动生成
8
- */
9
- // cmpType: string = 'list-widget';
10
-
11
- // 组件名称,用于设置在编辑器左侧组件面板中展示的名称
12
- label: string = '列表组件';
13
-
14
- // 组件描述,用于设置在编辑器左侧组件面板中展示的描述
15
- description: string = '支持配置的列表展示组件,内置模拟数据';
16
-
17
- // 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
18
- tags: string[] = ['自定义组件'];
19
-
20
- // 组件图标,用于设置在编辑器左侧组件面板中展示的图标
21
- iconSrc: string = 'https://neo-widgets.bj.bcebos.com/favicon.png';
22
- // iconSrc: string = 'https://custom-widgets.bj.bcebos.com/custom-icon1.svg'; // custom-icon2
23
-
24
- // 初次插入页面的默认属性数据
25
- defaultComProps = {
26
- title: '内容列表',
27
- label: '列表组件',
28
- showImage: true,
29
- showTags: true,
30
- itemCount: 8,
31
- listType: 'default',
32
- };
33
-
34
- // 设计器端预览时展示的默认数据
35
- previewComProps = {
36
- label: '列表组件',
37
- };
38
-
39
- /**
40
- * 组件面板配置,用于生成编辑器右侧属性配置面板内容
41
- */
42
- propsSchema = [
43
- {
44
- type: 'text',
45
- name: 'title',
46
- label: '列表标题',
47
- value: '内容列表',
48
- },
49
- {
50
- type: 'switch',
51
- name: 'showImage',
52
- label: '显示图片',
53
- value: true,
54
- },
55
- {
56
- type: 'switch',
57
- name: 'showTags',
58
- label: '显示标签',
59
- value: true,
60
- },
61
- {
62
- type: 'number',
63
- name: 'itemCount',
64
- label: '列表项数量',
65
- value: 8,
66
- min: 1,
67
- max: 50,
68
- },
69
- {
70
- type: 'radios',
71
- name: 'listType',
72
- label: '列表样式',
73
- value: 'default',
74
- options: [
75
- { label: '默认样式', value: 'default' },
76
- { label: '卡片样式', value: 'card' },
77
- { label: '简洁样式', value: 'simple' },
78
- ],
79
- },
80
- ];
81
-
82
- // 支持 函数式写法:propsSchemaCreator,com 为组件实例。优先级比 propsSchema 高
83
- /*
84
- propsSchemaCreator = (com: any) => {
85
- return [];
86
- };
87
- */
88
- }
89
-
90
- export default ListWidgetModel;
@@ -1,350 +0,0 @@
1
- :root {
2
- --list-padding: 16px;
3
- --list-border-radius: 8px;
4
- --list-shadow: 0 2px 8px rgb(0 0 0 / 10%);
5
- --list-hover-shadow: 0 4px 12px rgb(0 0 0 / 15%);
6
- }
7
-
8
- .list-widget-container {
9
- position: relative;
10
- box-sizing: border-box;
11
- margin: 12px;
12
- padding: var(--list-padding);
13
- background-color: #fff;
14
- border-radius: var(--list-border-radius);
15
- box-shadow: var(--list-shadow);
16
-
17
- .list-header {
18
- margin-bottom: 20px;
19
- padding-bottom: 16px;
20
- border-bottom: 2px solid #f0f0f0;
21
- position: relative;
22
-
23
- &::after {
24
- content: '';
25
- position: absolute;
26
- bottom: -2px;
27
- left: 0;
28
- width: 40px;
29
- height: 2px;
30
- background: linear-gradient(90deg, #1890ff, #40a9ff);
31
- border-radius: 1px;
32
- }
33
-
34
- .list-title {
35
- margin: 0;
36
- color: #262626;
37
- font-weight: 600;
38
- font-size: 20px;
39
- position: relative;
40
- }
41
- }
42
-
43
- .list-content {
44
- .list-item {
45
- padding: 18px 0;
46
- border-bottom: 1px solid #f5f5f5;
47
- transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
48
- position: relative;
49
-
50
- &::before {
51
- content: '';
52
- position: absolute;
53
- left: 0;
54
- top: 0;
55
- bottom: 0;
56
- width: 3px;
57
- background: linear-gradient(180deg, #1890ff, #40a9ff);
58
- opacity: 0;
59
- transition: opacity 0.3s ease;
60
- border-radius: 0 2px 2px 0;
61
- }
62
-
63
- &:hover {
64
- background-color: #fafafa;
65
- border-radius: 8px;
66
- margin: 0 -12px;
67
- padding: 18px 12px;
68
- box-shadow: var(--list-hover-shadow);
69
- transform: translateX(4px);
70
-
71
- &::before {
72
- opacity: 1;
73
- }
74
- }
75
-
76
- &:last-child {
77
- border-bottom: none;
78
- }
79
-
80
- .item-image {
81
- width: 100%;
82
- height: 200px;
83
- margin-bottom: 16px;
84
- border-radius: 8px;
85
- overflow: hidden;
86
- position: relative;
87
-
88
- img {
89
- width: 100%;
90
- height: 100%;
91
- object-fit: cover;
92
- transition: transform 0.3s ease;
93
- }
94
-
95
- &:hover img {
96
- transform: scale(1.05);
97
- }
98
- }
99
-
100
- .item-content {
101
- .item-header {
102
- display: flex;
103
- justify-content: space-between;
104
- align-items: flex-start;
105
- margin-bottom: 8px;
106
- gap: 12px;
107
-
108
- .item-title {
109
- margin: 0;
110
- color: #262626;
111
- font-weight: 500;
112
- line-height: 1.4;
113
- flex: 1;
114
- font-size: 16px;
115
- }
116
-
117
- .item-status {
118
- padding: 2px 6px;
119
- border-radius: 4px;
120
- font-size: 11px;
121
- line-height: 1.2;
122
- font-weight: 500;
123
-
124
- &.status-green {
125
- background-color: #f6ffed;
126
- color: #52c41a;
127
- border: 1px solid #b7eb8f;
128
- }
129
-
130
- &.status-orange {
131
- background-color: #fff7e6;
132
- color: #fa8c16;
133
- border: 1px solid #ffd591;
134
- }
135
-
136
- &.status-gray {
137
- background-color: #f5f5f5;
138
- color: #8c8c8c;
139
- border: 1px solid #d9d9d9;
140
- }
141
- }
142
- }
143
-
144
- .item-description {
145
- margin-bottom: 12px;
146
- line-height: 1.6;
147
- color: #595959;
148
- font-size: 14px;
149
- display: box;
150
- -webkit-line-clamp: 2;
151
- line-clamp: 2;
152
- -webkit-box-orient: vertical;
153
- overflow: hidden;
154
- text-overflow: ellipsis;
155
- }
156
-
157
- .item-meta {
158
- display: flex;
159
- justify-content: space-between;
160
- align-items: center;
161
- flex-wrap: wrap;
162
- gap: 8px;
163
-
164
- .item-meta-info {
165
- display: flex;
166
- align-items: center;
167
- gap: 8px;
168
-
169
- .meta-item {
170
- color: #8c8c8c;
171
- font-size: 12px;
172
- }
173
-
174
- .meta-separator {
175
- color: #8c8c8c;
176
- font-size: 12px;
177
- }
178
- }
179
-
180
- .item-tags {
181
- display: flex;
182
- gap: 6px;
183
- flex-wrap: wrap;
184
-
185
- .tag {
186
- padding: 2px 6px;
187
- background-color: #e6f7ff;
188
- color: #1890ff;
189
- border: 1px solid #91d5ff;
190
- border-radius: 4px;
191
- font-size: 11px;
192
- line-height: 1.2;
193
- }
194
- }
195
- }
196
- }
197
- }
198
-
199
- // 卡片样式
200
- &.list-card {
201
- .list-item {
202
- margin-bottom: 12px;
203
- padding: 16px;
204
- background: #fff;
205
- border: 1px solid #f0f0f0;
206
- border-radius: var(--list-border-radius);
207
- box-shadow: 0 1px 3px rgb(0 0 0 / 10%);
208
-
209
- &:hover {
210
- box-shadow: var(--list-hover-shadow);
211
- border-color: #d9d9d9;
212
- transform: translateY(-2px);
213
- }
214
-
215
- &:last-child {
216
- margin-bottom: 0;
217
- }
218
-
219
- .item-image {
220
- height: 180px;
221
- margin-bottom: 12px;
222
- }
223
- }
224
- }
225
-
226
- // 简洁样式
227
- &.list-simple {
228
- .list-item {
229
- padding: 12px 0;
230
- border-bottom: 1px solid #f0f0f0;
231
-
232
- &:hover {
233
- background-color: transparent;
234
- box-shadow: none;
235
- margin: 0;
236
- padding: 12px 6px;
237
- }
238
-
239
- .item-image {
240
- height: 120px;
241
- margin-bottom: 8px;
242
- }
243
-
244
- .item-content {
245
- .item-header {
246
- margin-bottom: 4px;
247
-
248
- .item-title {
249
- font-size: 14px;
250
- font-weight: 400;
251
- }
252
- }
253
-
254
- .item-description {
255
- font-size: 12px;
256
- color: #8c8c8c;
257
- margin-bottom: 8px;
258
- -webkit-line-clamp: 1;
259
- line-clamp: 1;
260
- }
261
-
262
- .item-meta {
263
- .item-tags {
264
- .tag {
265
- font-size: 10px;
266
- padding: 1px 4px;
267
- line-height: 1.1;
268
- }
269
- }
270
- }
271
- }
272
- }
273
- }
274
- }
275
- }
276
-
277
- // 响应式设计
278
- @media (max-width: 768px) {
279
- .list-widget-container {
280
- margin: 8px;
281
- padding: 12px;
282
-
283
- .list-content {
284
- .list-item {
285
- .item-content {
286
- .item-header {
287
- flex-direction: column;
288
- align-items: flex-start;
289
- gap: 8px;
290
-
291
- .item-title {
292
- margin-right: 0;
293
- }
294
- }
295
-
296
- .item-meta {
297
- flex-direction: column;
298
- align-items: flex-start;
299
- gap: 8px;
300
- }
301
- }
302
- }
303
- }
304
- }
305
- }
306
-
307
- // 暗色主题支持
308
- @media (prefers-color-scheme: dark) {
309
- .list-widget-container {
310
- background-color: #1f1f1f;
311
- color: #fff;
312
-
313
- .list-header {
314
- border-bottom-color: #303030;
315
-
316
- .list-title {
317
- color: #fff;
318
- }
319
- }
320
-
321
- .list-content {
322
- .list-item {
323
- border-bottom-color: #303030;
324
-
325
- &:hover {
326
- background-color: #2a2a2a;
327
- }
328
-
329
- .item-content {
330
- .item-header {
331
- .item-title {
332
- color: #fff;
333
- }
334
- }
335
-
336
- .item-description {
337
- color: #ccc;
338
- }
339
- }
340
- }
341
-
342
- &.list-card {
343
- .list-item {
344
- background: #1f1f1f;
345
- border-color: #303030;
346
- }
347
- }
348
- }
349
- }
350
- }