@cniot/mdd-editor 0.2.0-beta.5 → 0.2.0-beta.51
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 +205 -9
- package/build/index.cjs.js +27 -19
- package/build/index.es.js +3686 -739
- package/build/style.css +1 -1
- package/package.json +1 -1
- package/src/components/address-select/formily.jsx +1 -1
- package/src/components/ajax-schema-form/formily-table-form-proxy.jsx +1 -1
- package/src/components/ajax-schema-form/formily.jsx +1 -1
- package/src/components/ajax-schema-form/table-form-proxy.jsx +1 -1
- package/src/components/ajax-schema-form/table-form.jsx +1 -1
- package/src/components/data-source-select/formily.jsx +1 -1
- package/src/components/dynamic-value/base/formily.jsx +1 -1
- package/src/components/dynamic-value/date/formily.jsx +1 -1
- package/src/components/formily-select/index.tsx +1 -1
- package/src/components/params-select/formily.jsx +1 -1
- package/src/components/time-range/formily.jsx +1 -1
- package/src/hooks/useSchema.jsx +5 -5
- package/src/hooks/useSwagger.jsx +2 -2
- package/src/schema/base-schema/AjaxSchema.js +1 -1
- package/src/schema/base-schema/AjaxSchemaQueue.js +1 -1
- package/src/schema/blocks/edit-table.js +57 -0
- package/src/schema/blocks/filter.js +49 -0
- package/src/schema/blocks/form.js +49 -0
- package/src/schema/blocks/index.js +101 -0
- package/src/schema/blocks/table.js +57 -0
- package/src/schema/detail/detail-item.js +8 -2
- package/src/schema/detail/index.js +26 -18
- package/src/schema/edit-table/header-toolbar.js +1 -1
- package/src/schema/edit-table/index.js +10 -5
- package/src/schema/edit-table/table.js +10 -2
- package/src/schema/formily-form/data-source.js +1 -1
- package/src/schema/formily-form/form-schema.js +1 -1
- package/src/schema/formily-form/index.js +8 -8
- package/src/schema/formily-form-v2/form-info.js +2 -2
- package/src/schema/formily-form-v2/form-items.js +1 -1
- package/src/schema/formily-form-v2/index.js +3 -3
- package/src/schema/ftp/data-source.js +1 -1
- package/src/schema/ftp/filter.js +2 -2
- package/src/schema/ftp/header-toolbar.js +1 -1
- package/src/schema/ftp/index.js +4 -4
- package/src/schema/ftp/middle-item.js +1 -1
- package/src/schema/ftp/table.js +9 -3
- package/src/schema/util.js +3 -3
- package/src/services/index.js +1 -1
- package/src/template/blocks/EditTable.jsx +62 -0
- package/src/template/blocks/Filter.jsx +137 -0
- package/src/template/blocks/Form.jsx +136 -0
- package/src/template/blocks/Table.jsx +79 -0
- package/src/template/blocks/index.module.scss +33 -0
- package/src/template/const.js +18 -1
- package/src/template/detail/DetailItems.jsx +14 -1
- package/src/template/detail/components/Actions.jsx +1 -1
- package/src/template/detail/components/DetailCard.jsx +8 -5
- package/src/template/detail/components/DetailColumns.jsx +296 -0
- package/src/template/detail/components/DetailColumns.module.scss +18 -0
- package/src/template/detail/components/DetailCustom.jsx +2 -2
- package/src/template/detail/components/DetailTable.jsx +13 -8
- package/src/template/detail/components/MultiAjaxSchemaForm.jsx +1 -1
- package/src/template/edit-table/HeaderToolbar.jsx +3 -2
- package/src/template/edit-table/Table.jsx +56 -3
- package/src/template/formily-form-v2/FormInfo.jsx +1 -1
- package/src/template/formily-form-v2/FormItems.jsx +4 -8
- package/src/template/formilyform/components/AsyncDataSourceSetter/index.tsx +1 -1
- package/src/template/formilyform/components/SubmitActionSetter/index.tsx +1 -1
- package/src/template/ftp/DataSource.jsx +1 -1
- package/src/template/ftp/Filter.jsx +7 -4
- package/src/template/ftp/HeaderToolbar.jsx +1 -1
- package/src/template/ftp/Middle.jsx +4 -4
- package/src/template/ftp/Table.jsx +123 -9
- package/src/template/simple-ftp/Table.jsx +2 -2
- package/src/toolbar.jsx +6 -3
- package/src/utils/buildFieldsToCompJson.js +3 -3
- package/src/utils/persistentStorage.js +1 -1
- package/src/utils/swagger/api2SchemaFromSwagger.js +11 -5
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Form, NumberPicker, Select, Input, Switch } from '@cainiaofe/cn-ui';
|
|
3
|
+
import MddTableForm, { PenetrateTypes } from '$src/components/mdd-table-form';
|
|
4
|
+
import MddForm from '$src/components/mdd-form';
|
|
5
|
+
import { FormComponentOptions } from '../const';
|
|
6
|
+
|
|
7
|
+
import { propFields } from '$src/common/comp-schema/fields/propFields';
|
|
8
|
+
|
|
9
|
+
const Default_Add_Schema = {
|
|
10
|
+
type: 'input',
|
|
11
|
+
label: '输入框',
|
|
12
|
+
name: '',
|
|
13
|
+
input: propFields.input,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// 缓存保存逻辑下拉数据源
|
|
17
|
+
const Save_Selected_Options = [
|
|
18
|
+
{
|
|
19
|
+
label: '不开启',
|
|
20
|
+
value: '',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: '开启客户端缓存',
|
|
24
|
+
value: 'local',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: '开启服务端缓存',
|
|
28
|
+
value: 'server',
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const FormColOpts = [
|
|
33
|
+
{
|
|
34
|
+
label: '自适应',
|
|
35
|
+
value: 0,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: '1',
|
|
39
|
+
value: 1,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: '2',
|
|
43
|
+
value: 2,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: '3',
|
|
47
|
+
value: 3,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: '4',
|
|
51
|
+
value: 4,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: '5',
|
|
55
|
+
value: 5,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
label: '6',
|
|
59
|
+
value: 6,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
label: '7',
|
|
63
|
+
value: 7,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label: '8',
|
|
67
|
+
value: 8,
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
export default function FilterPanel({ schema, swaggerFields = [] }) {
|
|
72
|
+
const mddFormRef = React.useRef();
|
|
73
|
+
const [_, forceUpdate] = React.useState({});
|
|
74
|
+
React.useEffect(() => {
|
|
75
|
+
schema.on('$updated', (changeData, ignoreUpdate) => {
|
|
76
|
+
!ignoreUpdate && forceUpdate({});
|
|
77
|
+
});
|
|
78
|
+
}, []);
|
|
79
|
+
|
|
80
|
+
const fields = schema.get('fields');
|
|
81
|
+
|
|
82
|
+
const refreshMddTableForm = () => {
|
|
83
|
+
mddFormRef.current?.updateData(schema.get('fields'));
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const onAddHandle = () => {
|
|
87
|
+
schema.add(Default_Add_Schema, 'fields', true);
|
|
88
|
+
refreshMddTableForm();
|
|
89
|
+
};
|
|
90
|
+
const onRemoveHandle = (index) => {
|
|
91
|
+
schema.remove(index, 'fields', true);
|
|
92
|
+
refreshMddTableForm();
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const onChangeHandle = ({ index, record }) => {
|
|
96
|
+
// 移除多余propsField
|
|
97
|
+
for (const k in propFields) {
|
|
98
|
+
if (record.type !== k) {
|
|
99
|
+
!['name'].includes(k) && delete record[k];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
schema.update(index, record, 'fields', true);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<div>
|
|
108
|
+
{/* MddTableForm 组件已经内置了状态,在需要update的时候再刷新,不要每次schema变化就刷新 */}
|
|
109
|
+
<MddTableForm
|
|
110
|
+
ref={mddFormRef}
|
|
111
|
+
data={fields}
|
|
112
|
+
penetrateType={PenetrateTypes.FORM}
|
|
113
|
+
componentOptions={FormComponentOptions}
|
|
114
|
+
title="配置表单项"
|
|
115
|
+
onAdd={onAddHandle}
|
|
116
|
+
onRemove={onRemoveHandle}
|
|
117
|
+
onChange={onChangeHandle}
|
|
118
|
+
swaggerFieldDataSource={swaggerFields}
|
|
119
|
+
onSort={(newList) => {
|
|
120
|
+
schema.setFieldsAll(newList, true);
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* 兼容老的格式,老格式是boolean 类型现在改成string类型
|
|
129
|
+
* https://alidocs.dingtalk.com/i/nodes/Obva6QBXJwxNZoMOC34Bmylx8n4qY5Pr
|
|
130
|
+
*/
|
|
131
|
+
function adaptorSaveSelected(enableSaveSelected) {
|
|
132
|
+
if (typeof enableSaveSelected === 'boolean') {
|
|
133
|
+
return enableSaveSelected === true ? Save_Selected_Options[1].value : Save_Selected_Options[0].value;
|
|
134
|
+
}
|
|
135
|
+
return enableSaveSelected;
|
|
136
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Input, Switch, Icon, NumberPicker } from '@cainiaofe/cn-ui';
|
|
3
|
+
import MddTableForm from '$src/components/mdd-table-form';
|
|
4
|
+
import MddForm from '$src/components/mdd-form';
|
|
5
|
+
import AjaxSchemaForm from '$src/components/ajax-schema-form';
|
|
6
|
+
import { columnsTypeOptionsWithCnTable } from '../const';
|
|
7
|
+
|
|
8
|
+
export default function TablePanel({ schema }) {
|
|
9
|
+
const columnMddFormRef = React.useRef();
|
|
10
|
+
|
|
11
|
+
const [_, forceUpdate] = useState({});
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
schema.on('$updated', (changeData, ignoreUpdate) => {
|
|
15
|
+
!ignoreUpdate && forceUpdate({});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// hack处理
|
|
19
|
+
hackRowDetail(schema);
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
const columns = schema.get('columns');
|
|
24
|
+
|
|
25
|
+
const onAddHandle = (key) => {
|
|
26
|
+
switch (key) {
|
|
27
|
+
case 'columns':
|
|
28
|
+
schema.add(
|
|
29
|
+
{
|
|
30
|
+
type: 'text',
|
|
31
|
+
label: '展示项',
|
|
32
|
+
name: '',
|
|
33
|
+
},
|
|
34
|
+
'columns',
|
|
35
|
+
true,
|
|
36
|
+
);
|
|
37
|
+
columnMddFormRef.current?.updateData(schema.get('columns'));
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const onRemoveHandle = (index, key) => {
|
|
45
|
+
schema.remove(index, key, true);
|
|
46
|
+
if (key === 'columns') {
|
|
47
|
+
columnMddFormRef.current?.updateData(schema.get('columns'));
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const onChangeHandle = ({ index, record }, key) => {
|
|
52
|
+
schema.update(index, record, key, true);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div>
|
|
57
|
+
<MddTableForm
|
|
58
|
+
ref={columnMddFormRef}
|
|
59
|
+
data={columns}
|
|
60
|
+
title="配置表格列"
|
|
61
|
+
componentOptions={columnsTypeOptionsWithCnTable.filter(col => col.value !== 'blocks-table')}
|
|
62
|
+
onAdd={() => onAddHandle('columns')}
|
|
63
|
+
onRemove={(index) => onRemoveHandle(index, 'columns')}
|
|
64
|
+
onChange={({ index, record }) => onChangeHandle({ index, record }, 'columns')}
|
|
65
|
+
onSort={(newList) => {
|
|
66
|
+
schema.setItemAll(newList, 'columns', true);
|
|
67
|
+
}}
|
|
68
|
+
/>
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// 处理rowDetail字段改成 rowDetailModule字段的问题
|
|
74
|
+
function hackRowDetail(schema) {
|
|
75
|
+
const rowDetail = schema.get('rowDetail');
|
|
76
|
+
if (rowDetail) {
|
|
77
|
+
schema.set('rowDetail', undefined);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.customTabItem {
|
|
2
|
+
padding: 8px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.tabTitle {
|
|
6
|
+
font-size: 14px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.tabLabel {
|
|
10
|
+
display: inline-block;
|
|
11
|
+
padding: 0 2px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:global {
|
|
15
|
+
.mdd-tip {
|
|
16
|
+
color: #999;
|
|
17
|
+
display: inline;
|
|
18
|
+
padding-left: 20px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.middleBox {
|
|
23
|
+
margin-left: '10px';
|
|
24
|
+
margin-bottom: 8px;
|
|
25
|
+
display: flex;
|
|
26
|
+
}
|
|
27
|
+
.middleBoxLeft {
|
|
28
|
+
width: 100px;
|
|
29
|
+
text-align: right;
|
|
30
|
+
}
|
|
31
|
+
.middleBoxRight {
|
|
32
|
+
flex: 1;
|
|
33
|
+
}
|
package/src/template/const.js
CHANGED
|
@@ -78,6 +78,12 @@ export const componentOptions = [
|
|
|
78
78
|
},
|
|
79
79
|
];
|
|
80
80
|
|
|
81
|
+
export const FormComponentOptions = [...componentOptions];
|
|
82
|
+
FormComponentOptions.splice(3, 0, { value: 'input-password', label: '密码输入框' });
|
|
83
|
+
FormComponentOptions.splice(3, 0, { value: 'message', label: '信息提示' });
|
|
84
|
+
FormComponentOptions.splice(3, 0, { value: 'global-phone-picker', label: '国际电话输入框' });
|
|
85
|
+
// FormComponentOptions.splice(8, 1); // 表单去除级联选择器
|
|
86
|
+
|
|
81
87
|
// 列类型数据
|
|
82
88
|
export const columnsTypeOptions = [
|
|
83
89
|
{
|
|
@@ -185,6 +191,10 @@ export const columnsTypeOptionsWithCnTable = [
|
|
|
185
191
|
// value: 'cn-file',
|
|
186
192
|
// label: '附件',
|
|
187
193
|
// },
|
|
194
|
+
{
|
|
195
|
+
value: 'blocks-table',
|
|
196
|
+
label: '列表区块',
|
|
197
|
+
},
|
|
188
198
|
];
|
|
189
199
|
|
|
190
200
|
// edit table 只有文本
|
|
@@ -225,7 +235,14 @@ export const columnsTypeOptionsWithEditCnTable = [
|
|
|
225
235
|
value: 'edit-cascader-select',
|
|
226
236
|
label: '级联选择器',
|
|
227
237
|
},
|
|
228
|
-
|
|
238
|
+
{
|
|
239
|
+
value: 'blocks-table',
|
|
240
|
+
label: '列表区块',
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
value: 'blocks-edit-table',
|
|
244
|
+
label: '可编辑表格区块',
|
|
245
|
+
},
|
|
229
246
|
{
|
|
230
247
|
value: 'edit-custom',
|
|
231
248
|
label: '自定义',
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Input, Select, Balloon, Icon } from '@cainiaofe/cn-ui';
|
|
3
|
-
import MddTableArray from '
|
|
3
|
+
import MddTableArray from '$src/components/mdd-table-array';
|
|
4
4
|
import DetailCard from './components/DetailCard';
|
|
5
5
|
import DetailImageView from './components/DetailImageView';
|
|
6
6
|
import DetailTable from './components/DetailTable';
|
|
7
7
|
import DetailCustom from './components/DetailCustom';
|
|
8
8
|
import DetailStaticStep from './components/DetailStaticStep';
|
|
9
|
+
import DetailColumns from './components/DetailColumns';
|
|
9
10
|
import styles from './index.module.scss';
|
|
10
11
|
|
|
11
12
|
const typeContent = [
|
|
@@ -37,6 +38,13 @@ const typeContent = [
|
|
|
37
38
|
return <DetailStaticStep {...props} />;
|
|
38
39
|
},
|
|
39
40
|
},
|
|
41
|
+
{
|
|
42
|
+
label: '布局',
|
|
43
|
+
value: 'detail-columns',
|
|
44
|
+
contentRender: (props) => {
|
|
45
|
+
return <DetailColumns {...props} />;
|
|
46
|
+
},
|
|
47
|
+
},
|
|
40
48
|
{
|
|
41
49
|
label: '内嵌页面',
|
|
42
50
|
value: 'import-component',
|
|
@@ -62,6 +70,11 @@ const customTitleRender = (props) => {
|
|
|
62
70
|
// 类型是步骤条
|
|
63
71
|
data.initStepSource();
|
|
64
72
|
}
|
|
73
|
+
if (key === 'type' && val === 'detail-columns') {
|
|
74
|
+
data.set('hideCard', true);
|
|
75
|
+
} else {
|
|
76
|
+
data.set('hideCard', false);
|
|
77
|
+
}
|
|
65
78
|
onChange(data);
|
|
66
79
|
};
|
|
67
80
|
return (
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Form, CnNumberPicker, Dialog, CnSwitch, CnRadioGroup, CnRadio } from '@cainiaofe/cn-ui';
|
|
3
|
-
import MddTableForm from '
|
|
3
|
+
import MddTableForm from '$src/components/mdd-table-form';
|
|
4
4
|
import MultiAjaxSchemaForm from './MultiAjaxSchemaForm';
|
|
5
5
|
import ActionPanel from './Actions';
|
|
6
|
-
import useSwagger from '
|
|
7
|
-
import buildSwaggerApiJson from '
|
|
8
|
-
import buildFieldsToCompJson from '
|
|
6
|
+
import useSwagger from '$src/hooks/useSwagger';
|
|
7
|
+
import buildSwaggerApiJson from '$src/utils/buildSwaggerApiJson';
|
|
8
|
+
import buildFieldsToCompJson from '$src/utils/buildFieldsToCompJson';
|
|
9
9
|
import { columnsTypeOptions } from '../../const';
|
|
10
10
|
|
|
11
|
+
const _columnsTypeOptions = [...columnsTypeOptions];
|
|
12
|
+
_columnsTypeOptions.splice(5, 0, { value: 'message', label: '信息提示' });
|
|
13
|
+
|
|
11
14
|
// 额外formily schema字段
|
|
12
15
|
const extraFieldSchema = {
|
|
13
16
|
renderToTitle: {
|
|
@@ -141,7 +144,7 @@ export default function DetailCard(props) {
|
|
|
141
144
|
title=""
|
|
142
145
|
extraFieldSchema={extraFieldSchema}
|
|
143
146
|
swaggerFieldDataSource={responseFields}
|
|
144
|
-
componentOptions={
|
|
147
|
+
componentOptions={_columnsTypeOptions}
|
|
145
148
|
onAdd={() => onAddHandle()}
|
|
146
149
|
onRemove={(index) => onRemoveHandle(index)}
|
|
147
150
|
onChange={({ index, record }) => onChangeHandle({ index, record })}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Select,
|
|
4
|
+
Form,
|
|
5
|
+
CnNumberPicker,
|
|
6
|
+
CnTooltip,
|
|
7
|
+
Dialog,
|
|
8
|
+
CnSwitch,
|
|
9
|
+
CnRadioGroup,
|
|
10
|
+
CnRadio,
|
|
11
|
+
Collapse,
|
|
12
|
+
Icon,
|
|
13
|
+
Balloon,
|
|
14
|
+
} from '@cainiaofe/cn-ui';
|
|
15
|
+
|
|
16
|
+
import MddTableForm from '$src/components/mdd-table-form';
|
|
17
|
+
import MultiAjaxSchemaForm from './MultiAjaxSchemaForm';
|
|
18
|
+
import ActionPanel from './Actions';
|
|
19
|
+
import useSwagger from '$src/hooks/useSwagger';
|
|
20
|
+
import buildSwaggerApiJson from '$src/utils/buildSwaggerApiJson';
|
|
21
|
+
import buildFieldsToCompJson from '$src/utils/buildFieldsToCompJson';
|
|
22
|
+
import MddTableSimpleArray from '$src/components/mdd-table-simple-array';
|
|
23
|
+
import FormilySelect from '$src/components/formily-select';
|
|
24
|
+
import TableFormProxy from '$src/components/ajax-schema-form/formily-table-form-proxy';
|
|
25
|
+
import styles from './DetailColumns.module.scss';
|
|
26
|
+
|
|
27
|
+
const { Panel } = Collapse;
|
|
28
|
+
|
|
29
|
+
export default function DetailColumns(props) {
|
|
30
|
+
const { data, index: idx, onChange } = props;
|
|
31
|
+
const [_, forceUpdate] = React.useState({});
|
|
32
|
+
|
|
33
|
+
// 当是 详情 分栏时 把 hideCardTitle 默认置为 true
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
data.set('hideCardTitle', true);
|
|
36
|
+
forceUpdate();
|
|
37
|
+
|
|
38
|
+
return () => {
|
|
39
|
+
data.set('hideCardTitle', false);
|
|
40
|
+
forceUpdate();
|
|
41
|
+
};
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
const onAddHandle = () => {
|
|
45
|
+
data.add(
|
|
46
|
+
{
|
|
47
|
+
moduleName: '',
|
|
48
|
+
hideSelfCard: true,
|
|
49
|
+
params: [],
|
|
50
|
+
canUpdateOtherColumns: true,
|
|
51
|
+
canBeUpdated: true,
|
|
52
|
+
},
|
|
53
|
+
'columnsBoxes',
|
|
54
|
+
);
|
|
55
|
+
forceUpdate({});
|
|
56
|
+
};
|
|
57
|
+
const onRemoveHandle = (index) => {
|
|
58
|
+
data.remove(index, 'columnsBoxes');
|
|
59
|
+
forceUpdate({});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const onChangeHandle = ({ index, record }) => {
|
|
63
|
+
data.update(index, record, 'columnsBoxes');
|
|
64
|
+
forceUpdate({});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Form
|
|
69
|
+
labelCol={{ span: 4 }}
|
|
70
|
+
wrapperCol={{ span: 19 }}
|
|
71
|
+
size="small"
|
|
72
|
+
onChange={(values, item) => {
|
|
73
|
+
data.set(item.name, item.value);
|
|
74
|
+
onChange({ index: idx, record: data });
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
<Form.Item labelAlign="left" label="布局方式" name="columnsDirection">
|
|
78
|
+
<CnRadioGroup defaultValue={data.get('columnsDirection')}>
|
|
79
|
+
<CnRadio value="row">左右布局</CnRadio>
|
|
80
|
+
<CnRadio value="column">上下布局</CnRadio>
|
|
81
|
+
</CnRadioGroup>
|
|
82
|
+
</Form.Item>
|
|
83
|
+
<Form.Item labelAlign="left" label="高度" name="height">
|
|
84
|
+
<CnNumberPicker defaultValue={data.get('height')} min={0} max={100} innerAfter="%" style={{ width: 90 }} />
|
|
85
|
+
<CnTooltip trigger={<Icon type="prompt" style={{ marginLeft: 6 }} />}>0-100 的整数,0 表示自动高度</CnTooltip>
|
|
86
|
+
</Form.Item>
|
|
87
|
+
<Form.Item labelAlign="left" label="隐藏父级卡片" name="hideCard">
|
|
88
|
+
<CnSwitch checked={data.get('hideCard')} />
|
|
89
|
+
</Form.Item>
|
|
90
|
+
{!data.get('hideCard') && (
|
|
91
|
+
<Form.Item labelAlign="left" label="隐藏父级卡片头部" name="hideCardTitle">
|
|
92
|
+
<CnSwitch checked={data.get('hideCardTitle')} />
|
|
93
|
+
</Form.Item>
|
|
94
|
+
)}
|
|
95
|
+
<Form.Item labelAlign="top" label="">
|
|
96
|
+
<MddTableSimpleArray
|
|
97
|
+
data={data.get('columnsBoxes')}
|
|
98
|
+
titleRender={customTitleRender}
|
|
99
|
+
contentRender={contentRender}
|
|
100
|
+
title="配置分栏信息"
|
|
101
|
+
tip={'左右布局时,占列数之和应为24'}
|
|
102
|
+
onChange={onChangeHandle}
|
|
103
|
+
onSort={(newList) => {
|
|
104
|
+
data.setItemAll(newList, 'columnsBoxes');
|
|
105
|
+
forceUpdate({});
|
|
106
|
+
}}
|
|
107
|
+
onAdd={onAddHandle}
|
|
108
|
+
onRemove={(index) => onRemoveHandle(index)}
|
|
109
|
+
otherInfo={{ columnsDirection: data.get('columnsDirection') }}
|
|
110
|
+
// onRemove={onRemoveHandle}
|
|
111
|
+
/>
|
|
112
|
+
</Form.Item>
|
|
113
|
+
{data.get('hideCardTitle') ? null : <ActionPanel schema={data} />}
|
|
114
|
+
</Form>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function customTitleRender(props) {
|
|
119
|
+
const { data, index, onChange, moduleDataSource, otherInfo = {} } = props;
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<div className={styles.title}>
|
|
123
|
+
<div className={styles.titleItem}>
|
|
124
|
+
<label className={styles.titleItemLabel}>模块地址</label>
|
|
125
|
+
<Select.AutoComplete
|
|
126
|
+
placeholder="请选择或者输入模块地址"
|
|
127
|
+
hasClear
|
|
128
|
+
size="small"
|
|
129
|
+
style={{
|
|
130
|
+
minWidth: 280,
|
|
131
|
+
}}
|
|
132
|
+
dataSource={moduleDataSource?.l4ModuleOptions || moduleDataSource || []}
|
|
133
|
+
value={data?.moduleName}
|
|
134
|
+
onChange={(v) => onChange({ ...data, moduleName: v })}
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
137
|
+
{otherInfo?.columnsDirection === 'row' && (
|
|
138
|
+
<div className={styles.titleItem}>
|
|
139
|
+
<label className={styles.titleItemLabel}>
|
|
140
|
+
<Balloon
|
|
141
|
+
trigger={
|
|
142
|
+
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
143
|
+
占列数 <Icon type="help" size="small" />
|
|
144
|
+
</div>
|
|
145
|
+
}
|
|
146
|
+
align="t"
|
|
147
|
+
>
|
|
148
|
+
<b>左右布局时,占列数之和应为24</b>
|
|
149
|
+
</Balloon>
|
|
150
|
+
</label>
|
|
151
|
+
<CnNumberPicker
|
|
152
|
+
size="small"
|
|
153
|
+
min={0}
|
|
154
|
+
max={24}
|
|
155
|
+
value={data?.cols}
|
|
156
|
+
onChange={(v) => onChange({ ...data, cols: v })}
|
|
157
|
+
placeholder="占列数 之和应为24"
|
|
158
|
+
/>
|
|
159
|
+
</div>
|
|
160
|
+
)}
|
|
161
|
+
</div>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const layoutConfig = {
|
|
166
|
+
wrapperCol: { span: 16 },
|
|
167
|
+
labelCol: { span: 8 },
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
function contentRender(props) {
|
|
171
|
+
return <ContentRender {...props} />;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const ContentRender = (props) => {
|
|
175
|
+
const { data, index, onChange, otherInfo = {} } = props;
|
|
176
|
+
// const [_, forceUpdate] = React.useState({});
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<>
|
|
180
|
+
{otherInfo?.columnsDirection === 'column' && (
|
|
181
|
+
<Form.Item wrapperCol={{ span: 20 }} labelCol={{ span: 4 }} label="高度" name="">
|
|
182
|
+
<CnNumberPicker
|
|
183
|
+
min={0}
|
|
184
|
+
max={100}
|
|
185
|
+
innerAfter="%"
|
|
186
|
+
style={{ width: 90 }}
|
|
187
|
+
defaultValue={data?.height}
|
|
188
|
+
onChange={(v) => onChange({ index, record: { ...data, height: v } })}
|
|
189
|
+
/>
|
|
190
|
+
<CnTooltip trigger={<Icon type="prompt" style={{ marginLeft: 6 }} />}>
|
|
191
|
+
仅在上下布局中生效:0-100 的整数,0 表示自动高度
|
|
192
|
+
</CnTooltip>
|
|
193
|
+
</Form.Item>
|
|
194
|
+
)}
|
|
195
|
+
<Form.Item
|
|
196
|
+
name=""
|
|
197
|
+
wrapperCol={{ span: 20 }}
|
|
198
|
+
labelCol={{ span: 4 }}
|
|
199
|
+
style={{ position: 'relative' }}
|
|
200
|
+
label={
|
|
201
|
+
<div>
|
|
202
|
+
参数
|
|
203
|
+
<a
|
|
204
|
+
rel="noreferrer"
|
|
205
|
+
target="_blank"
|
|
206
|
+
href="https://yuque.antfin.com/docs/share/b146be2b-dec0-4f0d-80e4-c11a34a701bc"
|
|
207
|
+
title="在vscode插件中按住ctrl再点击查看"
|
|
208
|
+
className="help-link"
|
|
209
|
+
>
|
|
210
|
+
帮助
|
|
211
|
+
</a>
|
|
212
|
+
</div>
|
|
213
|
+
}
|
|
214
|
+
>
|
|
215
|
+
<TableFormProxy
|
|
216
|
+
keyTitle={'key(参数名)'}
|
|
217
|
+
valueTitle={'value(参数值) - .$ALL 可获取整个动态对象'}
|
|
218
|
+
value={data?.params}
|
|
219
|
+
onChange={(v) => onChange({ index, record: { ...data, params: v } })}
|
|
220
|
+
/>
|
|
221
|
+
</Form.Item>
|
|
222
|
+
<Form.Item wrapperCol={{ span: 20 }} labelCol={{ span: 4 }} label="隐藏 当前栏 卡片" name="">
|
|
223
|
+
<CnSwitch
|
|
224
|
+
defaultChecked={data?.hideSelfCard}
|
|
225
|
+
onChange={(v) => onChange({ index, record: { ...data, hideSelfCard: v } })}
|
|
226
|
+
/>
|
|
227
|
+
</Form.Item>
|
|
228
|
+
<Collapse accordion>
|
|
229
|
+
<Panel
|
|
230
|
+
title={
|
|
231
|
+
<Balloon
|
|
232
|
+
trigger={
|
|
233
|
+
<div style={{ width: 'fit-content', display: 'flex', alignItems: 'center' }}>
|
|
234
|
+
其他配置:
|
|
235
|
+
<Icon type="help" size="small" />
|
|
236
|
+
</div>
|
|
237
|
+
}
|
|
238
|
+
align="t"
|
|
239
|
+
>
|
|
240
|
+
配置以下属性后,方可在每个分栏中 使用【触发其他分栏刷新】事件,引擎会监听 并自动更新其他分栏(触发一个
|
|
241
|
+
detail:updateColumns 事件。若分栏为 FTP 类型 则支持自动刷新,其他页面类型暂不支持)。
|
|
242
|
+
<div>
|
|
243
|
+
<b>建议在每个分栏模块中写胶水代码,手动控制其他分栏刷新。</b>
|
|
244
|
+
</div>
|
|
245
|
+
</Balloon>
|
|
246
|
+
}
|
|
247
|
+
>
|
|
248
|
+
<Form.Item {...layoutConfig} label="可以触发其他分栏刷新" name="">
|
|
249
|
+
<CnSwitch
|
|
250
|
+
defaultChecked={data?.canUpdateOtherColumns}
|
|
251
|
+
onChange={(v) => onChange({ index, record: { ...data, canUpdateOtherColumns: v } })}
|
|
252
|
+
/>
|
|
253
|
+
</Form.Item>
|
|
254
|
+
{/* <Form.Item {...layoutConfig} label={
|
|
255
|
+
<Balloon trigger={<div>可被其他分栏刷新<Icon type="help" size="small" /></div>} align="t">
|
|
256
|
+
<b>以FTP页面格式 被更新,其他页面类型暂不支持</b>
|
|
257
|
+
</Balloon>
|
|
258
|
+
} name="">
|
|
259
|
+
<CnSwitch
|
|
260
|
+
defaultChecked={data?.canBeUpdated}
|
|
261
|
+
onChange={(v) => onChange({ index, record: { ...data, canBeUpdated: v } })}
|
|
262
|
+
/>
|
|
263
|
+
</Form.Item> */}
|
|
264
|
+
<Form.Item {...layoutConfig} label={'可被其他分栏刷新'} name="">
|
|
265
|
+
<CnSwitch
|
|
266
|
+
defaultChecked={data?.canBeUpdated}
|
|
267
|
+
onChange={(v) => onChange({ index, record: { ...data, canBeUpdated: v } })}
|
|
268
|
+
/>
|
|
269
|
+
</Form.Item>
|
|
270
|
+
<Form.Item
|
|
271
|
+
{...layoutConfig}
|
|
272
|
+
label={
|
|
273
|
+
<Balloon
|
|
274
|
+
trigger={
|
|
275
|
+
<div>
|
|
276
|
+
当前分栏为FTP时自动刷新
|
|
277
|
+
<Icon type="help" size="small" />
|
|
278
|
+
</div>
|
|
279
|
+
}
|
|
280
|
+
align="t"
|
|
281
|
+
>
|
|
282
|
+
<b>以FTP页面格式 被更新,其他页面类型暂不支持</b>
|
|
283
|
+
</Balloon>
|
|
284
|
+
}
|
|
285
|
+
name=""
|
|
286
|
+
>
|
|
287
|
+
<CnSwitch
|
|
288
|
+
defaultChecked={data?.autoUpdateWhenIsFTP}
|
|
289
|
+
onChange={(v) => onChange({ index, record: { ...data, autoUpdateWhenIsFTP: v } })}
|
|
290
|
+
/>
|
|
291
|
+
</Form.Item>
|
|
292
|
+
</Panel>
|
|
293
|
+
</Collapse>
|
|
294
|
+
</>
|
|
295
|
+
);
|
|
296
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Form, Input, Switch, Select } from '@cainiaofe/cn-ui';
|
|
3
3
|
import ActionPanel from './Actions';
|
|
4
|
-
import TableFormProxy from '
|
|
5
|
-
import useModule from '
|
|
4
|
+
import TableFormProxy from '$src/components/ajax-schema-form/table-form-proxy';
|
|
5
|
+
import useModule from '$src/hooks/useModule';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 自定义详情内容, 引入源码、其他页面等
|