neo-cmp-cli 1.9.33 → 1.10.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo-cmp-cli",
3
- "version": "1.9.33",
3
+ "version": "1.10.0",
4
4
  "description": "Neo 自定义组件开发工具,支持react 和 vue2.0技术栈。",
5
5
  "keywords": [
6
6
  "neo-cli",
@@ -0,0 +1,42 @@
1
+ import * as React from 'react';
2
+ // 引入 neo-ui-common / BaseCmp
3
+ // @ts-ignore
4
+ import { BaseCmp } from 'neo-ui-common';
5
+ import './style.scss'; // 组件内容样式
6
+
7
+ interface CustomCmpProps {
8
+ description: string;
9
+ data?: any;
10
+ env?: any;
11
+ className?: string;
12
+ }
13
+
14
+ interface CustomCmpStates {
15
+ [key: string]: any;
16
+ }
17
+
18
+ export default class CustomCmp extends BaseCmp<CustomCmpProps, CustomCmpStates> {
19
+ constructor(props: CustomCmpProps) {
20
+ super(props);
21
+ }
22
+
23
+ render() {
24
+ const { description, className, env } = this.props;
25
+ const ctx = (env || {}).ctx;
26
+ let languageCode = 'zh-CN'; // 默认中文
27
+ // 从上下文中 获取系统语言
28
+ if (ctx && ctx.system && ctx.system.language) {
29
+ languageCode = ctx.system.language;
30
+ }
31
+ console.log('当前自定义组件:', this.props);
32
+
33
+ return (
34
+ <div className={`custom-cmp-container ${className}`}>
35
+ <div className="news-title">
36
+ {languageCode === 'zh-CN' ? '你好,销售易!' : 'Hello NeoCRM!'}
37
+ </div>
38
+ <p>{description}</p>
39
+ </div>
40
+ );
41
+ }
42
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @file 自定义组件对接编辑器的描述文件
3
+ */
4
+ export class CmpModel {
5
+ // 组件名称,用于设置在编辑器左侧组件面板中展示的名称
6
+ label: string = '简单示例组件';
7
+
8
+ // 组件描述,用于设置在编辑器左侧组件面板中展示的描述
9
+ description: string = '暂无描述';
10
+
11
+ // 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示
12
+ // tags: string[] = ['自定义组件'];
13
+
14
+ /**
15
+ * 用于设置组件支持的页面类型
16
+ *
17
+ * 当前 NeoCRM 平台存在的页面类型:
18
+ * all: 1 全页面
19
+ * entityFormPage: 4 实体表单页
20
+ * customPage: 6 自定义页面
21
+ */
22
+ targetPage: string[] = ['all'];
23
+
24
+ /**
25
+ * 用于设置组件支持的终端类型
26
+ *
27
+ * 当前 NeoCRM 平台存在的终端类型:
28
+ * web: 网页端
29
+ * mobile: 移动端
30
+ */
31
+ // targetDevice: string = 'web';
32
+
33
+
34
+ // 组件图标,用于设置在编辑器左侧组件面板中展示的图标
35
+ iconUrl: string = 'https://neo-widgets.bj.bcebos.com/custom-widget.svg';
36
+
37
+ // 初次插入页面的默认属性数据
38
+ defaultComProps = {
39
+ description: '营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。'
40
+ };
41
+
42
+ /**
43
+ * 组件面板配置,用于生成编辑器右侧属性配置面板内容
44
+ */
45
+ propsSchema = [
46
+ {
47
+ type: 'textarea',
48
+ name: 'description',
49
+ label: '组件内容',
50
+ value: '',
51
+ },
52
+ ];
53
+ }
54
+
55
+ export default CmpModel;
@@ -0,0 +1,21 @@
1
+ :root {
2
+ --padding-bottom: 12px;
3
+ }
4
+
5
+ .custom-cmp-container {
6
+ position: relative;
7
+ box-sizing: border-box;
8
+
9
+ /* border-bottom: 1px solid #ececec; */
10
+ margin: 6px 12px;
11
+ padding: 6px var(--padding-bottom);
12
+ background-color: #fff;
13
+
14
+ .news-title {
15
+ padding: 6px 0;
16
+ font-family: PingFangSC-Regular;
17
+ font-size: 16px;
18
+ line-height: 22px;
19
+ color: #5f5e5e;
20
+ }
21
+ }