neo-cmp-cli 1.3.6 → 1.3.8

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 (33) hide show
  1. package/README.md +5 -5
  2. package/package.json +1 -1
  3. package/src/template/antd-custom-cmp-template/package.json +2 -2
  4. package/src/template/echarts-custom-cmp-template/package.json +2 -2
  5. package/src/template/echarts-custom-cmp-template/src/components/map-widget/README.md +125 -0
  6. package/src/template/echarts-custom-cmp-template/src/components/map-widget/USAGE.md +190 -0
  7. package/src/template/echarts-custom-cmp-template/src/components/map-widget/index.tsx +385 -0
  8. package/src/template/echarts-custom-cmp-template/src/components/map-widget/model.ts +105 -0
  9. package/src/template/echarts-custom-cmp-template/src/components/map-widget/style.scss +192 -0
  10. package/src/template/echarts-custom-cmp-template/src/utils/url.ts +82 -0
  11. package/src/template/neo-custom-cmp-template/neo.config.js +4 -4
  12. package/src/template/neo-custom-cmp-template/package.json +2 -2
  13. package/src/template/neo-custom-cmp-template/src/assets/img/custom-form.svg +1 -0
  14. package/src/template/neo-custom-cmp-template/src/assets/img/data-list.svg +1 -0
  15. package/src/template/react-custom-cmp-template/package.json +2 -2
  16. package/src/template/react-ts-custom-cmp-template/neo.config.js +4 -4
  17. package/src/template/react-ts-custom-cmp-template/package.json +3 -3
  18. package/src/template/react-ts-custom-cmp-template/src/assets/img/map.svg +1 -0
  19. package/src/template/vue2-custom-cmp-template/package.json +2 -2
  20. package/src/template/echarts-custom-cmp-template/src/components/info-card/index.tsx +0 -69
  21. package/src/template/echarts-custom-cmp-template/src/components/info-card/model.ts +0 -78
  22. package/src/template/echarts-custom-cmp-template/src/components/info-card/style.scss +0 -105
  23. package/src/template/neo-custom-cmp-template/src/components/contact-card-list/README.md +0 -61
  24. package/src/template/neo-custom-cmp-template/src/components/contact-card-list/index.tsx +0 -191
  25. package/src/template/neo-custom-cmp-template/src/components/contact-card-list/model.ts +0 -56
  26. package/src/template/neo-custom-cmp-template/src/components/contact-card-list/style.scss +0 -260
  27. package/src/template/neo-custom-cmp-template/src/components/contact-form/README.md +0 -94
  28. package/src/template/neo-custom-cmp-template/src/components/contact-form/index.tsx +0 -249
  29. package/src/template/neo-custom-cmp-template/src/components/contact-form/model.ts +0 -63
  30. package/src/template/neo-custom-cmp-template/src/components/contact-form/style.scss +0 -120
  31. package/src/template/react-ts-custom-cmp-template/src/components/info-card/index.tsx +0 -69
  32. package/src/template/react-ts-custom-cmp-template/src/components/info-card/model.ts +0 -78
  33. package/src/template/react-ts-custom-cmp-template/src/components/info-card/style.scss +0 -105
@@ -1,191 +0,0 @@
1
- import * as React from 'react';
2
- import { Card, Row, Col, Spin, Empty, Avatar, Button } from 'antd';
3
- import { UserOutlined, PhoneOutlined, ReloadOutlined } from '@ant-design/icons';
4
- // @ts-ignore
5
- import { xObject } from 'neo-open-api'; // Neo Open API
6
- import './style.scss';
7
-
8
- interface ContactCardListProps {
9
- title: string;
10
- data?: any;
11
- }
12
-
13
- interface ContactData {
14
- id: string;
15
- name: string;
16
- phone__c: string;
17
- }
18
-
19
- interface ContactCardListState {
20
- contactList: ContactData[];
21
- totalSize: number;
22
- loading: boolean;
23
- error: string | null;
24
- }
25
-
26
- export default class ContactCardList extends React.PureComponent<
27
- ContactCardListProps,
28
- ContactCardListState
29
- > {
30
- constructor(props: ContactCardListProps) {
31
- super(props);
32
-
33
- this.state = {
34
- contactList: [],
35
- totalSize: 0,
36
- loading: false,
37
- error: null,
38
- };
39
-
40
- this.loadContactData = this.loadContactData.bind(this);
41
- }
42
-
43
- componentDidMount() {
44
- this.loadContactData();
45
- }
46
-
47
- async loadContactData() {
48
- this.setState({ loading: true, error: null });
49
-
50
- try {
51
- // 使用 Neo Open API 获取 customContact__c 数据
52
- const result = await xObject.query({
53
- xObjectApiKey: 'customContact__c',
54
- fields: ['id', 'name', 'phone__c'],
55
- });
56
-
57
- if (result?.status) {
58
- const records = result.data || [];
59
- const totalSize = result.totalSize || 0;
60
- this.setState({
61
- contactList: records,
62
- totalSize,
63
- loading: false,
64
- });
65
- } else {
66
- this.setState({
67
- error: result?.msg || '获取联系人数据失败',
68
- loading: false,
69
- });
70
- }
71
- } catch (error: any) {
72
- this.setState({
73
- error: error.message || '获取联系人数据失败',
74
- loading: false,
75
- });
76
- }
77
- }
78
-
79
- getDataName = (data: any) => {
80
- let dataNameKey = 'name';
81
- Object.keys(data).forEach((nameKey: string) => {
82
- if (nameKey && /Name$/.test(nameKey)) {
83
- dataNameKey = nameKey;
84
- }
85
- });
86
- return data[dataNameKey];
87
- };
88
-
89
- renderContactCard(contact: ContactData, index: number) {
90
- return (
91
- <Col xs={24} sm={12} md={8} lg={6} xl={6} key={contact.id || index}>
92
- <Card
93
- className="contact-card"
94
- hoverable
95
- size="small"
96
- style={{ marginBottom: 16 }}
97
- >
98
- <div className="contact-card-content">
99
- <div className="contact-avatar">
100
- <Avatar
101
- size={48}
102
- icon={<UserOutlined />}
103
- className="avatar-icon"
104
- />
105
- </div>
106
- <div className="contact-info">
107
- <div className="contact-name">
108
- <UserOutlined className="info-icon" />
109
- <span className="name-text">
110
- {contact.name || this.getDataName(contact) || '未知姓名'}
111
- </span>
112
- </div>
113
- <div className="contact-phone">
114
- <PhoneOutlined className="info-icon" />
115
- <span className="phone-text">
116
- {contact.phone__c || '未填写手机号'}
117
- </span>
118
- </div>
119
- </div>
120
- </div>
121
- </Card>
122
- </Col>
123
- );
124
- }
125
-
126
- render() {
127
- const { title } = this.props;
128
- const { contactList, loading, error } = this.state;
129
- const curAmisData = this.props.data || {};
130
- const systemInfo = curAmisData.__NeoSystemInfo || {};
131
-
132
- return (
133
- <div className="contact-card-list-container">
134
- <div className="card-list-header">
135
- <div className="header-content">
136
- <h3 className="header-title">
137
- {title || '联系人卡片列表'}
138
- {systemInfo.tenantName ? `【${systemInfo.tenantName}】` : ''}
139
- </h3>
140
- <Button
141
- type="primary"
142
- icon={<ReloadOutlined />}
143
- onClick={this.loadContactData}
144
- loading={loading}
145
- className="refresh-button"
146
- size="small"
147
- >
148
- 刷新
149
- </Button>
150
- </div>
151
- </div>
152
-
153
- <div className="card-list-content">
154
- <Spin spinning={loading} tip="加载联系人数据中...">
155
- {error ? (
156
- <div className="error-container">
157
- <Empty
158
- image={Empty.PRESENTED_IMAGE_SIMPLE}
159
- description={
160
- <div>
161
- <div style={{ color: '#ff4d4f', marginBottom: 8 }}>
162
- {error}
163
- </div>
164
- <button
165
- className="retry-button"
166
- onClick={this.loadContactData}
167
- >
168
- 重新加载
169
- </button>
170
- </div>
171
- }
172
- />
173
- </div>
174
- ) : contactList.length === 0 ? (
175
- <Empty
176
- image={Empty.PRESENTED_IMAGE_SIMPLE}
177
- description="暂无联系人数据"
178
- />
179
- ) : (
180
- <Row gutter={[16, 16]}>
181
- {contactList.map((contact, index) =>
182
- this.renderContactCard(contact, index),
183
- )}
184
- </Row>
185
- )}
186
- </Spin>
187
- </div>
188
- </div>
189
- );
190
- }
191
- }
@@ -1,56 +0,0 @@
1
- /**
2
- * @file 联系人卡片列表组件对接编辑器的描述文件
3
- */
4
- export class ContactCardListModel {
5
- /**
6
- * cmpType 为自定义组件名称,用于标识组件的唯一性
7
- * 在构建时根据当前组件目录名称自动生成
8
- */
9
- // cmpType: string = 'contact-card-list';
10
-
11
- // 组件名称,用于设置在编辑器左侧组件面板中展示的名称
12
- label: string = '联系人卡片列表';
13
-
14
- // 组件描述,用于设置在编辑器左侧组件面板中展示的描述
15
- description: string = '展示联系人信息的卡片列表组件,支持姓名和手机号展示';
16
-
17
- // 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
18
- tags: string[] = ['自定义组件'];
19
-
20
- // 组件图标,用于设置在编辑器左侧组件面板中展示的图标
21
- iconSrc: string = 'https://custom-widgets.bj.bcebos.com/card-list.svg';
22
-
23
- // 初次插入页面的默认属性数据
24
- defaultComProps = {
25
- title: '联系人卡片列表',
26
- label: '联系人卡片列表',
27
- };
28
-
29
- // 设计器端预览时展示的默认数据
30
- previewComProps = {
31
- label: '联系人卡片列表',
32
- title: '联系人卡片列表',
33
- };
34
-
35
- /**
36
- * 组件面板配置,用于生成编辑器右侧属性配置面板内容
37
- */
38
- propsSchema = [
39
- {
40
- type: 'textarea',
41
- name: 'title',
42
- label: '组件标题',
43
- value: '联系人卡片列表',
44
- placeholder: '请输入组件标题',
45
- },
46
- ];
47
-
48
- // 支持 函数式写法:propsSchemaCreator,com 为组件实例。优先级比 propsSchema 高
49
- /*
50
- propsSchemaCreator = (com: any) => {
51
- return [];
52
- };
53
- */
54
- }
55
-
56
- export default ContactCardListModel;
@@ -1,260 +0,0 @@
1
- .contact-card-list-container {
2
- position: relative;
3
- box-sizing: border-box;
4
- height: 100%;
5
- display: flex;
6
- flex-direction: column;
7
- margin: 6px 12px;
8
- padding: 12px;
9
- background-color: #fff;
10
- border-radius: 8px;
11
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
12
-
13
- .card-list-header {
14
- flex-shrink: 0;
15
- margin-bottom: 16px;
16
- border-bottom: 1px solid #f0f0f0;
17
- padding-bottom: 12px;
18
-
19
- .header-content {
20
- display: flex;
21
- justify-content: space-between;
22
- align-items: center;
23
- gap: 16px;
24
- }
25
-
26
- .header-title {
27
- margin: 0;
28
- font-family: PingFangSC-Medium, -apple-system, BlinkMacSystemFont,
29
- 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
30
- font-size: 18px;
31
- font-weight: 500;
32
- line-height: 1.4;
33
- color: #262626;
34
- flex: 1;
35
- }
36
-
37
- .refresh-button {
38
- flex-shrink: 0;
39
- border-radius: 6px;
40
- font-size: 13px;
41
- height: 32px;
42
- padding: 4px 12px;
43
- box-shadow: 0 2px 4px rgba(24, 144, 255, 0.2);
44
- transition: all 0.3s ease;
45
-
46
- &:hover {
47
- box-shadow: 0 4px 8px rgba(24, 144, 255, 0.3);
48
- transform: translateY(-1px);
49
- }
50
-
51
- &:active {
52
- transform: translateY(0);
53
- }
54
-
55
- .anticon {
56
- font-size: 12px;
57
- }
58
- }
59
- }
60
-
61
- .card-list-content {
62
- flex: 1;
63
- overflow-y: auto;
64
-
65
- .error-container {
66
- display: flex;
67
- justify-content: center;
68
- align-items: center;
69
- min-height: 300px;
70
- padding: 20px;
71
-
72
- .retry-button {
73
- padding: 8px 16px;
74
- background-color: #1890ff;
75
- color: white;
76
- border: none;
77
- border-radius: 4px;
78
- cursor: pointer;
79
- font-size: 14px;
80
- transition: background-color 0.3s;
81
-
82
- &:hover {
83
- background-color: #40a9ff;
84
- }
85
-
86
- &:active {
87
- background-color: #096dd9;
88
- }
89
- }
90
- }
91
- }
92
-
93
- .contact-card {
94
- height: 100%;
95
- border-radius: 12px;
96
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
97
- transition: all 0.3s ease;
98
- border: 1px solid #f0f0f0;
99
-
100
- &:hover {
101
- box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
102
- transform: translateY(-2px);
103
- border-color: #d9d9d9;
104
- }
105
-
106
- .ant-card-body {
107
- padding: 16px;
108
- height: 100%;
109
- display: flex;
110
- align-items: center;
111
- }
112
-
113
- .contact-card-content {
114
- display: flex;
115
- align-items: center;
116
- width: 100%;
117
- gap: 12px;
118
-
119
- .contact-avatar {
120
- flex-shrink: 0;
121
-
122
- .avatar-icon {
123
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
124
- border: 2px solid #fff;
125
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
126
- }
127
- }
128
-
129
- .contact-info {
130
- flex: 1;
131
- min-width: 0;
132
-
133
- .contact-name,
134
- .contact-phone {
135
- display: flex;
136
- align-items: center;
137
- margin-bottom: 4px;
138
- gap: 6px;
139
-
140
- &:last-child {
141
- margin-bottom: 0;
142
- }
143
-
144
- .info-icon {
145
- font-size: 12px;
146
- color: #8c8c8c;
147
- flex-shrink: 0;
148
- }
149
-
150
- .name-text,
151
- .phone-text {
152
- font-size: 14px;
153
- line-height: 1.4;
154
- overflow: hidden;
155
- text-overflow: ellipsis;
156
- white-space: nowrap;
157
- }
158
-
159
- .name-text {
160
- color: #262626;
161
- font-weight: 500;
162
- }
163
-
164
- .phone-text {
165
- color: #595959;
166
- font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo,
167
- Courier, monospace;
168
- }
169
- }
170
-
171
- .contact-name {
172
- margin-bottom: 8px;
173
- }
174
- }
175
- }
176
- }
177
-
178
- // 响应式设计
179
- @media (max-width: 768px) {
180
- margin: 4px 8px;
181
- padding: 8px;
182
-
183
- .card-list-header {
184
- margin-bottom: 12px;
185
- padding-bottom: 8px;
186
-
187
- .header-content {
188
- gap: 12px;
189
- }
190
-
191
- .header-title {
192
- font-size: 16px;
193
- }
194
-
195
- .refresh-button {
196
- height: 28px;
197
- padding: 2px 8px;
198
- font-size: 12px;
199
-
200
- .anticon {
201
- font-size: 11px;
202
- }
203
- }
204
- }
205
-
206
- .contact-card {
207
- .ant-card-body {
208
- padding: 12px;
209
- }
210
-
211
- .contact-card-content {
212
- gap: 8px;
213
-
214
- .contact-avatar {
215
- .avatar-icon {
216
- width: 40px !important;
217
- height: 40px !important;
218
- line-height: 40px !important;
219
- }
220
- }
221
-
222
- .contact-info {
223
- .contact-name,
224
- .contact-phone {
225
- .name-text,
226
- .phone-text {
227
- font-size: 13px;
228
- }
229
- }
230
- }
231
- }
232
- }
233
- }
234
-
235
- @media (max-width: 480px) {
236
- .contact-card {
237
- .contact-card-content {
238
- flex-direction: column;
239
- text-align: center;
240
- gap: 8px;
241
-
242
- .contact-info {
243
- .contact-name,
244
- .contact-phone {
245
- justify-content: center;
246
- }
247
- }
248
- }
249
- }
250
- }
251
- }
252
-
253
- // 全局样式覆盖
254
- .ant-spin-container {
255
- min-height: 200px;
256
- }
257
-
258
- .ant-empty {
259
- padding: 40px 20px;
260
- }
@@ -1,94 +0,0 @@
1
- # 联系人表单组件
2
- 基于 Ant Design 的联系人表单组件,支持姓名、所有人、业务类型、所属部门、手机号等字段的输入和提交。
3
- 【备注】使用 cursor 生成的自定义组件。
4
-
5
- ## 功能特性
6
-
7
- - ✅ 基于 Ant Design 4.x 组件库
8
- - ✅ 表单字段验证(姓名和手机号为必填项)
9
- - ✅ 手机号格式验证
10
- - ✅ 数据提交到 Neo 平台 API
11
- - ✅ 加载状态显示
12
- - ✅ 成功/错误消息提示
13
- - ✅ 响应式设计
14
- - ✅ 使用 React state 管理表单数据
15
-
16
- ## 表单字段
17
-
18
- | 字段名 | 类型 | 必填 | 说明 |
19
- |--------|------|------|------|
20
- | 姓名 | text | ✅ | 联系人姓名 |
21
- | 所有人 | number | ❌ | 联系人用户ID (userId) |
22
- | 业务类型 | select | ❌ | 销售/市场/客服/技术/其他 (entityType) |
23
- | 所属部门 | number | ❌ | 联系人所属部门ID (dimDepart) |
24
- | 手机号 | number | ✅ | 联系人手机号(格式验证)(phone__c) |
25
-
26
- ## API 接口
27
-
28
- 组件会将表单数据提交到以下接口:
29
-
30
- ```
31
- POST /rest/data/v2.0/xobjects/customContact__c
32
- ```
33
-
34
- ### 请求数据格式
35
-
36
- ```json
37
- {
38
- "name": "张三",
39
- "userId": 12345,
40
- "entityType": 3998003734470119,
41
- "dimDepart": 67890,
42
- "phone__c": "13800138000"
43
- }
44
- ```
45
-
46
- ## 组件属性
47
-
48
- | 属性名 | 类型 | 默认值 | 说明 |
49
- |--------|------|--------|------|
50
- | title | string | '创建联系人' | 表单标题 |
51
- | data | object | {} | Neo 平台数据(包含用户信息和系统信息) |
52
-
53
- ## 使用示例
54
-
55
- ```tsx
56
- import ContactForm from './components/contact-form';
57
-
58
- // 在页面中使用
59
- <ContactForm
60
- title="创建新联系人"
61
- data={amisData}
62
- />
63
- ```
64
-
65
- ## 技术栈
66
-
67
- - React 16.9.0
68
- - TypeScript
69
- - Ant Design 4.x
70
- - SCSS
71
-
72
- ## 样式定制
73
-
74
- 组件基于 Ant Design 设计规范,支持通过 SCSS 进行样式定制:
75
-
76
- ```scss
77
- .contact-form-container {
78
- .contact-form-card {
79
- // 卡片样式定制
80
- }
81
-
82
- .contact-form {
83
- // 表单样式定制
84
- }
85
- }
86
- ```
87
-
88
- ## 注意事项
89
-
90
- 1. 确保 Neo 平台已正确配置 `customContact__c` 对象
91
- 2. 组件依赖 `antd` 和 `axios` 进行 UI 渲染和 API 调用
92
- 3. 需要确保用户有创建联系人的权限
93
- 4. 手机号格式验证仅支持中国大陆手机号(1开头的11位数字)
94
- 5. 组件使用 React state 管理表单数据,无需手动处理 ref