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
package/README.md CHANGED
@@ -12,11 +12,11 @@ neo-cmp-cli 是 Neo 自定义组件开发工具,基于 [AKFun](https://github.
12
12
 
13
13
  ### 内置的自定义组件模板
14
14
  创建自定义组件时(执行初始化命令 neo init)可选用。
15
- - **React 模板**: [react-custom-cmp-template](https://github.com/wibetter/react-custom-cmp-template)
16
- - **React + TS 模板**: [react-ts-custom-cmp-template](https://github.com/wibetter/react-ts-custom-cmp-template)
17
- - **Antd 模板**: [antd-custom-cmp-template](https://github.com/wibetter/antd-custom-cmp-template) Antd 自定义组件
18
- - **Neo 模板**: [neo-custom-cmp-template](https://github.com/wibetter/neo-custom-cmp-template) 支持使用 Neo 实体数据源(内置 Neo Open API 使用示例)
19
- - **Echarts 模板**: [echarts-custom-cmp-template](https://github.com/wibetter/echarts-custom-cmp-template) Echarts 图表自定义组件
15
+ - **React 模板**: [react-custom-cmp-template](https://github.com/wibetter/react-custom-cmp-template)
16
+ - **React + TS 模板**: [react-ts-custom-cmp-template](https://github.com/wibetter/react-ts-custom-cmp-template) 内置信息卡片列表展示组件示例
17
+ - **Antd 模板**: [antd-custom-cmp-template](https://github.com/wibetter/antd-custom-cmp-template) 内置 Antd UI 组件实现的数据仪表板展示组件示例
18
+ - **Neo 模板**: [neo-custom-cmp-template](https://github.com/wibetter/neo-custom-cmp-template) 支持使用平台实体数据源(内置平台实体数据对象的增删改查示例组件)
19
+ - **Echarts 模板**: [echarts-custom-cmp-template](https://github.com/wibetter/echarts-custom-cmp-template) Echarts 图表自定义组件(含 高德地图展示组件示例)
20
20
  - **Vue2 模板**: [vue2-custom-cmp-template](https://github.com/wibetter/vue2-custom-cmp-template) Vue2.0 自定义组件
21
21
 
22
22
  ## 快速开始
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo-cmp-cli",
3
- "version": "1.3.6",
3
+ "version": "1.3.8",
4
4
  "description": "前端脚手架:自定义组件开发工具,支持react 和 vue2.0技术栈。",
5
5
  "keywords": [
6
6
  "neo-cli",
@@ -37,7 +37,7 @@
37
37
  "url": "https://github.com/wibetter/antd-custom-cmp-template/issues"
38
38
  },
39
39
  "dependencies": {
40
- "neo-register": "^1.0.3",
40
+ "neo-register": "^1.0.5",
41
41
  "antd": "4.9.4",
42
42
  "react": "^16.9.0",
43
43
  "react-dom": "^16.9.0"
@@ -47,7 +47,7 @@
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
48
  "@types/react": "^16.9.11",
49
49
  "@types/react-dom": "^16.9.15",
50
- "neo-cmp-cli": "^1.3.5",
50
+ "neo-cmp-cli": "^1.3.8",
51
51
  "husky": "^4.2.5",
52
52
  "lint-staged": "^10.2.9",
53
53
  "prettier": "^2.0.5"
@@ -37,7 +37,7 @@
37
37
  "url": "https://github.com/wibetter/echarts-custom-cmp-template/issues"
38
38
  },
39
39
  "dependencies": {
40
- "neo-register": "^1.0.3",
40
+ "neo-register": "^1.0.5",
41
41
  "react": "^16.9.0",
42
42
  "react-dom": "^16.9.0",
43
43
  "echarts": "^5.5.1"
@@ -47,7 +47,7 @@
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
48
  "@types/react": "^16.9.11",
49
49
  "@types/react-dom": "^16.9.15",
50
- "neo-cmp-cli": "^1.3.5",
50
+ "neo-cmp-cli": "^1.3.8",
51
51
  "husky": "^4.2.5",
52
52
  "lint-staged": "^10.2.9",
53
53
  "prettier": "^2.0.5",
@@ -0,0 +1,125 @@
1
+ # 地图展示组件
2
+
3
+ 地图展示组件,支持传入地理坐标或位置名称来展示地图区域,并标注当前位置。
4
+
5
+ ## 功能特性
6
+
7
+ - ✅ 支持通过经纬度坐标定位
8
+ - ✅ 支持通过地址名称定位(自动地理编码)
9
+ - ✅ 支持自定义缩放级别
10
+ - ✅ 支持自定义标记点标题
11
+ - ✅ 支持点击标记查看详细地址
12
+ - ✅ 支持自定义地图高度
13
+ - ✅ 响应式设计,适配移动端
14
+ - ✅ 优雅的加载和错误状态提示
15
+
16
+ ## 使用方式
17
+
18
+ ### 1. 通过经纬度定位
19
+
20
+ ```tsx
21
+ <MapWidget
22
+ longitude={116.397428}
23
+ latitude={39.90923}
24
+ markerTitle="北京天安门"
25
+ zoom={15}
26
+ height={400}
27
+ />
28
+ ```
29
+
30
+ ### 2. 通过地址名称定位
31
+
32
+ ```tsx
33
+ <MapWidget
34
+ locationName="北京市天安门广场"
35
+ markerTitle="天安门广场"
36
+ zoom={15}
37
+ height={400}
38
+ />
39
+ ```
40
+
41
+ ## 属性说明
42
+
43
+ | 属性名 | 类型 | 默认值 | 说明 |
44
+ |--------|------|--------|------|
45
+ | longitude | number | 116.397428 | 经度(-180 到 180)|
46
+ | latitude | number | 39.90923 | 纬度(-90 到 90)|
47
+ | locationName | string | - | 位置名称(优先级高于经纬度)|
48
+ | zoom | number | 14 | 地图缩放级别(3-18)|
49
+ | markerTitle | string | '当前位置' | 标记点标题 |
50
+ | height | number | 400 | 地图容器高度(像素)|
51
+
52
+ ## 注意事项
53
+
54
+ 1. **地图脚本配置**:
55
+ - 当前使用的是企业内部部署的高德地图脚本:`https://neors.ingageapp.com/base/js/amap_2.0.5.21.js`
56
+ - 参考了 `neo-ui-component-web` 项目的实现方式
57
+ - 如需使用高德官方 API,可以:
58
+ - 前往[高德开放平台](https://lbs.amap.com/)申请 Web 端 API Key
59
+ - 在 `index.tsx` 的 `loadAMapScript` 方法中取消注释备用方案代码
60
+ - 替换 `amapKey` 为你的 API Key
61
+
62
+ 2. **定位方式优先级**:
63
+ - 如果同时提供了 `locationName` 和经纬度,优先使用 `locationName`
64
+ - 如果都未提供,默认显示北京天安门位置
65
+
66
+ 3. **地理编码说明**:
67
+ - 使用 `locationName` 时,会自动调用高德地图的地理编码服务
68
+ - 建议提供完整的地址信息以提高解析准确度
69
+ - 地理编码仅支持中国大陆地区
70
+
71
+ 4. **性能优化**:
72
+ - 地图脚本采用动态加载方式,不会影响页面初始加载速度
73
+ - 地图实例在组件销毁时会自动清理,避免内存泄漏
74
+ - 已加载的脚本会被缓存,重复使用不会重复加载
75
+
76
+ ## 示例场景
77
+
78
+ ### 场景1:展示公司地址
79
+ ```tsx
80
+ <MapWidget
81
+ locationName="上海市浦东新区世纪大道XXX号"
82
+ markerTitle="公司总部"
83
+ zoom={16}
84
+ height={500}
85
+ />
86
+ ```
87
+
88
+ ### 场景2:展示多个城市坐标
89
+ ```tsx
90
+ // 北京
91
+ <MapWidget longitude={116.397428} latitude={39.90923} markerTitle="北京" />
92
+
93
+ // 上海
94
+ <MapWidget longitude={121.473701} latitude={31.230416} markerTitle="上海" />
95
+
96
+ // 深圳
97
+ <MapWidget longitude={114.057868} latitude={22.543099} markerTitle="深圳" />
98
+ ```
99
+
100
+ ### 场景3:移动端展示
101
+ 组件已自动适配移动端,会根据屏幕尺寸调整样式和布局。
102
+
103
+ ## 技术实现
104
+
105
+ - 基于高德地图 Web API 2.0
106
+ - 使用 React Class Component
107
+ - TypeScript 类型支持
108
+ - SCSS 样式预处理
109
+ - 动态脚本加载
110
+
111
+ ## 浏览器兼容性
112
+
113
+ - Chrome >= 60
114
+ - Firefox >= 60
115
+ - Safari >= 11
116
+ - Edge >= 79
117
+
118
+ ## 更新日志
119
+
120
+ ### v1.0.0 (2025-10-17)
121
+ - ✨ 初始版本发布
122
+ - ✨ 支持经纬度和地址名称定位
123
+ - ✨ 支持标记点和信息窗体
124
+ - ✨ 响应式设计
125
+
@@ -0,0 +1,190 @@
1
+ # 地图组件快速使用指南
2
+
3
+ ## 快速开始
4
+
5
+ ### 1. 基本使用(经纬度定位)
6
+
7
+ ```tsx
8
+ import MapWidget from './components/map-widget';
9
+
10
+ // 在你的页面或组件中使用
11
+ <MapWidget
12
+ longitude={116.397428}
13
+ latitude={39.90923}
14
+ markerTitle="北京天安门"
15
+ zoom={15}
16
+ height={400}
17
+ />
18
+ ```
19
+
20
+ ### 2. 使用地址名称定位
21
+
22
+ ```tsx
23
+ <MapWidget
24
+ locationName="北京市天安门广场"
25
+ markerTitle="天安门广场"
26
+ zoom={15}
27
+ height={500}
28
+ />
29
+ ```
30
+
31
+ ### 3. 在 Neo 平台中使用
32
+
33
+ 在 Neo 低代码平台的页面编辑器中:
34
+
35
+ 1. 从左侧组件面板找到「地图组件」
36
+ 2. 拖拽到页面中
37
+ 3. 在右侧属性面板配置:
38
+ - **位置名称**:输入地址(如"上海市浦东新区世纪大道")
39
+ - **或使用经纬度**:
40
+ - 经度:如 121.473701
41
+ - 纬度:如 31.230416
42
+ - **标记点标题**:设置标记点显示的文字
43
+ - **缩放级别**:3-18,推荐 14-16
44
+ - **地图高度**:默认 400px,可自定义
45
+
46
+ ## 常用城市坐标
47
+
48
+ | 城市 | 经度 | 纬度 |
49
+ |------|------|------|
50
+ | 北京 | 116.397428 | 39.90923 |
51
+ | 上海 | 121.473701 | 31.230416 |
52
+ | 广州 | 113.264385 | 23.129112 |
53
+ | 深圳 | 114.057868 | 22.543099 |
54
+ | 杭州 | 120.155070 | 30.274084 |
55
+ | 成都 | 104.065735 | 30.659462 |
56
+ | 西安 | 108.948024 | 34.263161 |
57
+ | 武汉 | 114.298572 | 30.584355 |
58
+ | 南京 | 118.767413 | 32.041544 |
59
+ | 重庆 | 106.504962 | 29.533155 |
60
+
61
+ ## 配置说明
62
+
63
+ ### 优先级规则
64
+
65
+ 1. 如果同时设置了「位置名称」和「经纬度」,优先使用「位置名称」
66
+ 2. 如果都未设置,默认显示北京天安门
67
+
68
+ ### 地址搜索提示
69
+
70
+ 使用「位置名称」进行定位时,建议提供完整地址以提高准确度:
71
+
72
+ ✅ **好的示例**:
73
+ - "北京市朝阳区建国门外大街1号"
74
+ - "上海市浦东新区世纪大道88号"
75
+ - "广州市天河区珠江新城花城大道"
76
+
77
+ ❌ **不好的示例**:
78
+ - "建国门" (太模糊)
79
+ - "天河" (太宽泛)
80
+ - "世纪大道" (没有城市信息)
81
+
82
+ ### 缩放级别参考
83
+
84
+ - **3-7**:省级/国家级视图
85
+ - **8-11**:城市级视图
86
+ - **12-14**:区县级视图(默认)
87
+ - **15-16**:街道级视图
88
+ - **17-18**:建筑物级视图
89
+
90
+ ## 常见问题
91
+
92
+ ### Q1: 地图无法显示?
93
+
94
+ **可能原因**:
95
+ 1. 网络连接问题
96
+ 2. 地图脚本加载失败
97
+ 3. 提供的地址无法解析
98
+
99
+ **解决方案**:
100
+ - 检查网络连接
101
+ - 查看浏览器控制台错误信息
102
+ - 尝试使用经纬度而不是地址名称
103
+ - 确认地址格式正确
104
+
105
+ ### Q2: 地址定位不准确?
106
+
107
+ **解决方案**:
108
+ - 提供更完整的地址信息
109
+ - 包含省市区县信息
110
+ - 使用标准地址格式
111
+ - 或直接使用经纬度坐标
112
+
113
+ ### Q3: 如何获取某个地点的经纬度?
114
+
115
+ **方法**:
116
+ 1. 访问 [高德地图坐标拾取器](https://lbs.amap.com/tools/picker)
117
+ 2. 搜索或点击地图上的位置
118
+ 3. 复制显示的经纬度坐标
119
+ 4. 注意:高德地图的顺序是 [经度, 纬度]
120
+
121
+ ### Q4: 支持国外地址吗?
122
+
123
+ **说明**:
124
+ - 当前使用高德地图,主要支持中国大陆地区
125
+ - 国外地址可能无法准确定位
126
+ - 如需支持国外地址,需要切换到谷歌地图或其他国际地图服务
127
+
128
+ ## 进阶使用
129
+
130
+ ### 动态更新位置
131
+
132
+ 如果需要根据用户输入或数据动态更新地图位置,可以通过修改组件的 props 来实现:
133
+
134
+ ```tsx
135
+ class MyPage extends React.Component {
136
+ state = {
137
+ longitude: 116.397428,
138
+ latitude: 39.90923,
139
+ };
140
+
141
+ updateLocation = (lng, lat) => {
142
+ this.setState({
143
+ longitude: lng,
144
+ latitude: lat,
145
+ });
146
+ };
147
+
148
+ render() {
149
+ return (
150
+ <div>
151
+ <button onClick={() => this.updateLocation(121.473701, 31.230416)}>
152
+ 定位到上海
153
+ </button>
154
+ <MapWidget
155
+ longitude={this.state.longitude}
156
+ latitude={this.state.latitude}
157
+ markerTitle="当前位置"
158
+ zoom={15}
159
+ />
160
+ </div>
161
+ );
162
+ }
163
+ }
164
+ ```
165
+
166
+ ### 自定义地图样式
167
+
168
+ 如果需要自定义地图的外观,可以修改 `style.scss` 文件:
169
+
170
+ ```scss
171
+ // 修改标题栏颜色
172
+ .map-widget-header {
173
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
174
+ // 改为你喜欢的颜色
175
+ }
176
+
177
+ // 修改信息窗体样式
178
+ .map-info-window {
179
+ padding: 12px;
180
+ // 自定义样式
181
+ }
182
+ ```
183
+
184
+ ## 技术支持
185
+
186
+ 如有问题,请参考:
187
+ - [高德地图 Web API 文档](https://lbs.amap.com/api/javascript-api/summary)
188
+ - [React 组件开发文档](https://react.docschina.org/)
189
+ - [TypeScript 手册](https://www.typescriptlang.org/docs/)
190
+