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.
- package/package.json +1 -1
- package/src/cmpUtils/createCommonModulesCode.js +73 -0
- package/src/cmpUtils/getCmpPreview.js +3 -1
- package/src/module/index.js +10 -0
- package/src/module/main.js +45 -10
- package/src/module/neoInitByCopy.js +8 -0
- package/src/neo/neoRequire.js +14 -2
- package/src/template/antd-custom-cmp-template/neo.config.js +6 -0
- package/src/template/antd-custom-cmp-template/src/components/data-dashboard/model.ts +2 -2
- package/src/template/antd-custom-cmp-template/src/components/data-dashboard/style.scss +377 -119
- package/src/template/echarts-custom-cmp-template/README.md +91 -0
- package/src/template/echarts-custom-cmp-template/neo.config.js +117 -0
- package/src/template/echarts-custom-cmp-template/package.json +60 -0
- package/src/template/echarts-custom-cmp-template/src/components/chart-widget/README.md +186 -0
- package/src/template/echarts-custom-cmp-template/src/components/chart-widget/index.tsx +724 -0
- package/src/template/echarts-custom-cmp-template/src/components/chart-widget/model.ts +153 -0
- package/src/template/echarts-custom-cmp-template/src/components/chart-widget/style.scss +209 -0
- package/src/template/neo-custom-cmp-template/.prettierrc.js +12 -0
- package/src/template/neo-custom-cmp-template/commitlint.config.js +59 -0
- package/src/template/{echart-custom-cmp-template → neo-custom-cmp-template}/package.json +7 -5
- package/src/template/neo-custom-cmp-template/public/css/base.css +283 -0
- package/src/template/neo-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/src/template/neo-custom-cmp-template/public/template.html +13 -0
- package/src/template/neo-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/src/template/neo-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/src/template/neo-custom-cmp-template/src/components/info-card/index.tsx +69 -0
- package/src/template/neo-custom-cmp-template/src/components/info-card/model.ts +78 -0
- package/src/template/neo-custom-cmp-template/src/components/info-card/style.scss +105 -0
- package/src/template/neo-custom-cmp-template/src/components/neo-entity-grid/README.md +128 -0
- package/src/template/neo-custom-cmp-template/src/components/neo-entity-grid/index.tsx +295 -0
- package/src/template/neo-custom-cmp-template/src/components/neo-entity-grid/model.ts +94 -0
- package/src/template/neo-custom-cmp-template/src/components/neo-entity-grid/style.scss +127 -0
- package/src/template/neo-custom-cmp-template/tsconfig.json +68 -0
- package/src/template/echart-custom-cmp-template/src/components/list-widget/README.md +0 -2
- package/src/template/echart-custom-cmp-template/src/components/list-widget/index.tsx +0 -208
- package/src/template/echart-custom-cmp-template/src/components/list-widget/model.ts +0 -90
- package/src/template/echart-custom-cmp-template/src/components/list-widget/style.scss +0 -350
- /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/.prettierrc.js +0 -0
- /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/commitlint.config.js +0 -0
- /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/public/css/base.css +0 -0
- /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/public/scripts/app/bluebird.js +0 -0
- /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/public/template.html +0 -0
- /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/src/assets/css/common.scss +0 -0
- /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/src/assets/css/mixin.scss +0 -0
- /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/src/components/info-card/index.tsx +0 -0
- /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/src/components/info-card/model.ts +0 -0
- /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/src/components/info-card/style.scss +0 -0
- /package/src/template/{echart-custom-cmp-template → echarts-custom-cmp-template}/tsconfig.json +0 -0
- /package/src/template/{echart-custom-cmp-template → neo-custom-cmp-template}/README.md +0 -0
- /package/src/template/{echart-custom-cmp-template → neo-custom-cmp-template}/neo.config.js +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<html lang="en">
|
|
2
|
+
<head>
|
|
3
|
+
<meta charset="UTF-8">
|
|
4
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
5
|
+
<meta name="format-detection" content="telephone=no"/>
|
|
6
|
+
<meta name="viewport" content="initial-scale=1.0,user-scalable=no,width=device-width,viewport-fit=cover">
|
|
7
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
8
|
+
<title>自定义组件预览页</title>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="root"></div>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/* 公共的自定义函数 */
|
|
2
|
+
|
|
3
|
+
@function px2vw($px, $screen-width: 750) {
|
|
4
|
+
@return ($px / $screen-width) * 100vw;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
@function px2rem($px, $remRate: 100) {
|
|
8
|
+
@return ($px / $remRate) + rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@function px2vmin($px, $screen-width: 750) {
|
|
12
|
+
@return ($px / $screen-width) * 100vmin;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@mixin fillBox {
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* 头部细线 */
|
|
21
|
+
@mixin borderTop {
|
|
22
|
+
content: '';
|
|
23
|
+
position: absolute;
|
|
24
|
+
left: 0;
|
|
25
|
+
right: 0;
|
|
26
|
+
top: 0;
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: 1px;
|
|
29
|
+
background: #ddd;
|
|
30
|
+
transform: scaleY(0.5);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* 底部细线 */
|
|
34
|
+
@mixin borderBtm {
|
|
35
|
+
content: '';
|
|
36
|
+
position: absolute;
|
|
37
|
+
left: 0;
|
|
38
|
+
right: 0;
|
|
39
|
+
bottom: 0;
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 1px;
|
|
42
|
+
background: #ddd;
|
|
43
|
+
transform: scaleY(0.5);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* 统一的内边距 */
|
|
47
|
+
@mixin unifiedPadding($value: 40) {
|
|
48
|
+
padding: 0 px2rem($value) 0 px2rem($value);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* 统一的左内边距 */
|
|
52
|
+
@mixin unifiedLeftPadding($value: 40) {
|
|
53
|
+
padding-left: px2rem($value);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* 统一的右内边距 */
|
|
57
|
+
@mixin unifiedRightPadding($value: 40) {
|
|
58
|
+
padding-right: px2rem($value);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* 统一的底部边框样式 */
|
|
62
|
+
@mixin unifiedBottomBorder {
|
|
63
|
+
border-bottom: 1px solid #ddd;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* 统一的上边框样式 */
|
|
67
|
+
@mixin unifiedTopBorder {
|
|
68
|
+
border-top: 1px solid #ddd;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* 统一的Item高度 */
|
|
72
|
+
@mixin unifiedItemHeight {
|
|
73
|
+
line-height: px2rem(120);
|
|
74
|
+
height: px2rem(120);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* 设置行高样式 */
|
|
78
|
+
@mixin setItemHeight($value: 120) {
|
|
79
|
+
line-height: px2rem($value);
|
|
80
|
+
height: px2rem($value);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* 统一的Item样式 */
|
|
84
|
+
@mixin unifiedItemStyle {
|
|
85
|
+
font-family: PingFangSC-Regular;
|
|
86
|
+
font-size: px2rem(28);
|
|
87
|
+
color: #828282;
|
|
88
|
+
letter-spacing: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* 统一的弹性盒子样式 */
|
|
92
|
+
@mixin unifiedFlexBoxStyle {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-wrap: nowrap;
|
|
95
|
+
justify-content: center;
|
|
96
|
+
align-items: center;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* 统一的Title样式 */
|
|
100
|
+
@mixin unifiedTitleStyle {
|
|
101
|
+
font-family: PingFangSC-Regular;
|
|
102
|
+
font-size: px2rem(40);
|
|
103
|
+
color: #1e1e1e;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* 统一的内容样式 */
|
|
107
|
+
@mixin unifiedContentStyle {
|
|
108
|
+
font-family: PingFangSC-Regular;
|
|
109
|
+
font-size: px2rem(28);
|
|
110
|
+
color: #1e1e1e;
|
|
111
|
+
letter-spacing: 0;
|
|
112
|
+
text-align: right;
|
|
113
|
+
line-height: px2rem(28);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* 底部导航盒子样式 */
|
|
117
|
+
@mixin fixedBottomBox {
|
|
118
|
+
position: fixed;
|
|
119
|
+
left: 0;
|
|
120
|
+
bottom: 0;
|
|
121
|
+
width: 100%;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// 常用的变量
|
|
125
|
+
$background-color: #fafafa;
|
|
126
|
+
$border-color: #f7f7f7;
|
|
127
|
+
$page-padding-top: px2rem(20);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// 通用mixin
|
|
2
|
+
$borderColor: #ddd;
|
|
3
|
+
|
|
4
|
+
// type 为top 或者 bottom
|
|
5
|
+
@mixin borderTopOrBtm($type) {
|
|
6
|
+
&::after {
|
|
7
|
+
content: '';
|
|
8
|
+
position: absolute;
|
|
9
|
+
left: 0;
|
|
10
|
+
right: 0;
|
|
11
|
+
#{$type}: 0;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 1px;
|
|
14
|
+
background: $borderColor;
|
|
15
|
+
transform: scaleY(0.5);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// type为 right 或者 left
|
|
20
|
+
@mixin borderRtOrLt($type) {
|
|
21
|
+
&::after {
|
|
22
|
+
content: '';
|
|
23
|
+
position: absolute;
|
|
24
|
+
top: 0;
|
|
25
|
+
bottom: 0;
|
|
26
|
+
#{$type}: 0;
|
|
27
|
+
height: 100%;
|
|
28
|
+
width: 1px;
|
|
29
|
+
background: $borderColor;
|
|
30
|
+
transform: scaleX(0.5);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//超出1行显示...
|
|
35
|
+
@mixin ellipsis1 {
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
text-overflow: ellipsis;
|
|
38
|
+
white-space: nowrap;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 超出多行显示...
|
|
42
|
+
@mixin ellipsis($num) {
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
display: -webkit-box;
|
|
45
|
+
-webkit-line-clamp: $num;
|
|
46
|
+
-webkit-box-orient: vertical;
|
|
47
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './style.scss'; // 组件内容样式
|
|
3
|
+
|
|
4
|
+
interface InfoCardProps {
|
|
5
|
+
title: string;
|
|
6
|
+
backgroundImage: string;
|
|
7
|
+
imgCount: number;
|
|
8
|
+
commentCount: number;
|
|
9
|
+
data?: any;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default class InfoCard extends React.PureComponent<InfoCardProps> {
|
|
13
|
+
constructor(props: InfoCardProps) {
|
|
14
|
+
super(props);
|
|
15
|
+
this.agreeDataFormat = this.agreeDataFormat.bind(this);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
agreeDataFormat(agreeData: number) {
|
|
19
|
+
if (agreeData && agreeData <= 9999) {
|
|
20
|
+
return agreeData;
|
|
21
|
+
}
|
|
22
|
+
if (agreeData && agreeData > 9999) {
|
|
23
|
+
return `${Math.floor(agreeData / 1000) / 10}w`;
|
|
24
|
+
}
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
render() {
|
|
29
|
+
const { title, backgroundImage, imgCount, commentCount } = this.props;
|
|
30
|
+
console.log('当前自定义组件:', this.props, this);
|
|
31
|
+
const curAmisData = this.props.data || {};
|
|
32
|
+
|
|
33
|
+
const userInfo = curAmisData.__NeoCurrentUser;
|
|
34
|
+
const systemInfo = curAmisData.__NeoSystemInfo || {};
|
|
35
|
+
|
|
36
|
+
const curBackgroundImage =
|
|
37
|
+
backgroundImage || 'https://neo-widgets.bj.bcebos.com/NeoCRM.jpg';
|
|
38
|
+
return (
|
|
39
|
+
<div className="info-card-container">
|
|
40
|
+
<div className="news-title">
|
|
41
|
+
{title ||
|
|
42
|
+
'营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。'}
|
|
43
|
+
{systemInfo.tenantName ? `【${systemInfo.tenantName}】` : ''}
|
|
44
|
+
</div>
|
|
45
|
+
<div className="item-imgbox">
|
|
46
|
+
{userInfo && userInfo.icon && (
|
|
47
|
+
<div className="user-info-box">
|
|
48
|
+
<img src={userInfo.icon} className="user-icon" />
|
|
49
|
+
<span className="user-name">{userInfo.name}</span>
|
|
50
|
+
</div>
|
|
51
|
+
)}
|
|
52
|
+
<div
|
|
53
|
+
className="news-img"
|
|
54
|
+
style={{ backgroundImage: `url(${curBackgroundImage})` }}
|
|
55
|
+
></div>
|
|
56
|
+
{imgCount > 0 && <div className="img-count">{imgCount}</div>}
|
|
57
|
+
</div>
|
|
58
|
+
<div className="news-info">
|
|
59
|
+
<div className="left media-mark">NeoCRM · 低代码平台</div>
|
|
60
|
+
{commentCount && commentCount > 0 && (
|
|
61
|
+
<div className="cmt-num right">
|
|
62
|
+
{this.agreeDataFormat(commentCount)}评
|
|
63
|
+
</div>
|
|
64
|
+
)}
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file 自定义组件对接编辑器的描述文件
|
|
3
|
+
*/
|
|
4
|
+
export class InfoCardModel {
|
|
5
|
+
/**
|
|
6
|
+
* cmpType 为自定义组件名称,用于标识组件的唯一性
|
|
7
|
+
* 在构建时根据当前组件目录名称自动生成
|
|
8
|
+
*/
|
|
9
|
+
// cmpType: string = 'info-card';
|
|
10
|
+
|
|
11
|
+
// 组件名称,用于设置在编辑器左侧组件面板中展示的名称
|
|
12
|
+
label: string = '信息卡片';
|
|
13
|
+
|
|
14
|
+
// 组件描述,用于设置在编辑器左侧组件面板中展示的描述
|
|
15
|
+
description: string = '信息展示卡片';
|
|
16
|
+
|
|
17
|
+
// 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
|
|
18
|
+
tags: string[] = ['自定义组件'];
|
|
19
|
+
|
|
20
|
+
// 组件图标,用于设置在编辑器左侧组件面板中展示的图标
|
|
21
|
+
iconSrc: string = 'https://neo-widgets.bj.bcebos.com/custom-widget.svg';
|
|
22
|
+
// iconSrc = 'https://neo-widgets.bj.bcebos.com/favicon.png';
|
|
23
|
+
|
|
24
|
+
// 初次插入页面的默认属性数据
|
|
25
|
+
defaultComProps = {
|
|
26
|
+
title:
|
|
27
|
+
'营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。',
|
|
28
|
+
label: '信息卡片',
|
|
29
|
+
backgroundImage: 'https://neo-widgets.bj.bcebos.com/NeoCRM.jpg',
|
|
30
|
+
imgCount: 3,
|
|
31
|
+
commentCount: 2025,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// 设计器端预览时展示的默认数据
|
|
35
|
+
previewComProps = {
|
|
36
|
+
label: '信息卡片',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 组件面板配置,用于生成编辑器右侧属性配置面板内容
|
|
41
|
+
*/
|
|
42
|
+
propsSchema = [
|
|
43
|
+
{
|
|
44
|
+
type: 'textarea',
|
|
45
|
+
name: 'title',
|
|
46
|
+
label: '卡片title',
|
|
47
|
+
value:
|
|
48
|
+
'营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'text',
|
|
52
|
+
name: 'backgroundImage',
|
|
53
|
+
label: '展示图片',
|
|
54
|
+
value: 'https://neo-widgets.bj.bcebos.com/NeoCRM.jpg',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: 'number',
|
|
58
|
+
name: 'imgCount',
|
|
59
|
+
label: '图片数量',
|
|
60
|
+
value: 3,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: 'number',
|
|
64
|
+
name: 'commentCount',
|
|
65
|
+
label: '评论数',
|
|
66
|
+
value: 2025,
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
// 支持 函数式写法:propsSchemaCreator,com 为组件实例。优先级比 propsSchema 高
|
|
71
|
+
/*
|
|
72
|
+
propsSchemaCreator = (com: any) => {
|
|
73
|
+
return [];
|
|
74
|
+
};
|
|
75
|
+
*/
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default InfoCardModel;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--padding-bottom: 12px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.info-card-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
|
+
|
|
22
|
+
.item-imgbox {
|
|
23
|
+
position: relative;
|
|
24
|
+
height: 395px;
|
|
25
|
+
background: #f0f0f0;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
text-align: center;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
|
|
31
|
+
.news-img {
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 100%;
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
background-size: contain;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.img-count {
|
|
39
|
+
position: absolute;
|
|
40
|
+
top: 0;
|
|
41
|
+
right: 0;
|
|
42
|
+
padding: 6px 8px;
|
|
43
|
+
color: #fff;
|
|
44
|
+
min-width: 60px;
|
|
45
|
+
text-align: center;
|
|
46
|
+
line-height: 1.2;
|
|
47
|
+
background: rgb(0 0 0 / 40%);
|
|
48
|
+
font-size: 25px;
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.user-info-box {
|
|
54
|
+
position: absolute;
|
|
55
|
+
top: 10px;
|
|
56
|
+
left: 10px;
|
|
57
|
+
width: 100px;
|
|
58
|
+
min-height: 100px;
|
|
59
|
+
padding: 6px 8px;
|
|
60
|
+
color: #fff;
|
|
61
|
+
min-width: 60px;
|
|
62
|
+
text-align: center;
|
|
63
|
+
line-height: 1.2;
|
|
64
|
+
background: rgb(0 0 0 / 40%);
|
|
65
|
+
font-size: 25px;
|
|
66
|
+
box-sizing: border-box;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
align-items: center;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
|
|
73
|
+
.user-icon {
|
|
74
|
+
width: 64px;
|
|
75
|
+
height: 64px;
|
|
76
|
+
border-radius: 50%;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.user-name {
|
|
80
|
+
font-size: 16px;
|
|
81
|
+
font-weight: 600;
|
|
82
|
+
margin-top: 10px;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.news-info {
|
|
88
|
+
font-family: PingFangSC-Light;
|
|
89
|
+
height: 28px;
|
|
90
|
+
box-sizing: border-box;
|
|
91
|
+
display: flex;
|
|
92
|
+
justify-content: space-between;
|
|
93
|
+
align-items: center;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.media-mark,
|
|
97
|
+
.cmt-num {
|
|
98
|
+
display: inline-block;
|
|
99
|
+
height: 28px;
|
|
100
|
+
line-height: 28px;
|
|
101
|
+
font-family: PingFangSC-Light;
|
|
102
|
+
font-size: 18px;
|
|
103
|
+
color: #828282;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Neo Entity Grid 组件
|
|
2
|
+
|
|
3
|
+
这是一个基于 neo-ui-component-web 的 EntityGrid 和 EntityGridStore 的自定义组件。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- 支持实体表格的展示和操作
|
|
8
|
+
- 可配置实体 API Key、表格类型、选择模式等
|
|
9
|
+
- 支持多选和单选模式
|
|
10
|
+
- 集成 neo-ui-component-web 的 EntityGrid 组件
|
|
11
|
+
|
|
12
|
+
## 使用方法
|
|
13
|
+
|
|
14
|
+
### 基本用法
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import NeoEntityGrid from './components/neo-entity-grid';
|
|
18
|
+
|
|
19
|
+
<NeoEntityGrid
|
|
20
|
+
title="产品列表"
|
|
21
|
+
objectApiKey="account"
|
|
22
|
+
tableType="lookup"
|
|
23
|
+
selectionMode="multiple"
|
|
24
|
+
backgroundImage="https://example.com/image.jpg"
|
|
25
|
+
imgCount={3}
|
|
26
|
+
commentCount={2025}
|
|
27
|
+
/>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 属性配置
|
|
31
|
+
|
|
32
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
33
|
+
|--------|------|--------|------|
|
|
34
|
+
| title | string | - | 组件标题 |
|
|
35
|
+
| objectApiKey | string | 'account' | 实体API Key |
|
|
36
|
+
| tableType | string | 'lookup' | 表格类型 (lookup/list/related) |
|
|
37
|
+
| selectionMode | string | 'multiple' | 选择模式 (single/multiple/none) |
|
|
38
|
+
| showFooter | boolean | true | 是否显示底部 (分页、操作按钮等) |
|
|
39
|
+
| showHeader | boolean | true | 是否显示头部 (工具栏、筛选等) |
|
|
40
|
+
| data | any | - | 组件数据 |
|
|
41
|
+
|
|
42
|
+
### 表格类型说明
|
|
43
|
+
|
|
44
|
+
- **lookup**: 查找模式,用于选择数据
|
|
45
|
+
- **list**: 列表模式,用于展示数据列表
|
|
46
|
+
- **related**: 关联模式,用于展示关联数据
|
|
47
|
+
|
|
48
|
+
### 选择模式说明
|
|
49
|
+
|
|
50
|
+
- **single**: 单选模式
|
|
51
|
+
- **multiple**: 多选模式
|
|
52
|
+
- **none**: 无选择模式
|
|
53
|
+
|
|
54
|
+
### 显示控制说明
|
|
55
|
+
|
|
56
|
+
- **showFooter**: 控制是否显示表格底部,包括分页信息、操作按钮等
|
|
57
|
+
- **showHeader**: 控制是否显示表格头部,包括工具栏、筛选条件等
|
|
58
|
+
|
|
59
|
+
### 使用示例
|
|
60
|
+
|
|
61
|
+
#### 1. 完整表格(默认)
|
|
62
|
+
```tsx
|
|
63
|
+
<NeoEntityGrid
|
|
64
|
+
title="账户列表"
|
|
65
|
+
objectApiKey="account"
|
|
66
|
+
tableType="lookup"
|
|
67
|
+
selectionMode="multiple"
|
|
68
|
+
showFooter={true}
|
|
69
|
+
showHeader={true}
|
|
70
|
+
/>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### 2. 不带底部的表格
|
|
74
|
+
```tsx
|
|
75
|
+
<NeoEntityGrid
|
|
76
|
+
title="账户列表"
|
|
77
|
+
objectApiKey="account"
|
|
78
|
+
tableType="list"
|
|
79
|
+
selectionMode="none"
|
|
80
|
+
showFooter={false}
|
|
81
|
+
showHeader={true}
|
|
82
|
+
/>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### 3. 纯数据表格(无头部和底部)
|
|
86
|
+
```tsx
|
|
87
|
+
<NeoEntityGrid
|
|
88
|
+
title="账户列表"
|
|
89
|
+
objectApiKey="account"
|
|
90
|
+
tableType="list"
|
|
91
|
+
selectionMode="none"
|
|
92
|
+
showFooter={false}
|
|
93
|
+
showHeader={false}
|
|
94
|
+
/>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## 技术实现
|
|
98
|
+
|
|
99
|
+
### EntityGridStore 配置
|
|
100
|
+
|
|
101
|
+
组件内部会自动创建 EntityGridStore 实例,配置如下:
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
const entityGridStore = EntityGridStore.create({
|
|
105
|
+
objectApiKey: 'account',
|
|
106
|
+
pattern: 'pickView',
|
|
107
|
+
tableType: 'lookup',
|
|
108
|
+
selectionMode: 'multiple',
|
|
109
|
+
skipExt: true,
|
|
110
|
+
funPermission: true,
|
|
111
|
+
height: '100%',
|
|
112
|
+
className: 'neo-entity-view',
|
|
113
|
+
entity: {
|
|
114
|
+
objectId: 1,
|
|
115
|
+
apiKey: objectApiKey,
|
|
116
|
+
custom: false
|
|
117
|
+
},
|
|
118
|
+
items: [],
|
|
119
|
+
currentPage: 1,
|
|
120
|
+
pageSize: 20,
|
|
121
|
+
totalSize: 0,
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 注意事项
|
|
126
|
+
1. 组件需要在 Neo 环境中使用,需要相应的上下文支持
|
|
127
|
+
2. EntityGrid 组件需要 render 函数来渲染 amis 组件
|
|
128
|
+
3. 确保有相应的权限配置
|