neo-cmp-cli 1.13.1 → 1.13.3
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/README.md +3 -3
- package/dist/index2.js +1 -1
- package/dist/module/neoInitByCopy.js +1 -1
- package/dist/neo/env.js +1 -1
- package/dist/neo/neoService.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/utils/projectUtils/getEntries.js +1 -1
- package/dist/utils/projectUtils/getEntriesWithAutoRegister.js +1 -1
- package/docs/Web/347/253/257 NeoEntityGrid /344/275/277/347/224/250/350/257/264/346/230/216.md" +4 -0
- package/package.json +2 -2
- package/template/antd-custom-cmp-template/package.json +1 -1
- package/template/asset-manage-template/package.json +2 -2
- package/template/echarts-custom-cmp-template/package.json +1 -1
- package/template/empty-custom-cmp-template/package.json +1 -1
- package/template/map-custom-cmp-template/package.json +1 -1
- package/template/neo-bi-cmps/.npmrc copy +1 -0
- package/template/neo-bi-cmps/package.json +1 -1
- package/template/neo-custom-cmp-template/package.json +1 -1
- package/template/neo-custom-cmp-template/src/components/entityTable__c/index.tsx +2 -1
- package/template/neo-h5-cmps/package.json +1 -1
- package/template/neo-order-cmps/package.json +1 -1
- package/template/{neo-web-cmps → neo-web-entity-grid}/neo.config.js +4 -0
- package/template/{neo-web-cmps → neo-web-entity-grid}/package.json +2 -2
- package/template/neo-web-entity-grid/src/components/createForm__c/README.md +176 -0
- package/template/neo-web-entity-grid/src/components/createForm__c/index.tsx +786 -0
- package/template/neo-web-entity-grid/src/components/createForm__c/model.ts +130 -0
- package/template/neo-web-entity-grid/src/components/createForm__c/style.scss +370 -0
- package/template/neo-web-entity-grid/src/components/entityGrid2__c/index.tsx +139 -0
- package/template/{neo-web-cmps/src/components/entityGrid4__c → neo-web-entity-grid/src/components/entityGrid2__c}/model.ts +20 -3
- package/template/{neo-web-cmps/src/components/entityGrid4__c → neo-web-entity-grid/src/components/entityGrid2__c}/style.scss +1 -1
- package/template/{neo-web-cmps → neo-web-entity-grid}/src/components/entityGrid3__c/index.tsx +17 -6
- package/template/{neo-web-cmps → neo-web-entity-grid}/src/components/entityGrid3__c/model.ts +3 -2
- package/template/{neo-web-cmps → neo-web-entity-grid}/src/components/entityGrid4__c/index.tsx +57 -8
- package/template/{neo-web-cmps/src/components/entityGrid2__c → neo-web-entity-grid/src/components/entityGrid4__c}/style.scss +9 -13
- package/template/{neo-web-cmps/src/components/entityGrid2__c → neo-web-entity-grid/src/components/entityGrid__c}/index.tsx +6 -4
- package/template/{neo-web-cmps → neo-web-entity-grid}/src/components/entityGrid__c/model.ts +1 -1
- package/template/neo-web-entity-grid/src/components/searchForm__c/README.md +144 -0
- package/template/neo-web-entity-grid/src/components/searchForm__c/index.tsx +667 -0
- package/template/neo-web-entity-grid/src/components/searchForm__c/model.ts +135 -0
- package/template/neo-web-entity-grid/src/components/searchForm__c/style.scss +370 -0
- package/template/react-custom-cmp-template/package.json +1 -1
- package/template/react-ts-custom-cmp-template/package.json +1 -1
- package/template/vue2-custom-cmp-template/package.json +1 -1
- package/template/neo-web-cmps/src/components/entityGrid__c/index.tsx +0 -77
- /package/template/{neo-web-cmps → neo-web-entity-grid}/.prettierrc.js +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/@types/neo-ui-common.d.ts +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/README.md +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/commitlint.config.js +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/public/css/base.css +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/public/scripts/app/bluebird.js +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/public/template.html +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/css/common.scss +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/css/mixin.scss +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/AIBtn.gif +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/NeoCRM.jpg +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/aiLogo.png +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/card-list.svg +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/contact-form.svg +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/custom-form.svg +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/custom-widget.svg +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/data-list.svg +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/detail.svg +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/favicon.png +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/map.svg +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/search.svg +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/table.svg +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/components/entityGrid3__c/style.scss +0 -0
- /package/template/{neo-web-cmps/src/components/entityGrid2__c → neo-web-entity-grid/src/components/entityGrid4__c}/model.ts +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/components/entityGrid__c/style.scss +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/utils/axiosFetcher.ts +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/utils/queryObjectData.ts +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/src/utils/xobjects.ts +0 -0
- /package/template/{neo-web-cmps → neo-web-entity-grid}/tsconfig.json +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Object Form 表单组件对接编辑器的描述文件
|
|
3
|
+
* @description 定义组件在 Neo 平台编辑器中的配置信息
|
|
4
|
+
* @author Neo Custom Widget CLI
|
|
5
|
+
* @version 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
export class CreateFormModel {
|
|
8
|
+
/**
|
|
9
|
+
* 组件类型标识
|
|
10
|
+
* 用于标识组件的唯一性,在构建时根据当前组件目录名称自动生成
|
|
11
|
+
* 注意:此字段在构建时会被自动替换,不需要手动设置
|
|
12
|
+
*/
|
|
13
|
+
// cmpType: string = 'createForm';
|
|
14
|
+
|
|
15
|
+
/** 组件名称,用于设置在编辑器左侧组件面板中展示的名称 */
|
|
16
|
+
label: string = '新增数据表单';
|
|
17
|
+
|
|
18
|
+
/** 组件描述,用于设置在编辑器左侧组件面板中展示的描述 */
|
|
19
|
+
description: string = '基于 XObject 的对象表单组件,用于新增数据';
|
|
20
|
+
|
|
21
|
+
/** 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示 */
|
|
22
|
+
// tags: string[] = ['自定义组件'];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 用于设置组件支持的页面类型
|
|
26
|
+
*
|
|
27
|
+
* 当前 NeoCRM 平台存在的页面类型:
|
|
28
|
+
* all: 1 全页面
|
|
29
|
+
* entityFormPage: 4 实体表单页
|
|
30
|
+
* customPage: 6 自定义页面
|
|
31
|
+
*/
|
|
32
|
+
targetPage: string[] = ['all'];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 用于设置组件支持的终端类型
|
|
36
|
+
*
|
|
37
|
+
* 当前 NeoCRM 平台存在的终端类型:
|
|
38
|
+
* web: 网页端
|
|
39
|
+
* mobile: 移动端
|
|
40
|
+
*/
|
|
41
|
+
targetDevice: string = 'web';
|
|
42
|
+
|
|
43
|
+
enableDuplicate: boolean = true;
|
|
44
|
+
|
|
45
|
+
/** 组件图标,用于设置在编辑器左侧组件面板中展示的图标 */
|
|
46
|
+
iconUrl: string = 'https://custom-widgets.bj.bcebos.com/custom-form.svg';
|
|
47
|
+
|
|
48
|
+
/** 初次插入页面的默认属性数据 */
|
|
49
|
+
defaultComProps = {
|
|
50
|
+
formTitle: '新增数据表单',
|
|
51
|
+
showResetButton: true,
|
|
52
|
+
columnCount: 1,
|
|
53
|
+
xObjectDataApi: {
|
|
54
|
+
xObjectApiKey: 'opportunity',
|
|
55
|
+
fields: ['entityType', 'ownerId', 'opportunityName', 'accountId', 'money', 'closeDate'],
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 声明当前组件会触发的所有事件
|
|
61
|
+
* 备注:页面设计器端可用于进行事件绑定,在组件属性配置模式中配置事件动作
|
|
62
|
+
*/
|
|
63
|
+
events = [
|
|
64
|
+
{
|
|
65
|
+
apiKey: 'onSubmit', // 事件名称
|
|
66
|
+
label: '提交表单后', // 事件
|
|
67
|
+
helpText: '表单提交后触发该事件', // 信息icon hover 时的提示文本
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 组件属性配置模式
|
|
73
|
+
* 支持静态配置:propsSchema,优先级比 propsSchemaCreator 低
|
|
74
|
+
* 定义组件在编辑器中可配置的属性
|
|
75
|
+
*/
|
|
76
|
+
propsSchema = [
|
|
77
|
+
{
|
|
78
|
+
type: 'panelInput',
|
|
79
|
+
name: 'formTitle',
|
|
80
|
+
label: '表单标题',
|
|
81
|
+
value: '新增数据表单',
|
|
82
|
+
placeholder: '请输入表单标题',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
type: 'xObjectDataApi', // 用于获取实体业务数据列表的配置项
|
|
86
|
+
name: 'xObjectDataApi',
|
|
87
|
+
label: '实体数据源',
|
|
88
|
+
/*
|
|
89
|
+
value: {
|
|
90
|
+
xObjectApiKey: 'customContact__c',
|
|
91
|
+
fields: ['name', 'entityType', 'phone__c'],
|
|
92
|
+
},
|
|
93
|
+
*/
|
|
94
|
+
placeholder: '请选择实体数据源',
|
|
95
|
+
custom: true,
|
|
96
|
+
showPage: false,
|
|
97
|
+
showPageSize: false,
|
|
98
|
+
showAutoFetchData: false,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: 'panelSelect',
|
|
102
|
+
name: 'columnCount',
|
|
103
|
+
label: '表单列数',
|
|
104
|
+
value: 1,
|
|
105
|
+
placeholder: '请选择表单列数',
|
|
106
|
+
options: [
|
|
107
|
+
{
|
|
108
|
+
label: '单列',
|
|
109
|
+
value: 1,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
label: '双列',
|
|
113
|
+
value: 2,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
label: '三列',
|
|
117
|
+
value: 3,
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
type: 'panelSwitch',
|
|
123
|
+
name: 'showResetButton',
|
|
124
|
+
label: '显示重置按钮',
|
|
125
|
+
defaultChecked: true,
|
|
126
|
+
},
|
|
127
|
+
];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export default CreateFormModel;
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
.createForm__c {
|
|
2
|
+
.form-header {
|
|
3
|
+
margin-bottom: 24px;
|
|
4
|
+
padding-bottom: 16px;
|
|
5
|
+
border-bottom: 1px solid #f0f0f0;
|
|
6
|
+
|
|
7
|
+
.form-title {
|
|
8
|
+
margin: 0;
|
|
9
|
+
font-size: 18px;
|
|
10
|
+
font-weight: 600;
|
|
11
|
+
color: #262626;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.form-content {
|
|
16
|
+
.ant-form {
|
|
17
|
+
.ant-form-item {
|
|
18
|
+
margin-bottom: 20px;
|
|
19
|
+
|
|
20
|
+
.ant-form-item-label {
|
|
21
|
+
padding-bottom: 6px;
|
|
22
|
+
|
|
23
|
+
label {
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
color: #262626;
|
|
26
|
+
font-size: 14px;
|
|
27
|
+
|
|
28
|
+
&::before {
|
|
29
|
+
display: inline-block;
|
|
30
|
+
margin-right: 4px;
|
|
31
|
+
color: #ff4d4f;
|
|
32
|
+
font-size: 14px;
|
|
33
|
+
font-family: SimSun, sans-serif;
|
|
34
|
+
line-height: 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ant-input,
|
|
40
|
+
.ant-select-selector,
|
|
41
|
+
.ant-input-number,
|
|
42
|
+
.ant-picker {
|
|
43
|
+
border-radius: 4px;
|
|
44
|
+
border: 1px solid #d9d9d9;
|
|
45
|
+
transition: all 0.3s;
|
|
46
|
+
|
|
47
|
+
&:hover {
|
|
48
|
+
border-color: #40a9ff;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:focus,
|
|
52
|
+
&.ant-input-focused,
|
|
53
|
+
&.ant-select-focused .ant-select-selector,
|
|
54
|
+
&.ant-picker-focused {
|
|
55
|
+
border-color: #40a9ff;
|
|
56
|
+
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.ant-input-number {
|
|
61
|
+
width: 100%;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ant-input-textarea {
|
|
65
|
+
textarea {
|
|
66
|
+
resize: vertical;
|
|
67
|
+
min-height: 80px;
|
|
68
|
+
border-radius: 4px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.ant-picker {
|
|
73
|
+
width: 100%;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.ant-select {
|
|
77
|
+
width: 100%;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// 错误提示样式
|
|
82
|
+
.ant-form-item-has-error {
|
|
83
|
+
.ant-input,
|
|
84
|
+
.ant-select-selector,
|
|
85
|
+
.ant-input-number,
|
|
86
|
+
.ant-picker {
|
|
87
|
+
border-color: #ff4d4f;
|
|
88
|
+
|
|
89
|
+
&:focus {
|
|
90
|
+
border-color: #ff4d4f;
|
|
91
|
+
box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.2);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.submit-success-message {
|
|
98
|
+
margin: 16px 0;
|
|
99
|
+
padding: 12px 16px;
|
|
100
|
+
background-color: #f6ffed;
|
|
101
|
+
border: 1px solid #b7eb8f;
|
|
102
|
+
border-radius: 4px;
|
|
103
|
+
color: #52c41a;
|
|
104
|
+
font-size: 14px;
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
animation: fadeIn 0.3s ease-in;
|
|
108
|
+
|
|
109
|
+
.anticon {
|
|
110
|
+
margin-right: 8px;
|
|
111
|
+
font-size: 16px;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.form-actions {
|
|
116
|
+
margin-top: 32px;
|
|
117
|
+
padding-top: 24px;
|
|
118
|
+
border-top: 1px solid #f0f0f0;
|
|
119
|
+
text-align: center;
|
|
120
|
+
|
|
121
|
+
.ant-space {
|
|
122
|
+
.ant-btn {
|
|
123
|
+
min-width: 100px;
|
|
124
|
+
height: 40px;
|
|
125
|
+
font-size: 15px;
|
|
126
|
+
border-radius: 4px;
|
|
127
|
+
font-weight: 500;
|
|
128
|
+
transition: all 0.3s;
|
|
129
|
+
|
|
130
|
+
&.ant-btn-primary {
|
|
131
|
+
background: #1890ff;
|
|
132
|
+
border-color: #1890ff;
|
|
133
|
+
|
|
134
|
+
&:hover {
|
|
135
|
+
background: #40a9ff;
|
|
136
|
+
border-color: #40a9ff;
|
|
137
|
+
transform: translateY(-2px);
|
|
138
|
+
box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&:active {
|
|
142
|
+
background: #096dd9;
|
|
143
|
+
border-color: #096dd9;
|
|
144
|
+
transform: translateY(0);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&:disabled {
|
|
148
|
+
background: #f5f5f5;
|
|
149
|
+
border-color: #d9d9d9;
|
|
150
|
+
color: rgba(0, 0, 0, 0.25);
|
|
151
|
+
transform: none;
|
|
152
|
+
box-shadow: none;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&:not(.ant-btn-primary) {
|
|
157
|
+
&:hover {
|
|
158
|
+
color: #40a9ff;
|
|
159
|
+
border-color: #40a9ff;
|
|
160
|
+
transform: translateY(-2px);
|
|
161
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&:active {
|
|
165
|
+
color: #096dd9;
|
|
166
|
+
border-color: #096dd9;
|
|
167
|
+
transform: translateY(0);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.ant-empty {
|
|
175
|
+
padding: 40px 0;
|
|
176
|
+
|
|
177
|
+
.ant-empty-description {
|
|
178
|
+
color: #8c8c8c;
|
|
179
|
+
font-size: 14px;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// 动画效果
|
|
185
|
+
@keyframes fadeIn {
|
|
186
|
+
from {
|
|
187
|
+
opacity: 0;
|
|
188
|
+
transform: translateY(-10px);
|
|
189
|
+
}
|
|
190
|
+
to {
|
|
191
|
+
opacity: 1;
|
|
192
|
+
transform: translateY(0);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// 响应式设计
|
|
197
|
+
@media (max-width: 768px) {
|
|
198
|
+
.form-header {
|
|
199
|
+
margin-bottom: 16px;
|
|
200
|
+
padding-bottom: 12px;
|
|
201
|
+
|
|
202
|
+
.form-title {
|
|
203
|
+
font-size: 16px;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.form-content {
|
|
208
|
+
.ant-form {
|
|
209
|
+
.ant-form-item {
|
|
210
|
+
margin-bottom: 16px;
|
|
211
|
+
|
|
212
|
+
.ant-form-item-label {
|
|
213
|
+
label {
|
|
214
|
+
font-size: 13px;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.ant-input,
|
|
219
|
+
.ant-select-selector,
|
|
220
|
+
.ant-input-number,
|
|
221
|
+
.ant-picker {
|
|
222
|
+
font-size: 14px;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.form-actions {
|
|
228
|
+
margin-top: 24px;
|
|
229
|
+
padding-top: 16px;
|
|
230
|
+
|
|
231
|
+
.ant-space {
|
|
232
|
+
.ant-btn {
|
|
233
|
+
min-width: 80px;
|
|
234
|
+
height: 36px;
|
|
235
|
+
font-size: 14px;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
@media (max-width: 576px) {
|
|
243
|
+
.form-header {
|
|
244
|
+
.form-title {
|
|
245
|
+
font-size: 15px;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.form-content {
|
|
250
|
+
.ant-form {
|
|
251
|
+
// 在小屏幕上强制单列显示
|
|
252
|
+
.ant-row {
|
|
253
|
+
.ant-col {
|
|
254
|
+
max-width: 100% !important;
|
|
255
|
+
flex: 0 0 100% !important;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.ant-form-item {
|
|
260
|
+
margin-bottom: 14px;
|
|
261
|
+
|
|
262
|
+
.ant-form-item-label {
|
|
263
|
+
label {
|
|
264
|
+
font-size: 13px;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.form-actions {
|
|
271
|
+
.ant-space {
|
|
272
|
+
width: 100%;
|
|
273
|
+
|
|
274
|
+
.ant-space-item {
|
|
275
|
+
flex: 1;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.ant-btn {
|
|
279
|
+
width: 100%;
|
|
280
|
+
min-width: auto;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// 全局样式覆盖
|
|
289
|
+
.ant-card {
|
|
290
|
+
border-radius: 6px;
|
|
291
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
292
|
+
|
|
293
|
+
.ant-card-body {
|
|
294
|
+
padding: 24px;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// Spin 加载样式
|
|
299
|
+
.ant-spin {
|
|
300
|
+
.ant-spin-dot {
|
|
301
|
+
font-size: 20px;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.ant-spin-text {
|
|
305
|
+
color: #8c8c8c;
|
|
306
|
+
font-size: 14px;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Select 下拉样式优化
|
|
311
|
+
.ant-select-dropdown {
|
|
312
|
+
border-radius: 4px;
|
|
313
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
314
|
+
|
|
315
|
+
.ant-select-item {
|
|
316
|
+
padding: 8px 12px;
|
|
317
|
+
|
|
318
|
+
&:hover {
|
|
319
|
+
background-color: #f5f5f5;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
&.ant-select-item-option-selected {
|
|
323
|
+
background-color: #e6f7ff;
|
|
324
|
+
color: #1890ff;
|
|
325
|
+
font-weight: 500;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// DatePicker 日期选择器样式优化
|
|
331
|
+
.ant-picker-dropdown {
|
|
332
|
+
.ant-picker-panel-container {
|
|
333
|
+
border-radius: 4px;
|
|
334
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.ant-picker-cell-selected {
|
|
338
|
+
.ant-picker-cell-inner {
|
|
339
|
+
background-color: #1890ff;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.ant-picker-cell:hover:not(.ant-picker-cell-selected) {
|
|
344
|
+
.ant-picker-cell-inner {
|
|
345
|
+
background-color: #f5f5f5;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// InputNumber 数字输入框样式优化
|
|
351
|
+
.ant-input-number {
|
|
352
|
+
.ant-input-number-handler-wrap {
|
|
353
|
+
opacity: 0;
|
|
354
|
+
transition: opacity 0.3s;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
&:hover {
|
|
358
|
+
.ant-input-number-handler-wrap {
|
|
359
|
+
opacity: 1;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.ant-input-number-handler {
|
|
364
|
+
border-left: 1px solid #d9d9d9;
|
|
365
|
+
|
|
366
|
+
&:hover {
|
|
367
|
+
background-color: #f5f5f5;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import { NeoEntityGrid } from 'neo-ui-component-web';
|
|
4
|
+
// 引入 neo-ui-common / BaseCmp
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import { BaseCmp, NeoEvent } from 'neo-ui-common';
|
|
7
|
+
import './style.scss'; // 组件内容样式
|
|
8
|
+
|
|
9
|
+
/** 与 NeoEntityGrid additionalConditions、searchForm customSearchEvent 约定一致 */
|
|
10
|
+
export interface AdditionalConditionItem {
|
|
11
|
+
apiKey: string;
|
|
12
|
+
type: number;
|
|
13
|
+
value: unknown;
|
|
14
|
+
item?: number;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface NeoEntityGridProps {
|
|
19
|
+
objectApiKey: string;
|
|
20
|
+
disableSearch?: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
render: (name: string, schema: any) => React.ReactNode;
|
|
23
|
+
additionalConditions?: AdditionalConditionItem[];
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface NeoEntityGridCmpState {
|
|
28
|
+
additionalConditions: AdditionalConditionItem[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default class NeoEntityGridCmp extends BaseCmp<
|
|
32
|
+
NeoEntityGridProps,
|
|
33
|
+
NeoEntityGridCmpState
|
|
34
|
+
> {
|
|
35
|
+
constructor(props: NeoEntityGridProps) {
|
|
36
|
+
super(props);
|
|
37
|
+
this.state = {
|
|
38
|
+
additionalConditions: props.additionalConditions ?? [],
|
|
39
|
+
};
|
|
40
|
+
this.handleCustomSearchEvent = this.handleCustomSearchEvent.bind(this);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
componentDidMount() {
|
|
44
|
+
try {
|
|
45
|
+
// 监听 customSearchEvent 广播事件
|
|
46
|
+
NeoEvent.listen('customSearchEvent', this.handleCustomSearchEvent);
|
|
47
|
+
} catch {
|
|
48
|
+
// NeoEvent 不可用时忽略
|
|
49
|
+
console.error(' NeoEvent.listen / 广播事件 不可用。');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 接收 searchForm 等组件发出的 customSearchEvent(payload 含 xObjectApiKey、conditions)
|
|
55
|
+
*/
|
|
56
|
+
@NeoEvent.function
|
|
57
|
+
handleCustomSearchEvent(eventData: any) {
|
|
58
|
+
console.log('设置自定义筛选条件(handleCustomSearchEvent): ', eventData, this.props);
|
|
59
|
+
|
|
60
|
+
if (!eventData) {
|
|
61
|
+
this.setState({ additionalConditions: [] });
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (Array.isArray(eventData)) {
|
|
65
|
+
this.setState({
|
|
66
|
+
additionalConditions: eventData as AdditionalConditionItem[],
|
|
67
|
+
});
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const payload = eventData as {
|
|
71
|
+
xObjectApiKey?: string;
|
|
72
|
+
conditions?: AdditionalConditionItem[];
|
|
73
|
+
};
|
|
74
|
+
const { xObjectApiKey, conditions } = payload;
|
|
75
|
+
const gridKey = this.props.objectApiKey;
|
|
76
|
+
if (xObjectApiKey && gridKey && xObjectApiKey !== gridKey) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this.setState({
|
|
80
|
+
additionalConditions: Array.isArray(conditions) ? conditions : [],
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
render() {
|
|
85
|
+
const {
|
|
86
|
+
className,
|
|
87
|
+
objectApiKey,
|
|
88
|
+
pattern,
|
|
89
|
+
hiddenHeader,
|
|
90
|
+
showView,
|
|
91
|
+
enableChangeView,
|
|
92
|
+
defaultViewId,
|
|
93
|
+
disableSearch,
|
|
94
|
+
canCreate,
|
|
95
|
+
canImport,
|
|
96
|
+
editable,
|
|
97
|
+
withOrder,
|
|
98
|
+
withCheck,
|
|
99
|
+
enableToolbar,
|
|
100
|
+
disableExport,
|
|
101
|
+
disablePagination,
|
|
102
|
+
paginationPageSize,
|
|
103
|
+
autoHeight,
|
|
104
|
+
height,
|
|
105
|
+
onRecordChange,
|
|
106
|
+
...restProps
|
|
107
|
+
} = this.props;
|
|
108
|
+
console.log('entityGrid2__c: ', this.props, this);
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<div className={`entityGrid2__c ${className}`}>
|
|
112
|
+
<NeoEntityGrid
|
|
113
|
+
render={this.props.render}
|
|
114
|
+
objectApiKey={objectApiKey || 'account'}
|
|
115
|
+
pattern={'entityView'}
|
|
116
|
+
// defaultViewId="default_view" // 默认展示的列表视图
|
|
117
|
+
hiddenHeader={hiddenHeader ?? false}
|
|
118
|
+
showView={showView ?? true}
|
|
119
|
+
enableChangeView={enableChangeView ?? true}
|
|
120
|
+
defaultViewId={defaultViewId ?? 'default_view'}
|
|
121
|
+
disableSearch={disableSearch ?? false}
|
|
122
|
+
canCreate={canCreate ?? true}
|
|
123
|
+
canImport={canImport ?? true}
|
|
124
|
+
editable={editable ?? true}
|
|
125
|
+
withOrder={withOrder ?? true}
|
|
126
|
+
withCheck={withCheck ?? true}
|
|
127
|
+
enableToolbar={enableToolbar ?? true}
|
|
128
|
+
disableExport={disableExport ?? false}
|
|
129
|
+
disablePagination={disablePagination ?? false}
|
|
130
|
+
paginationPageSize={paginationPageSize ?? 20}
|
|
131
|
+
autoHeight={autoHeight ?? false}
|
|
132
|
+
height={height ?? '500px'}
|
|
133
|
+
customEmptyMsg="暂无数据,请点击「新建」按钮创建"
|
|
134
|
+
additionalConditions={this.state.additionalConditions}
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -9,10 +9,10 @@ export class NeoEntityGridModel {
|
|
|
9
9
|
// cmpType: string = 'entityList__c';
|
|
10
10
|
|
|
11
11
|
// 组件名称,用于设置在编辑器左侧组件面板中展示的名称
|
|
12
|
-
label: string = '
|
|
12
|
+
label: string = '自定义筛选列表';
|
|
13
13
|
|
|
14
14
|
// 组件描述,用于设置在编辑器左侧组件面板中展示的描述
|
|
15
|
-
description: string = '数据列表示例:
|
|
15
|
+
description: string = '数据列表示例: 自定义表单筛选 + 大列表实时响应联动';
|
|
16
16
|
|
|
17
17
|
// 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示
|
|
18
18
|
// tags: string[] = ['自定义组件'];
|
|
@@ -42,7 +42,7 @@ export class NeoEntityGridModel {
|
|
|
42
42
|
|
|
43
43
|
// 初次插入页面的默认属性数据
|
|
44
44
|
defaultComProps = {
|
|
45
|
-
objectApiKey: '
|
|
45
|
+
objectApiKey: 'customContact__c',
|
|
46
46
|
funPermission: true, // 设计器添加时绕过职能权限检查,确保能正常渲染列表
|
|
47
47
|
hiddenHeader: false,
|
|
48
48
|
showView: true,
|
|
@@ -61,6 +61,23 @@ export class NeoEntityGridModel {
|
|
|
61
61
|
height: '500px',
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
+
// 当前组件支持的函数列表(其他组件可触发当前组件的函数)
|
|
65
|
+
functions = [
|
|
66
|
+
{
|
|
67
|
+
apiKey: 'handleCustomSearchEvent',
|
|
68
|
+
label: '更新筛选条件',
|
|
69
|
+
helpTextKey: '更新自定义筛选条件',
|
|
70
|
+
funcInParams: [ // 定义组件函数入参
|
|
71
|
+
{
|
|
72
|
+
apiKey: 'eventData',
|
|
73
|
+
label: '自定义筛选条件',
|
|
74
|
+
type: 'Array',
|
|
75
|
+
required: true
|
|
76
|
+
},
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
|
|
64
81
|
/**
|
|
65
82
|
* 组件面板配置,用于生成编辑器右侧属性配置面板内容
|
|
66
83
|
*/
|