neo-cmp-cli 1.9.27 → 1.9.28

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 (22) hide show
  1. package/dist/package.json.js +1 -1
  2. package/package.json +1 -1
  3. package/template/antd-custom-cmp-template/package.json +2 -2
  4. package/template/antd-custom-cmp-template/src/components/infoCard__c/index.tsx +4 -2
  5. package/template/antd-custom-cmp-template/src/components/searchWidget__c/index.tsx +64 -0
  6. package/template/antd-custom-cmp-template/src/components/searchWidget__c/model.ts +104 -0
  7. package/template/antd-custom-cmp-template/src/components/searchWidget__c/style.scss +11 -0
  8. package/template/echarts-custom-cmp-template/package.json +2 -2
  9. package/template/echarts-custom-cmp-template/src/components/mapWidget__c/index.tsx +23 -2
  10. package/template/echarts-custom-cmp-template/src/components/mapWidget__c/model.ts +17 -0
  11. package/template/empty-cmp/index.tsx +4 -3
  12. package/template/empty-custom-cmp-template/package.json +2 -2
  13. package/template/neo-custom-cmp-template/package.json +2 -2
  14. package/template/neo-custom-cmp-template/src/components/entityCardList__c/index.tsx +3 -2
  15. package/template/neo-custom-cmp-template/src/components/entityDetail__c/index.tsx +3 -2
  16. package/template/neo-custom-cmp-template/src/components/entityTable__c/index.tsx +4 -1
  17. package/template/neo-custom-cmp-template/src/components/entityTable__c/model.ts +9 -0
  18. package/template/react-custom-cmp-template/package.json +2 -2
  19. package/template/react-custom-cmp-template/src/components/infoCard__c/index.jsx +2 -2
  20. package/template/react-ts-custom-cmp-template/package.json +2 -2
  21. package/template/react-ts-custom-cmp-template/src/components/listWidget__c/index.tsx +3 -2
  22. package/template/vue2-custom-cmp-template/package.json +2 -2
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e="1.9.27";const o={version:e};exports.default=o,exports.version=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e="1.9.28";const o={version:e};exports.default=o,exports.version=e;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo-cmp-cli",
3
- "version": "1.9.27",
3
+ "version": "1.9.28",
4
4
  "description": "Neo 自定义组件开发工具,支持react 和 vue2.0技术栈。",
5
5
  "keywords": [
6
6
  "neo-cli",
@@ -38,7 +38,7 @@
38
38
  "url": "https://github.com/wibetter/antd-custom-cmp-template/issues"
39
39
  },
40
40
  "dependencies": {
41
- "neo-register": "^1.1.0",
41
+ "neo-register": "^1.1.2",
42
42
  "antd": "4.9.4",
43
43
  "react": "^16.9.0",
44
44
  "react-dom": "^16.9.0"
@@ -48,7 +48,7 @@
48
48
  "@commitlint/config-conventional": "^9.1.1",
49
49
  "@types/react": "^16.9.11",
50
50
  "@types/react-dom": "^16.9.15",
51
- "neo-cmp-cli": "^1.9.21",
51
+ "neo-cmp-cli": "^1.9.28",
52
52
  "husky": "^4.2.5",
53
53
  "lint-staged": "^10.2.9",
54
54
  "prettier": "^2.0.5"
@@ -9,6 +9,7 @@ interface InfoCardProps {
9
9
  imgCount: number;
10
10
  commentCount: number;
11
11
  data?: any;
12
+ className?: string;
12
13
  }
13
14
 
14
15
  export default class InfoCard extends React.PureComponent<InfoCardProps> {
@@ -28,7 +29,8 @@ export default class InfoCard extends React.PureComponent<InfoCardProps> {
28
29
  }
29
30
 
30
31
  render() {
31
- const { title, backgroundImage, imgCount, commentCount } = this.props;
32
+ const { title, backgroundImage, imgCount, commentCount, className } =
33
+ this.props;
32
34
  console.log('当前自定义组件:', this.props, this);
33
35
  const curAmisData = this.props.data || {};
34
36
 
@@ -38,7 +40,7 @@ export default class InfoCard extends React.PureComponent<InfoCardProps> {
38
40
  const curBackgroundImage =
39
41
  backgroundImage || 'https://neo-widgets.bj.bcebos.com/NeoCRM.jpg';
40
42
  return (
41
- <div className="info-card-container">
43
+ <div className={`info-card-container ${className}`}>
42
44
  <div className="news-title">
43
45
  {title ||
44
46
  '营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。'}
@@ -0,0 +1,64 @@
1
+ import * as React from 'react';
2
+ import { Input, message } from 'antd';
3
+ // 引入 neo-ui-common / NeoEvent
4
+ // @ts-ignore
5
+ import { NeoEvent } from 'neo-ui-common'; // 后续考虑 使用 props.dispatchEvent 方法替代
6
+ import './style.scss';
7
+
8
+ const { Search } = Input;
9
+
10
+ interface SearchWidgetProps {
11
+ placeholder?: string;
12
+ size?: 'large' | 'middle' | 'small';
13
+ enterButton?: boolean | string;
14
+ allowClear?: boolean;
15
+ disabled?: boolean;
16
+ maxLength?: number;
17
+ data?: any;
18
+ env?: any;
19
+ className?: string;
20
+ }
21
+
22
+ export default class SearchWidget extends React.PureComponent<SearchWidgetProps> {
23
+ constructor(props: SearchWidgetProps) {
24
+ super(props);
25
+ this.handleSearch = this.handleSearch.bind(this);
26
+ }
27
+
28
+ @NeoEvent.dispatch
29
+ handleSearch(value: string) {
30
+ if (!value || value.trim() === '') {
31
+ message.warning('请输入搜索内容');
32
+ return;
33
+ }
34
+ message.success(`搜索内容:${value}`);
35
+ }
36
+
37
+ render() {
38
+ const {
39
+ placeholder = '请输入搜索内容',
40
+ size = 'middle',
41
+ enterButton = true,
42
+ allowClear = true,
43
+ disabled = false,
44
+ maxLength,
45
+ className,
46
+ } = this.props;
47
+
48
+ console.log('当前自定义组件:', this.props, this);
49
+
50
+ return (
51
+ <div className={`search-widget-container ${className}`}>
52
+ <Search
53
+ placeholder={placeholder}
54
+ size={size}
55
+ enterButton={enterButton}
56
+ allowClear={allowClear}
57
+ disabled={disabled}
58
+ maxLength={maxLength}
59
+ onSearch={this.handleSearch}
60
+ />
61
+ </div>
62
+ );
63
+ }
64
+ }
@@ -0,0 +1,104 @@
1
+ /**
2
+ * @file 自定义组件对接编辑器的描述文件
3
+ */
4
+ export class SearchWidgetModel {
5
+ /**
6
+ * cmpType 为自定义组件名称,用于标识组件的唯一性
7
+ * 在构建时根据当前组件目录名称自动生成
8
+ */
9
+ // cmpType: string = 'searchWidget';
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
+ * entityFormPage: 4 实体表单页
26
+ * customPage: 6 自定义页面
27
+ */
28
+ // targetPage: string[] = ['all'];
29
+
30
+ // 组件图标,用于设置在编辑器左侧组件面板中展示的图标
31
+ iconUrl: string = 'https://neo-widgets.bj.bcebos.com/custom-widget.svg';
32
+ // iconUrl = 'https://neo-widgets.bj.bcebos.com/favicon.png';
33
+
34
+ // 初次插入页面的默认属性数据
35
+ defaultComProps = {
36
+ placeholder: '请输入搜索内容',
37
+ label: '搜索组件',
38
+ size: 'middle',
39
+ enterButton: true,
40
+ allowClear: true,
41
+ disabled: false,
42
+ };
43
+
44
+ /**
45
+ * 声明当前组件会触发的所有事件
46
+ * 备注:页面设计器端可用于进行事件绑定,在组件属性配置模式中配置事件动作
47
+ */
48
+ events = [
49
+ {
50
+ apiKey: 'handleSearch', // 事件名称
51
+ label: '提交表单后', // 事件
52
+ helpText: '表单提交后触发该事件', // 信息icon hover 时的提示文本
53
+ },
54
+ ];
55
+
56
+ /**
57
+ * 组件面板配置,用于生成编辑器右侧属性配置面板内容
58
+ */
59
+ propsSchema = [
60
+ {
61
+ type: 'text',
62
+ name: 'placeholder',
63
+ label: '占位符',
64
+ value: '请输入搜索内容',
65
+ },
66
+ {
67
+ type: 'select',
68
+ name: 'size',
69
+ label: '尺寸',
70
+ options: [
71
+ { label: '大', value: 'large' },
72
+ { label: '中', value: 'middle' },
73
+ { label: '小', value: 'small' },
74
+ ],
75
+ value: 'middle',
76
+ },
77
+ {
78
+ type: 'switch',
79
+ name: 'enterButton',
80
+ label: '显示搜索按钮',
81
+ value: true,
82
+ },
83
+ {
84
+ type: 'switch',
85
+ name: 'allowClear',
86
+ label: '允许清除',
87
+ value: true,
88
+ },
89
+ {
90
+ type: 'switch',
91
+ name: 'disabled',
92
+ label: '禁用状态',
93
+ value: false,
94
+ },
95
+ {
96
+ type: 'number',
97
+ name: 'maxLength',
98
+ label: '最大长度',
99
+ value: undefined,
100
+ },
101
+ ];
102
+ }
103
+
104
+ export default SearchWidgetModel;
@@ -0,0 +1,11 @@
1
+ .search-widget-container {
2
+ position: relative;
3
+ box-sizing: border-box;
4
+ margin: 6px 12px;
5
+ padding: 6px 0;
6
+ background-color: #fff;
7
+
8
+ .ant-input-search {
9
+ width: 100%;
10
+ }
11
+ }
@@ -38,7 +38,7 @@
38
38
  "url": "https://github.com/wibetter/echarts-custom-cmp-template/issues"
39
39
  },
40
40
  "dependencies": {
41
- "neo-register": "^1.1.0",
41
+ "neo-register": "^1.1.2",
42
42
  "react": "^16.9.0",
43
43
  "react-dom": "^16.9.0",
44
44
  "echarts": "^5.5.1"
@@ -48,7 +48,7 @@
48
48
  "@commitlint/config-conventional": "^9.1.1",
49
49
  "@types/react": "^16.9.11",
50
50
  "@types/react-dom": "^16.9.15",
51
- "neo-cmp-cli": "^1.9.21",
51
+ "neo-cmp-cli": "^1.9.28",
52
52
  "husky": "^4.2.5",
53
53
  "lint-staged": "^10.2.9",
54
54
  "prettier": "^2.0.5",
@@ -23,6 +23,7 @@ interface MapWidgetProps {
23
23
  // 地图高度
24
24
  height?: number;
25
25
  data?: any;
26
+ className?: string;
26
27
  }
27
28
 
28
29
  interface MapWidgetState {
@@ -119,6 +120,26 @@ export default class MapWidget extends React.PureComponent<
119
120
  }
120
121
  };
121
122
 
123
+ /**
124
+ * 展示对应区域的地图
125
+ */
126
+ showLocation = (newLocationName: string) => {
127
+ if (newLocationName !== this.locationName) {
128
+ this.setState(
129
+ {
130
+ urlLocationName: newLocationName,
131
+ error: undefined,
132
+ },
133
+ () => {
134
+ // 重新初始化地图
135
+ this.initMap(newLocationName);
136
+ },
137
+ );
138
+ } else {
139
+ console.warn('当前地址未发现变化。');
140
+ }
141
+ };
142
+
122
143
  /**
123
144
  * 动态加载高德地图脚本
124
145
  */
@@ -320,7 +341,7 @@ export default class MapWidget extends React.PureComponent<
320
341
  };
321
342
 
322
343
  render() {
323
- const { height = 400, data } = this.props;
344
+ const { height = 400, data, className } = this.props;
324
345
  const { isLoading, error } = this.state;
325
346
 
326
347
  const curAmisData = data || {};
@@ -329,7 +350,7 @@ export default class MapWidget extends React.PureComponent<
329
350
  console.log('this.props:', this.props);
330
351
 
331
352
  return (
332
- <div className="map-widget-wrapper">
353
+ <div className={`map-widget-wrapper ${className}`}>
333
354
  {/*
334
355
  // 地图头部: 显示地图标题和当前位置地址
335
356
  <div className="map-widget-header">
@@ -41,6 +41,23 @@ export class MapWidgetModel {
41
41
  height: 400, // 地图高度
42
42
  };
43
43
 
44
+ // 当前组件支持的函数列表(其他组件可触发当前组件的函数)
45
+ functions = [
46
+ {
47
+ apiKey: 'showLocation',
48
+ label: '展示对应区域',
49
+ helpTextKey: '展示对应区域的地图',
50
+ funcInParams: [
51
+ {
52
+ apiKey: 'newLocationName',
53
+ label: '区域名称',
54
+ type: 'String',
55
+ required: true,
56
+ }
57
+ ]
58
+ }
59
+ ]
60
+
44
61
  /**
45
62
  * 组件面板配置,用于生成编辑器右侧属性配置面板内容
46
63
  */
@@ -4,6 +4,7 @@ import './style.scss'; // 组件内容样式
4
4
  interface CustomCmpProps {
5
5
  title: string;
6
6
  data?: any;
7
+ className?: string;
7
8
  }
8
9
 
9
10
  interface CustomCmpStates {
@@ -16,11 +17,11 @@ export default class CustomCmp extends React.PureComponent<CustomCmpProps, Custo
16
17
  }
17
18
 
18
19
  render() {
19
- const { title } = this.props;
20
- console.log('当前自定义组件:', this.props, this);
20
+ const { title, className } = this.props;
21
+ console.log('当前自定义组件:', this.props);
21
22
 
22
23
  return (
23
- <div className="custom-cmp-container">
24
+ <div className={`custom-cmp-container ${className}`}>
24
25
  <div className="news-title">
25
26
  {title}
26
27
  </div>
@@ -37,7 +37,7 @@
37
37
  "url": "https://github.com/wibetter/empty-custom-cmp-template/issues"
38
38
  },
39
39
  "dependencies": {
40
- "neo-register": "^1.1.0",
40
+ "neo-register": "^1.1.2",
41
41
  "react": "^16.9.0",
42
42
  "react-dom": "^16.9.0",
43
43
  "antd": "4.9.4",
@@ -48,7 +48,7 @@
48
48
  "@commitlint/config-conventional": "^9.1.1",
49
49
  "@types/react": "^16.9.11",
50
50
  "@types/react-dom": "^16.9.15",
51
- "neo-cmp-cli": "^1.9.21",
51
+ "neo-cmp-cli": "^1.9.27",
52
52
  "husky": "^4.2.5",
53
53
  "lint-staged": "^10.2.9",
54
54
  "prettier": "^2.0.5"
@@ -41,7 +41,7 @@
41
41
  "url": "https://github.com/wibetter/neo-custom-cmp-template/issues"
42
42
  },
43
43
  "dependencies": {
44
- "neo-register": "^1.1.0",
44
+ "neo-register": "^1.1.2",
45
45
  "react": "^16.9.0",
46
46
  "react-dom": "^16.9.0",
47
47
  "axios": "^0.27.2",
@@ -55,7 +55,7 @@
55
55
  "@types/react": "^16.9.11",
56
56
  "@types/react-dom": "^16.9.15",
57
57
  "@types/axios": "^0.14.0",
58
- "neo-cmp-cli": "^1.9.21",
58
+ "neo-cmp-cli": "^1.9.28",
59
59
  "husky": "^4.2.5",
60
60
  "lint-staged": "^10.2.9",
61
61
  "prettier": "^2.0.5"
@@ -19,6 +19,7 @@ interface EntityCardListProps {
19
19
  xObjectDataApi?: any;
20
20
  entityData?: any;
21
21
  data?: any;
22
+ className?: string;
22
23
  }
23
24
 
24
25
  interface ContactData {
@@ -154,14 +155,14 @@ export default class EntityCardList extends BaseCmp<
154
155
  }
155
156
 
156
157
  render() {
157
- const { title } = this.props;
158
+ const { title, className } = this.props;
158
159
  const { objectDataList, loading, error } = this.state;
159
160
  const curAmisData = this.props.data || {};
160
161
  const systemInfo = curAmisData.__NeoSystemInfo || {};
161
162
  console.log('this.props:', this.props);
162
163
 
163
164
  return (
164
- <div className="entity-card-list-container">
165
+ <div className={`entity-card-list-container ${className}`}>
165
166
  <div className="card-list-header">
166
167
  <div className="header-content">
167
168
  <h3 className="header-title">
@@ -35,6 +35,7 @@ interface EntityDetailProps {
35
35
  showTitle?: boolean;
36
36
  data?: any;
37
37
  entityData?: any;
38
+ className?: string;
38
39
  }
39
40
 
40
41
  interface FieldDescription {
@@ -270,14 +271,14 @@ export default class EntityDetail extends React.PureComponent<
270
271
  }
271
272
 
272
273
  render() {
273
- const { title, showTitle = true } = this.props;
274
+ const { title, showTitle = true, className } = this.props;
274
275
  const { loading, error } = this.state;
275
276
  const curAmisData = this.props.data || {};
276
277
  const systemInfo = curAmisData.__NeoSystemInfo || {};
277
278
  console.log('this.props:', this.props);
278
279
 
279
280
  return (
280
- <div className="entity-detail-container">
281
+ <div className={`entity-detail-container ${className}`}>
281
282
  {showTitle && (
282
283
  <div className="detail-header">
283
284
  <div className="header-content">
@@ -70,6 +70,8 @@ interface EntityTableProps {
70
70
  showDeleteButton?: boolean;
71
71
  /** 是否为自定义实体对象 */
72
72
  custom?: boolean;
73
+ /** 组件类名 */
74
+ className?: string;
73
75
  }
74
76
 
75
77
  /**
@@ -702,6 +704,7 @@ export default class EntityTable extends BaseCmp<
702
704
  isModalVisible,
703
705
  isEditMode,
704
706
  } = this.state;
707
+ const { className } = this.props;
705
708
  const curAmisData = this.props.data || {};
706
709
  const systemInfo = curAmisData.__NeoSystemInfo || {};
707
710
  const { xObjectApiKey } = this.props.xObjectDataApi || {};
@@ -709,7 +712,7 @@ export default class EntityTable extends BaseCmp<
709
712
  console.log('this.props:', this.props, columns, this);
710
713
 
711
714
  return (
712
- <div className="entity-table-container">
715
+ <div className={`entity-table-container ${className}`}>
713
716
  <Card>
714
717
  <div className="table-header">
715
718
  <div className="header-content">
@@ -34,6 +34,15 @@ export class EntityTableModel {
34
34
  */
35
35
  targetPage: string[] = ['all'];
36
36
 
37
+ /**
38
+ * 用于设置组件支持的终端类型
39
+ *
40
+ * 当前 NeoCRM 平台存在的终端类型:
41
+ * web: 网页端
42
+ * mobile: 移动端
43
+ */
44
+ targetDevice: string = 'all';
45
+
37
46
  /** 初次插入页面的默认属性数据 */
38
47
  defaultComProps = {
39
48
  title: '实体数据表格',
@@ -38,14 +38,14 @@
38
38
  "url": "https://github.com/wibetter/react-custom-cmp-template/issues"
39
39
  },
40
40
  "dependencies": {
41
- "neo-register": "^1.1.0",
41
+ "neo-register": "^1.1.2",
42
42
  "react": "^16.9.0",
43
43
  "react-dom": "^16.9.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@commitlint/cli": "^8.3.5",
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
- "neo-cmp-cli": "^1.9.21",
48
+ "neo-cmp-cli": "^1.9.28",
49
49
  "husky": "^4.2.5",
50
50
  "lint-staged": "^10.2.9",
51
51
  "prettier": "^2.0.5"
@@ -15,11 +15,11 @@ export default class InfoCard extends React.PureComponent {
15
15
  }
16
16
  }
17
17
  render() {
18
- const { title, backgroundImage, imgCount, commentCount } = this.props;
18
+ const { title, backgroundImage, imgCount, commentCount, className } = this.props;
19
19
  const curBackgroundImage =
20
20
  backgroundImage || 'https://neo-widgets.bj.bcebos.com/NeoCRM.jpg';
21
21
  return (
22
- <div className="info-card-container">
22
+ <div className={`info-card-container ${className}`}>
23
23
  <div className="news-title">
24
24
  {title ||
25
25
  '营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。'}
@@ -38,7 +38,7 @@
38
38
  "url": "https://github.com/wibetter/react-ts-custom-cmp-template/issues"
39
39
  },
40
40
  "dependencies": {
41
- "neo-register": "^1.1.0",
41
+ "neo-register": "^1.1.2",
42
42
  "react": "^16.9.0",
43
43
  "react-dom": "^16.9.0"
44
44
  },
@@ -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.9.21",
50
+ "neo-cmp-cli": "^1.9.28",
51
51
  "husky": "^4.2.5",
52
52
  "lint-staged": "^10.2.9",
53
53
  "prettier": "^2.0.5"
@@ -22,6 +22,7 @@ interface ListWidgetProps {
22
22
  itemCount: number;
23
23
  listType: 'default' | 'card' | 'simple';
24
24
  data?: any;
25
+ className?: string;
25
26
  }
26
27
 
27
28
  /**
@@ -183,7 +184,7 @@ export default class ListWidget extends React.PureComponent<ListWidgetProps> {
183
184
  }
184
185
 
185
186
  render() {
186
- const { title, itemCount, listType, data } = this.props;
187
+ const { title, itemCount, listType, data, className } = this.props;
187
188
 
188
189
  const curAmisData = data || {};
189
190
  const systemInfo = curAmisData.__NeoSystemInfo || {};
@@ -191,7 +192,7 @@ export default class ListWidget extends React.PureComponent<ListWidgetProps> {
191
192
  const mockData = this.generateMockData(itemCount);
192
193
 
193
194
  return (
194
- <div className="list-widget-container">
195
+ <div className={`list-widget-container ${className}`}>
195
196
  <div className="list-header">
196
197
  <h2 className="list-title">
197
198
  {title || '内容列表'}
@@ -38,14 +38,14 @@
38
38
  "url": "https://github.com/wibetter/vue2-custom-cmp-template/issues"
39
39
  },
40
40
  "dependencies": {
41
- "neo-register": "^1.1.0",
41
+ "neo-register": "^1.1.2",
42
42
  "vue": "^2.6.14",
43
43
  "element-ui": "^2.15.12"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@commitlint/cli": "^8.3.5",
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
- "neo-cmp-cli": "^1.9.21",
48
+ "neo-cmp-cli": "^1.9.28",
49
49
  "husky": "^4.2.5",
50
50
  "lint-staged": "^10.2.9",
51
51
  "prettier": "^2.0.5",