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
@@ -0,0 +1,153 @@
1
+ /**
2
+ * @file 图表组件对接编辑器的描述文件
3
+ */
4
+ export class ChartWidgetModel {
5
+ /**
6
+ * cmpType 为自定义组件名称,用于标识组件的唯一性
7
+ * 在构建时根据当前组件目录名称自动生成
8
+ */
9
+ // cmpType: string = 'chart-widget';
10
+
11
+ // 组件名称,用于设置在编辑器左侧组件面板中展示的名称
12
+ label: string = '酷炫图表组件';
13
+
14
+ // 组件描述,用于设置在编辑器左侧组件面板中展示的描述
15
+ description: string =
16
+ '支持多种图表类型切换的专业图表组件,支持丰富的配置选项';
17
+
18
+ // 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
19
+ tags: string[] = ['自定义组件'];
20
+
21
+ // 组件图标,用于设置在编辑器左侧组件面板中展示的图标
22
+ iconSrc: string = 'https://custom-widgets.bj.bcebos.com/chart.svg';
23
+
24
+ // 初次插入页面的默认属性数据
25
+ defaultComProps = {
26
+ chartType: 'line',
27
+ title: '销售趋势分析',
28
+ subtitle: '2025年数据统计',
29
+ width: 800,
30
+ height: 400,
31
+ theme: 'default',
32
+ showLegend: true,
33
+ showTooltip: true,
34
+ showDataZoom: false,
35
+ showGrid: true,
36
+ backgroundColor: 'transparent',
37
+ textColor: '#333',
38
+ mockData: {
39
+ xAxis: ['1月', '2月', '3月', '4月', '5月', '6月'],
40
+ series: [
41
+ {
42
+ name: '销售额',
43
+ data: [120, 200, 150, 80, 70, 110],
44
+ },
45
+ ],
46
+ },
47
+ dataConfig: {
48
+ enableMock: true,
49
+ dataSource: 'mock',
50
+ },
51
+ };
52
+
53
+ // 设计器端预览时展示的默认数据
54
+ previewComProps = {
55
+ label: '酷炫图表组件',
56
+ chartType: 'bar',
57
+ title: '预览图表',
58
+ width: 400,
59
+ height: 300,
60
+ };
61
+
62
+ /**
63
+ * 组件面板配置,用于生成编辑器右侧属性配置面板内容
64
+ * 使用 JSON AMIS 表单配置
65
+ */
66
+ propsSchema = [
67
+ {
68
+ type: 'select',
69
+ name: 'chartType',
70
+ label: '图表类型',
71
+ value: 'line',
72
+ options: [
73
+ { label: '折线图', value: 'line' },
74
+ { label: '柱状图', value: 'bar' },
75
+ { label: '饼图', value: 'pie' },
76
+ { label: '散点图', value: 'scatter' },
77
+ { label: '雷达图', value: 'radar' },
78
+ { label: '仪表盘', value: 'gauge' },
79
+ { label: '漏斗图', value: 'funnel' },
80
+ { label: '桑基图', value: 'sankey' },
81
+ ],
82
+ clearable: false,
83
+ },
84
+ {
85
+ type: 'text',
86
+ name: 'title',
87
+ label: '主标题',
88
+ value: '销售趋势分析',
89
+ placeholder: '请输入图表标题',
90
+ },
91
+ {
92
+ type: 'text',
93
+ name: 'subtitle',
94
+ label: '副标题',
95
+ value: '2025年数据统计',
96
+ placeholder: '请输入图表副标题',
97
+ },
98
+ {
99
+ type: 'number',
100
+ name: 'width',
101
+ label: '宽度',
102
+ value: 800,
103
+ min: 200,
104
+ max: 2000,
105
+ step: 10,
106
+ },
107
+ {
108
+ type: 'number',
109
+ name: 'height',
110
+ label: '高度',
111
+ value: 400,
112
+ min: 200,
113
+ max: 1000,
114
+ step: 10,
115
+ },
116
+ /*
117
+ // 注释掉未生效的配置项
118
+ {
119
+ type: 'color',
120
+ name: 'backgroundColor',
121
+ label: '背景颜色',
122
+ value: 'transparent',
123
+ },
124
+ {
125
+ type: 'color',
126
+ name: 'textColor',
127
+ label: '文字颜色',
128
+ value: '#333',
129
+ },
130
+ */
131
+ {
132
+ type: 'switch',
133
+ name: 'showLegend',
134
+ label: '显示图例',
135
+ value: true,
136
+ },
137
+ {
138
+ type: 'switch',
139
+ name: 'showTooltip',
140
+ label: '显示提示框',
141
+ value: true,
142
+ }
143
+ ];
144
+
145
+ // 支持 函数式写法:propsSchemaCreator,com 为组件实例。优先级比 propsSchema 高
146
+ /*
147
+ propsSchemaCreator = (com: any) => {
148
+ return [];
149
+ };
150
+ */
151
+ }
152
+
153
+ export default ChartWidgetModel;
@@ -0,0 +1,209 @@
1
+ .chart-widget-container {
2
+ position: relative;
3
+ width: 100%;
4
+ height: 100%;
5
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
6
+ border-radius: 12px;
7
+ padding: 20px;
8
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
9
+ backdrop-filter: blur(10px);
10
+ border: 1px solid rgba(255, 255, 255, 0.2);
11
+ overflow: hidden;
12
+
13
+ &::before {
14
+ content: '';
15
+ position: absolute;
16
+ top: 0;
17
+ left: 0;
18
+ right: 0;
19
+ bottom: 0;
20
+ background: linear-gradient(45deg,
21
+ rgba(255, 255, 255, 0.1) 0%,
22
+ rgba(255, 255, 255, 0.05) 50%,
23
+ rgba(255, 255, 255, 0.1) 100%);
24
+ pointer-events: none;
25
+ }
26
+
27
+ .user-info {
28
+ position: absolute;
29
+ top: 10px;
30
+ right: 20px;
31
+ z-index: 10;
32
+ display: flex;
33
+ flex-direction: column;
34
+ align-items: flex-end;
35
+ gap: 4px;
36
+
37
+ .user-name,
38
+ .tenant-name {
39
+ background: rgba(255, 255, 255, 0.9);
40
+ color: #333;
41
+ padding: 4px 8px;
42
+ border-radius: 12px;
43
+ font-size: 12px;
44
+ font-weight: 500;
45
+ backdrop-filter: blur(10px);
46
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
47
+ }
48
+
49
+ .user-name {
50
+ background: linear-gradient(135deg, #667eea, #764ba2);
51
+ color: white;
52
+ }
53
+ }
54
+
55
+ .chart-container {
56
+ position: relative;
57
+ margin: 0 auto;
58
+ z-index: 1;
59
+ background: rgba(255, 255, 255, 0.95);
60
+ border-radius: 8px;
61
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
62
+ backdrop-filter: blur(10px);
63
+ border: 1px solid rgba(255, 255, 255, 0.3);
64
+ overflow: hidden;
65
+ transition: all 0.3s ease;
66
+
67
+ &:hover {
68
+ transform: translateY(-2px);
69
+ box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
70
+ }
71
+
72
+ // ECharts 容器样式增强
73
+ .echarts-for-react {
74
+ width: 100% !important;
75
+ height: 100% !important;
76
+ }
77
+ }
78
+
79
+ // 响应式设计
80
+ @media (max-width: 768px) {
81
+ padding: 15px;
82
+
83
+ .user-info {
84
+ top: 8px;
85
+ right: 15px;
86
+
87
+ .user-name,
88
+ .tenant-name {
89
+ font-size: 11px;
90
+ padding: 3px 6px;
91
+ }
92
+ }
93
+ }
94
+
95
+ // 深色主题适配
96
+ &.dark-theme {
97
+ background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
98
+
99
+ .chart-container {
100
+ background: rgba(44, 62, 80, 0.95);
101
+ border-color: rgba(255, 255, 255, 0.1);
102
+ }
103
+ }
104
+
105
+ // 动画效果
106
+ &.loading {
107
+ .chart-container {
108
+ position: relative;
109
+
110
+ &::after {
111
+ content: '';
112
+ position: absolute;
113
+ top: 50%;
114
+ left: 50%;
115
+ width: 40px;
116
+ height: 40px;
117
+ margin: -20px 0 0 -20px;
118
+ border: 3px solid #f3f3f3;
119
+ border-top: 3px solid #667eea;
120
+ border-radius: 50%;
121
+ animation: spin 1s linear infinite;
122
+ }
123
+ }
124
+ }
125
+ }
126
+
127
+ @keyframes spin {
128
+ 0% { transform: rotate(0deg); }
129
+ 100% { transform: rotate(360deg); }
130
+ }
131
+
132
+ // 图表类型特定样式
133
+ .chart-widget-container {
134
+ &.line-chart {
135
+ .chart-container {
136
+ background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
137
+ }
138
+ }
139
+
140
+ &.bar-chart {
141
+ .chart-container {
142
+ background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 152, 0, 0.1));
143
+ }
144
+ }
145
+
146
+ &.pie-chart {
147
+ .chart-container {
148
+ background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(139, 195, 74, 0.1));
149
+ }
150
+ }
151
+
152
+ &.scatter-chart {
153
+ .chart-container {
154
+ background: linear-gradient(135deg, rgba(156, 39, 176, 0.1), rgba(233, 30, 99, 0.1));
155
+ }
156
+ }
157
+
158
+ &.radar-chart {
159
+ .chart-container {
160
+ background: linear-gradient(135deg, rgba(0, 150, 136, 0.1), rgba(0, 188, 212, 0.1));
161
+ }
162
+ }
163
+
164
+ &.gauge-chart {
165
+ .chart-container {
166
+ background: linear-gradient(135deg, rgba(255, 87, 34, 0.1), rgba(255, 152, 0, 0.1));
167
+ }
168
+ }
169
+
170
+ &.funnel-chart {
171
+ .chart-container {
172
+ background: linear-gradient(135deg, rgba(63, 81, 181, 0.1), rgba(103, 58, 183, 0.1));
173
+ }
174
+ }
175
+
176
+ &.sankey-chart {
177
+ .chart-container {
178
+ background: linear-gradient(135deg, rgba(121, 85, 72, 0.1), rgba(96, 125, 139, 0.1));
179
+ }
180
+ }
181
+ }
182
+
183
+ // 全局图表样式覆盖
184
+ .chart-widget-container {
185
+ .chart-container {
186
+ // 确保 ECharts 图表在容器内正确显示
187
+ canvas {
188
+ border-radius: 8px;
189
+ }
190
+
191
+ // 图表标题样式
192
+ .echarts-title {
193
+ font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
194
+ font-weight: 600;
195
+ }
196
+
197
+ // 图例样式
198
+ .echarts-legend {
199
+ font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
200
+ }
201
+
202
+ // 工具提示样式
203
+ .echarts-tooltip {
204
+ font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
205
+ border-radius: 8px;
206
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
207
+ }
208
+ }
209
+ }
@@ -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,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
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "echart-custom-cmp-template",
2
+ "name": "neo-custom-cmp-template",
3
3
  "version": "1.1.0",
4
4
  "description": "neo自定义组件模板(react&ts技术栈)",
5
5
  "keywords": [
@@ -10,7 +10,7 @@
10
10
  "author": "wibetter",
11
11
  "license": "MIT",
12
12
  "scripts": {
13
- "preview": "neo preview --cmpType=info-card",
13
+ "preview": "neo preview --cmpType=neo-entity-grid",
14
14
  "linkDebug": "neo linkDebug",
15
15
  "publish2oss": "neo publish2oss",
16
16
  "format": "prettier --write \"src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}\""
@@ -31,21 +31,23 @@
31
31
  },
32
32
  "repository": {
33
33
  "type": "git",
34
- "url": "https://git@github.com:wibetter/echart-custom-cmp-template.git"
34
+ "url": "https://git@github.com:wibetter/neo-custom-cmp-template.git"
35
35
  },
36
36
  "bugs": {
37
- "url": "https://github.com/wibetter/echart-custom-cmp-template/issues"
37
+ "url": "https://github.com/wibetter/neo-custom-cmp-template/issues"
38
38
  },
39
39
  "dependencies": {
40
40
  "neo-register": "^1.0.2",
41
41
  "react": "^16.9.0",
42
- "react-dom": "^16.9.0"
42
+ "react-dom": "^16.9.0",
43
+ "axios": "^0.27.2"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@commitlint/cli": "^8.3.5",
46
47
  "@commitlint/config-conventional": "^9.1.1",
47
48
  "@types/react": "^16.9.11",
48
49
  "@types/react-dom": "^16.9.15",
50
+ "@types/axios": "^0.14.0",
49
51
  "neo-cmp-cli": "^1.1.8",
50
52
  "husky": "^4.2.5",
51
53
  "lint-staged": "^10.2.9",